Example #1
0
        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));
            }
        }
Example #2
0
        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));
            }
        }