public ActionResult Mantenimiento(long codigo = 0) { Alerta = new AlertaLogic(); List <ParametroDetalleLogic> listaTipoAlerta = new List <ParametroDetalleLogic>(); if (codigo > 0) { Alerta = _AlertaAppService.Obtener(codigo); Alerta.InfoMovs = new InfoMovs { ACCION = Enums.Action.Edit }; } else { Alerta.Estado = true; } vmAlerta.Alerta = Alerta; listaTipoAlerta.AddRange(_ParametroDetalleAppService.Listar(Enums.Parametro.TipoAlerta).Where(x => x.Estado).ToList()); listaTipoAlerta.Insert(0, new ParametroDetalleLogic { CodigoElemento = "0", Nombre = Enums.ComboDefault.Seleccione }); ViewBag.listaTipoAlerta = listaTipoAlerta; return(PartialView(vmAlerta)); }
public AlertaLogic Obtener(float codigo) { AlertaLogic entidadLogic = new AlertaLogic(); try { SQLServer.OpenConection(); SQLServer.CreateCommand("MAN.USP_SEL_ALERTA_OBTENER", CommandType.StoredProcedure, SQLServer.CreateParameter("CODIGO_ALERTA", SqlDbType.BigInt, codigo)); using (IDataReader oReader = SQLServer.GetDataReader(CommandBehavior.CloseConnection)) { entidadLogic = new GenericInstance <AlertaLogic>().readDataReader(oReader); } } catch (Exception ex) { throw ex; } finally { SQLServer.CloseConection(); } return(entidadLogic); }