예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CADPermisos per      = new CADPermisos();
            int         userid   = Account.Login.userId;
            DataTable   permisos = per.tienePermiso(9, userid);


            if (permisos.Rows.Count == 0)
            {
                Labelpermiso.Text = "No tiene ningun permisos";
                theDiv.Visible    = false;
            }
            else
            {
                string consultar = permisos.Rows[0]["consultar"].ToString();

                if (Convert.ToInt32(consultar) == 1)
                {
                    theDiv.Visible = true;
                }
                else
                {
                    theDiv.Visible    = false;
                    Labelpermiso.Text = "No tiene permisos para ver las listas";
                }
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CADPermisos per      = new CADPermisos();
            int         userid   = Account.Login.userId;
            DataTable   permisos = per.tienePermiso(2, userid);


            if (permisos.Rows.Count == 0)
            {
                Labelpermiso.Text = "No tiene ningun permisos";
                theDiv.Visible    = false;
            }
            else
            {
                string consultar = permisos.Rows[0]["consultar"].ToString();
                string agregar   = permisos.Rows[0]["agregar"].ToString();
                string editar    = permisos.Rows[0]["editar"].ToString();
                string eliminar  = permisos.Rows[0]["eliminar"].ToString();



                if (Convert.ToInt32(consultar) == 1)
                {
                    BTNConsultar.Enabled = true;
                }
                else
                {
                    BTNConsultar.Enabled = false;
                }
                if (Convert.ToInt32(agregar) == 1)
                {
                    BTNNuevo.Enabled = true;
                }
                else
                {
                    BTNNuevo.Enabled = false;
                }
                if (Convert.ToInt32(editar) == 1)
                {
                    BTNModificar.Enabled = true;
                }
                else
                {
                    BTNModificar.Enabled = false;
                }
                if (Convert.ToInt32(eliminar) == 1)
                {
                    BTNEliminar.Enabled = true;
                }
                else
                {
                    BTNEliminar.Enabled = false;
                }
            }
        }
        public int modificiarPermiso(CENPermiso permiso, int flag)
        //DESCRIPCION: Actualiza la lista de permisos
        {
            CADPermisos cad = new CADPermisos();

            try
            {
                return(cad.guardarPermiso(permiso, flag));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <CENMenu> DataMenus()
        {
            //DESCRIPCION: carga todos lo mantenedores guardados
            CADPermisos permisos = new CADPermisos();

            try
            {
                return(permisos.DataMenus());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public int guardarPermiso(CENPermiso permiso, int flag)
        {
            //DESCRIPCION: Guarda una lista de perfiles
            CADPermisos cad = new CADPermisos();

            try
            {
                return(cad.guardarPermiso(permiso, flag));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <CENModulo> cargarModulos(int flag)
        {
            List <CENModulo> datos = new List <CENModulo>();
            CADPermisos      cad   = new CADPermisos();

            try
            {
                return(datos = cad.cargarModulos(flag));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <CENMenu> DataMantenedoresNombre(string nombre)
        {
            //DESCRIPCION: Busca los mantenedores por nombre
            CADPermisos permisos = new CADPermisos();

            try
            {
                return(permisos.DataMantenedoresNombre(nombre));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <CENMenu> cargarMantenedores(int flag)

        {
            List <CENMenu> datos = new List <CENMenu>();
            CADPermisos    cad   = new CADPermisos();

            try
            {
                return(datos = cad.cargarMantenedores(flag));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public List <CENUsuario> cargarPerfil(int flag)
        {
            //DESCRIPCION: carga todos lo perfiles
            List <CENUsuario> datos = new List <CENUsuario>();
            CADPermisos       cad   = new CADPermisos();

            try
            {
                return(datos = cad.cargarPerfil(flag));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }