git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C266
This commit is contained in:
parent
24214cbc26
commit
a9b3c0b6b6
3 changed files with 73 additions and 0 deletions
|
|
@ -66,6 +66,9 @@ namespace AYA.SlnSinort.WCF
|
|||
[OperationContract]
|
||||
ProyectoNormativoJSON InsertarActualizarTareasPendientes(ProyectoNormativoJSON model);
|
||||
|
||||
[OperationContract]
|
||||
SolicitudJSON InsertarActualizarTareasPendientes2(SolicitudJSON model);
|
||||
|
||||
[OperationContract]
|
||||
NotificacionesJSON ObtenerCantidadTareasPendientes(NotificacionesJSON model);
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -494,6 +494,27 @@ namespace AYA.SlnSinort.WCF
|
|||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
public SolicitudJSON InsertarActualizarTareasPendientes2(SolicitudJSON model)
|
||||
{
|
||||
try
|
||||
{
|
||||
var tareasDAL = new TareasPendientesDAL();
|
||||
foreach (var tareas in model.ListaTareasPendientes)
|
||||
{
|
||||
model.TareasPendientes = tareas;
|
||||
tareasDAL.InsertarActualizarTareasPendientes2(model);
|
||||
}
|
||||
|
||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR;
|
||||
log.Error(ex);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
public NotificacionesJSON ObtenerCantidadTareasPendientes(NotificacionesJSON model)
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,55 @@ namespace AYA.SlnSinortModel.DAL.Sinort
|
|||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
public SolicitudJSON InsertarActualizarTareasPendientes2(SolicitudJSON model)
|
||||
{
|
||||
TareasPendientes Actual = new TareasPendientes();
|
||||
|
||||
try
|
||||
{
|
||||
model.ClearProperties();
|
||||
|
||||
using (SinortContex Conn = new SinortContex())
|
||||
{
|
||||
Actual = Conn.TareasPendientes.Where(x => x.IdTareasPendientes == model.TareasPendientes.IdTareasPendientes).FirstOrDefault();
|
||||
if (Actual == null)
|
||||
{
|
||||
int? Next_id = Conn.TareasPendientes.Max(t => (int?)t.IdTareasPendientes);
|
||||
model.TareasPendientes.IdTareasPendientes = (Next_id == null) ? 1 : Next_id.Value + 1;
|
||||
model.TareasPendientes.FechaCreacion = DateTime.Now;
|
||||
Conn.TareasPendientes.Add(model.TareasPendientes);
|
||||
}
|
||||
else
|
||||
{
|
||||
model.TareasPendientes.FechaModificacion = DateTime.Now;
|
||||
model.TareasPendientes.FechaCreacion = Actual.FechaCreacion;
|
||||
model.TareasPendientes.UsuarioCreacion = Actual.UsuarioCreacion;
|
||||
Conn.Entry(Actual).State = System.Data.Entity.EntityState.Detached;
|
||||
Conn.TareasPendientes.Attach(model.TareasPendientes);
|
||||
Conn.Entry(model.TareasPendientes).State = System.Data.Entity.EntityState.Modified;
|
||||
}
|
||||
Conn.SaveChanges();
|
||||
Conn.Commit();
|
||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.EXITOSO.ToString();
|
||||
}
|
||||
}
|
||||
catch (DbEntityValidationException ex)
|
||||
{
|
||||
log.Error(ex);
|
||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR.ToString();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Error(ex);
|
||||
model.CodigoRespuesta = EnumTipoCodigoRespuesta.ERROR.ToString();
|
||||
}
|
||||
finally
|
||||
{
|
||||
Actual = null;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
public NotificacionesJSON ObtenerCantidadTareasPendientes(NotificacionesJSON model)
|
||||
{
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue