public JsonResult AgregarActualizarAplicacion(BeEcAplicacion obj) { ecAplicacionService = new EcAplicacionService(); ResponseViewModel res = new ResponseViewModel(); string mensaje = ""; string tipo = ""; try { if (obj.apl_id == 0) { bool valida = ecAplicacionService.InsertarAplicacion(obj, ref mensaje, ref tipo); res.Tipo = tipo; res.Mensaje = mensaje; } else { bool valida = ecAplicacionService.UpdateAplicacion(obj, ref mensaje, ref tipo); res.Tipo = tipo; res.Mensaje = mensaje; } } catch (Exception e) { res.Tipo = Configuration.SI_MSJ_TIP_ERROR; res.Mensaje = e.Message; } return(Json(res)); }
public List <BeEcAplicacion> get_lista(ref string mensaje, ref string tipo) { string sqlquery = "USP_Consultar_Aplicacion"; List <BeEcAplicacion> list = null; try { using (SqlConnection cn = new SqlConnection(Conexion)) { if (cn.State == 0) { cn.Open(); } using (SqlCommand cmd = new SqlCommand(sqlquery, cn)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; SqlDataReader dr = cmd.ExecuteReader(); list = new List <BeEcAplicacion>(); if (dr.HasRows) { int posId = dr.GetOrdinal("apl_id"); int posNombre = dr.GetOrdinal("apl_nombre"); int posTipId = dr.GetOrdinal("apl_tip_id"); int posUrl = dr.GetOrdinal("apl_url"); int posOrden = dr.GetOrdinal("apl_orden"); int posEstId = dr.GetOrdinal("apl_est_id"); int posAction = dr.GetOrdinal("apl_action"); int posController = dr.GetOrdinal("apl_controller"); while (dr.Read()) { BeEcAplicacion apl = new BeEcAplicacion(); apl.apl_id = dr.GetDecimal(posId); apl.apl_nombre = (dr.IsDBNull(posNombre)) ? "" : dr.GetString(posNombre); apl.apl_tip_id = (dr.IsDBNull(posTipId)) ? "" : dr.GetString(posTipId); apl.apl_url = (dr.IsDBNull(posUrl)) ? "" : dr.GetString(posUrl); apl.apl_orden = (dr.IsDBNull(posOrden)) ? 0 : dr.GetDecimal(posOrden); apl.apl_est_id = (dr.IsDBNull(posEstId)) ? "" : dr.GetString(posEstId); apl.apl_action = (dr.IsDBNull(posAction)) ? "" : dr.GetString(posAction); apl.apl_controller = (dr.IsDBNull(posController)) ? "" : dr.GetString(posController); list.Add(apl); } } } } } catch (Exception e) { mensaje = Configuration.SI_MSJ_DES_ERROR + "\n\n" + "Detalle de Error: " + e.Message; tipo = Configuration.SI_MSJ_TIP_ERROR; list = null; } mensaje = Configuration.SI_MSJ_DES_EXITO; tipo = Configuration.SI_MSJ_TIP_EXITO; return(list); }
public List <BeEcAplicacion> get_lista(BeEcFuncion obj, ref string mensaje, ref string tipo) { string sqlquery = "USP_Leer_Apl_Fun"; List <BeEcAplicacion> list = null; try { using (SqlConnection cn = new SqlConnection(Conexion)) { if (cn.State == 0) { cn.Open(); } using (SqlCommand cmd = new SqlCommand(sqlquery, cn)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Fun_Id", obj.fun_id); SqlDataReader dr = cmd.ExecuteReader(); list = new List <BeEcAplicacion>(); if (dr.HasRows) { while (dr.Read()) { int posId = dr.GetOrdinal("apl_id"); int posNombre = dr.GetOrdinal("apl_nombre"); int posOrden = dr.GetOrdinal("apl_orden"); BeEcAplicacion fila = new BeEcAplicacion(); fila.apl_id = dr.GetDecimal(posId); fila.apl_nombre = dr.GetString(posNombre); fila.apl_orden = dr.GetDecimal(posOrden); list.Add(fila); } } } } } catch (Exception e) { mensaje = Configuration.SI_MSJ_DES_ERROR + "\n\n" + "Detalle de Error: " + e.Message; tipo = Configuration.SI_MSJ_TIP_ERROR; list = null; } mensaje = Configuration.SI_MSJ_DES_EXITO; tipo = Configuration.SI_MSJ_TIP_EXITO; return(list); }
public Boolean InsertarAplicacion(BeEcAplicacion obj, ref string mensaje, ref string tipo) { string sqlquery = "USP_Insertar_Aplicacion"; Boolean valida = false; try { using (SqlConnection cn = new SqlConnection(Conexion)) { if (cn.State == 0) { cn.Open(); } using (SqlCommand cmd = new SqlCommand(sqlquery, cn)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@apl_id", obj.apl_id).Direction = ParameterDirection.Output; cmd.Parameters.AddWithValue("@apl_nombre", obj.apl_nombre); cmd.Parameters.AddWithValue("@apl_tip_id", obj.apl_tip_id); cmd.Parameters.AddWithValue("@apl_url", obj.apl_url); cmd.Parameters.AddWithValue("@apl_orden", obj.apl_orden); cmd.Parameters.AddWithValue("@apl_est_id", obj.apl_est_id); cmd.Parameters.AddWithValue("@apl_ayuda", obj.apl_ayuda); cmd.Parameters.AddWithValue("@apl_comentario", obj.apl_comentario); cmd.Parameters.AddWithValue("@apl_controller", obj.apl_controller); cmd.Parameters.AddWithValue("@apl_action", obj.apl_action); cmd.ExecuteNonQuery(); valida = true; } } } catch (Exception e) { mensaje = Configuration.SI_MSJ_DES_ERROR + "\n\n" + "Detalle de Error: " + e.Message; tipo = Configuration.SI_MSJ_TIP_ERROR; valida = false; } mensaje = Configuration.SI_MSJ_DES_EXITO; tipo = Configuration.SI_MSJ_TIP_EXITO; return(valida); }
public JsonResult BuscarAplicacion(BeEcAplicacion obj) { ecAplicacionService = new EcAplicacionService(); ResponseViewModel res = new ResponseViewModel(); string mensaje = ""; string tipo = ""; try { List <BeEcAplicacion> lst = ecAplicacionService.ConsultarAplicacion(obj, ref mensaje, ref tipo); res.Tipo = tipo; res.Mensaje = mensaje; res.Lista = lst.OrderBy(x => x.apl_id); } catch (Exception e) { res.Tipo = Configuration.SI_MSJ_TIP_ERROR; res.Mensaje = e.Message; } return(Json(res)); }
public List <BeEcAplicacion> ConsultarAplicacion(BeEcAplicacion obj, ref string mensaje, ref string tipo) { return(ecAplicacionDAO.ConsultarAplicacion(obj, ref mensaje, ref tipo)); }
public Boolean InsertarAplicacion(BeEcAplicacion obj, ref string mensaje, ref string tipo) { return(ecAplicacionDAO.InsertarAplicacion(obj, ref mensaje, ref tipo)); }
public Boolean UpdateAplicacion(BeEcAplicacion obj, ref string mensaje, ref string tipo) { return(ecAplicacionDAO.UpdateAplicacion(obj, ref mensaje, ref tipo)); }