103 lines
No EOL
4.1 KiB
C#
103 lines
No EOL
4.1 KiB
C#
using NLog;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
using ULA.Cathay.CreditoModel.Credito;
|
|
using ULA.Cathay.ModuloMantenimiento.Commons;
|
|
using ULA.Cathay.ModuloMantenimiento.Json;
|
|
using Ultimus.Interfaces;
|
|
|
|
namespace ULA.Cathay.ModuloMantenimiento.ControllersWebApi
|
|
{
|
|
public class TiemposEjecucionNotificacionesCompletionTimeAPIController : ApiController
|
|
{
|
|
private static Logger logger = LogManager.GetLogger("TiemposEjecucionNotificacionesCompletionTimeAPIController");
|
|
|
|
private string _IDLogger;
|
|
public string IDLogger
|
|
{
|
|
get { return _IDLogger; }
|
|
set { _IDLogger = string.Format("INCIDENT {0}|", value); }
|
|
}
|
|
|
|
#region ObtenerItems
|
|
[HttpGet]
|
|
public List<TiemposEjecucionNotificacionesCompletionTime> ObtenerItems()
|
|
{
|
|
List<TiemposEjecucionNotificacionesCompletionTime> listaTiemposEjecucionNotificacionesCompletionTime = null;
|
|
try
|
|
{
|
|
listaTiemposEjecucionNotificacionesCompletionTime = new List<TiemposEjecucionNotificacionesCompletionTime>();
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
listaTiemposEjecucionNotificacionesCompletionTime = db.TiemposEjecucionNotificacionesCompletionTime.ToList();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Error(IDLogger + " Error " + Utilities.GetCurrentMethodName() + "=" + ex.Message + ex.StackTrace);
|
|
}
|
|
return listaTiemposEjecucionNotificacionesCompletionTime;
|
|
}
|
|
#endregion
|
|
|
|
//#region toggleStateItem
|
|
//[HttpPost]
|
|
//public string toggleStateItem( TiemposEjecucionNotificacionesCompletionTime model)
|
|
//{
|
|
// try
|
|
// {
|
|
// using (CreditoContex db = new CreditoContex())
|
|
// {
|
|
// TiemposEjecucionNotificacionesCompletionTime _model = db. TiemposEjecucionNotificacionesCompletionTime.Where(t => t.IdTiempo == model.IdTiempo).FirstOrDefault();
|
|
// if (_model != null)
|
|
// {
|
|
// _model.Estado = model.Estado;
|
|
// _model.UsuarioModificado = model.UsuarioModificado;
|
|
// _model.FechaModificacion = DateTime.Now;
|
|
// db.SaveChanges();
|
|
// return TipoCodigoRespuesta.EXITOSO.ToString();
|
|
// }
|
|
// }
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// logger.Error(IDLogger + " Error " + Utilities.GetCurrentMethodName() + "=" + ex.Message + ex.StackTrace);
|
|
// return TipoCodigoRespuesta.ERROR.ToString();
|
|
// }
|
|
// return TipoCodigoRespuesta.ERROR.ToString();
|
|
//}
|
|
//#endregion
|
|
|
|
#region ModificarItem
|
|
[HttpPost]
|
|
public string ModificarItem( TiemposEjecucionNotificacionesCompletionTime model)
|
|
{
|
|
try
|
|
{
|
|
using (CreditoContex db = new CreditoContex())
|
|
{
|
|
TiemposEjecucionNotificacionesCompletionTime _model = db.TiemposEjecucionNotificacionesCompletionTime.Where(t => t.IdTiempo == model.IdTiempo).FirstOrDefault();
|
|
if (_model != null)
|
|
{
|
|
_model.Dias = model.Dias;
|
|
_model.UsuarioModificado = model.UsuarioModificado;
|
|
_model.FechaModificacion = DateTime.Now;
|
|
db.SaveChanges();
|
|
return TipoCodigoRespuesta.EXITOSO.ToString();
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
logger.Error(IDLogger + " Error " + Utilities.GetCurrentMethodName() + "=" + ex.Message + ex.StackTrace);
|
|
return TipoCodigoRespuesta.ERROR.ToString();
|
|
}
|
|
return TipoCodigoRespuesta.ERROR.ToString();
|
|
}
|
|
#endregion
|
|
}
|
|
} |