public VMItemModulo RegistrarItemModulo(string nombre, int idModulo, string urlIcono, string urlDestino, int idItemPadre, int orden, bool activo) { try { VMItemModulo item = new VMItemModulo(); string error = string.Empty; if (idModulo <= 0) { error += "- Indica el modulo al que pertenece esta página." + "<br />"; } if (string.IsNullOrEmpty(nombre)) { error += "- Debes registrar un Nombre." + "<br />"; } if (string.IsNullOrEmpty(error)) { IDAOItemModulo iDaoModuloApp = new DAOItemModulo(); RespuestaBD resp = iDaoModuloApp.RegistrarItemModulo(nombre, idModulo, urlIcono, urlDestino, idItemPadre, orden, activo); if (resp.EXISTE_ERROR) { throw new Exception(resp.MENSAJE); } else { item = new VMItemModulo() //mapea modelo { Activo = activo, Descripcion = nombre, IdItemPadre = idItemPadre, IdModulo = idModulo, Orden = orden, Url = urlDestino, UrlIcono = urlIcono, IdItemModulo = (int)resp.dataSet.Tables[0].Rows[0]["fi_id_item_modulo"] }; } return(item); } else { throw new Exception(error); } } catch (Exception ex) { throw new Exception(new Util().ObtenerMsjExcepcion(ex)); } }
public List <E.VMItemModulo> ObtenerItemsSistema() { try { List <E.VMItemModulo> items = new DAOItemModulo(this.usuario, this.pass).ObtenerItemsSistema(); return(items); } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <VMItemModulo> ObtenerItemsDeSistema() { try { RespuestaBD resp = new DAOItemModulo().ObtenerItemsSistema(null); if (resp.EXISTE_ERROR) { throw new Exception(resp.MENSAJE); } else { List <VMItemModulo> lista = new List <VMItemModulo>(); if (resp.dataSet.Tables.Count > 0) { DataTable datos = resp.dataSet.Tables[0]; lista = (from x in datos.AsEnumerable() select new VMItemModulo() { Activo = x.Field <bool>("fl_estatus_item"), Descripcion = x.Field <string>("fc_desc_item"), IdItemModulo = x.Field <int>("fi_id_item_modulo"), IdItemPadre = x.Field <int>("fi_id_item_padre"), IdModulo = x.Field <int>("fi_id_modulo"), IdSistema = x.Field <int>("fi_id_sistema"), Modulo = x.Field <string>("fc_nombre_modulo"), Orden = x.Field <int>("fi_id_orden"), Sistema = x.Field <string>("fc_nombre_sistema"), Url = x.Field <string>("fc_url"), UrlIcono = x.Field <string>("fc_url_icono"), }).ToList(); } return(lista); } } catch (Exception ex) { throw new Exception(new Util().ObtenerMsjExcepcion(ex)); } }
public void EditarItemModulo(int idItem, string nombre, int idModulo, string urlIcono, string urlDestino, int idItemPadre, int orden, bool activo) { try { VMItemModulo item = new VMItemModulo(); string error = string.Empty; if (idModulo <= 0) { error += "- Indica el modulo al que pertenece esta página." + "<br />"; } if (string.IsNullOrEmpty(nombre)) { error += "- Debes registrar un Nombre." + "<br />"; } if (!string.IsNullOrEmpty(error)) { IDAOItemModulo iDaoModuloApp = new DAOItemModulo(); RespuestaBD resp = iDaoModuloApp.EditarItemModulo(idItem, nombre, idModulo, urlIcono, urlDestino, idItemPadre, orden, activo); if (resp.EXISTE_ERROR) { throw new Exception(resp.MENSAJE); } } else { throw new Exception(error); } } catch (Exception ex) { throw new Exception(new Util().ObtenerMsjExcepcion(ex)); } }