예제 #1
0
        protected void btnEliminar_Click(object sender, EventArgs e)
        {
            PerfilDTO obj = new PerfilDTO();
            PerfilDAO objDAO = new PerfilDAO();

            if (this.txtIdPerfil.Text != "")
            {
                objDAO.Eliminar(Convert.ToInt32(this.txtIdPerfil.Text));
            }
            Listar();
        }
예제 #2
0
        protected void btnActualizar_Click(object sender, EventArgs e)
        {
            PerfilDTO obj = new PerfilDTO();
            PerfilDAO objDAO = new PerfilDAO();

            obj = objDAO.ListarPorClave(Convert.ToInt32(this.txtIdPerfil.Text));
            obj.NombrePerfil = this.txtNombrePerfil.Text;
            if (this.chkEstado.Checked)
                obj.Estado = "1";
            else
                obj.Estado = "0";

            objDAO.Actualizar(obj);
            this.lblMensaje.Text = "Se actualizo el registro";
        }
예제 #3
0
        protected void ListarPerfiles(int idUsuario)
        {
            List<PerfilDTO> objPerfil;
            UsuarioPerfilDTO objUsuarioPerfilDTO;

            PerfilDAO objPerfilDAO = new PerfilDAO();

            UsuarioPerfilDAO objUsuarioPerfilDAO = new UsuarioPerfilDAO();
            try
            {
                //CARGAR PERFILES
                tvwPerfiles.Nodes.Clear();
                objPerfil = objPerfilDAO.Listar();
                foreach (PerfilDTO perfil in objPerfil)
                {
                    if (perfil.Estado.Equals("1"))
                    {
                        TreeNode nodo1 = new TreeNode((string)perfil.NombrePerfil);
                        nodo1.Value = perfil.IdPerfil.ToString();
                        tvwPerfiles.Nodes.Add(nodo1);
                        //VERIFICAR SI USUARIO TIENE PERFIL ASIGNADO
                        int idPerfil = perfil.IdPerfil;
                        objUsuarioPerfilDTO = objUsuarioPerfilDAO.ListarPorClave(idUsuario, idPerfil);
                        if (objUsuarioPerfilDTO.IdPerfil > 0)
                            nodo1.Checked = true;
                    }
                }
            }
            catch (Exception err)
            {
                throw (err);
            }
        }
예제 #4
0
 protected void Listar()
 {
     List<PerfilDTO> obj;
     PerfilDAO objDAO = new PerfilDAO();
     try
     {
         obj = objDAO.Listar();
         this.gvLista.DataSource = obj;
         this.gvLista.DataBind();
     }
     catch (Exception err)
     {
         throw (err);
     }
 }
예제 #5
0
        protected void gvLista_SelectedIndexChanged(object sender, EventArgs e)
        {
            PerfilDAO objDAO = new PerfilDAO();
            PerfilDTO obj;
            try
            {
                this.txtIdPerfil.Text = gvLista.SelectedRow.Cells[0].Text;
                obj = objDAO.ListarPorClave(Convert.ToInt32(this.txtIdPerfil.Text));

                this.txtNombrePerfil.Text = obj.NombrePerfil;
                if (obj.Estado == "1")
                    this.chkEstado.Checked = true;
                else
                    this.chkEstado.Checked = false;

                this.panRegistro.Visible = true;
                this.panLista.Visible = false;
                this.panFunciones.Visible = true;

                this.btnGrabar.Visible = false;
                this.btnActualizar.Visible = true;
                this.btnEliminar.Visible = true;
                this.btnCancelar.Visible = true;

                List<PerfilFuncionDTO> ListaPerfilFuncionDTO = objPerfilFuncionDAO.ListarPorPerfil(Convert.ToInt32(this.txtIdPerfil.Text));
                this.gvListaFuncion.DataSource = ListaPerfilFuncionDTO;
                this.gvListaFuncion.DataBind();

                //LISTAR FUNCIONES
                ListarFunciones(obj.IdPerfil);
            }
            catch (Exception err)
            {
                this.lblMensaje.Text = err.Message.ToString();
            }
        }
예제 #6
0
        protected void gvListaFuncion_SelectedIndexChanged(object sender, EventArgs e)
        {
            PerfilDAO objDAO = new PerfilDAO();
            PerfilDTO obj;
            try
            {
                this.txtIdPerfil.Text = gvLista.SelectedRow.Cells[0].Text;
                obj = objDAO.ListarPorClave(Convert.ToInt32(this.txtIdPerfil.Text));

                this.txtNombrePerfil.Text = obj.NombrePerfil;
                if (obj.Estado == "1")
                    this.chkEstado.Checked = true;
                else
                    this.chkEstado.Checked = false;

            }
            catch (Exception err)
            {
                this.lblMensaje.Text = err.Message.ToString();
            }
        }
예제 #7
0
        protected void btnGrabar_Click(object sender, EventArgs e)
        {
            PerfilDTO obj = new PerfilDTO();
            PerfilDAO objDAO = new PerfilDAO();

            if (this.txtIdPerfil.Text == "")
            {
                obj.NombrePerfil = this.txtNombrePerfil.Text;
                if (this.chkEstado.Checked)
                    obj.Estado = "1";
                else
                    obj.Estado = "0";

                int id = objDAO.Agregar(obj);
                this.txtIdPerfil.Text = id.ToString();
                this.lblMensaje.Text = "Se registro el Perfil";
            ///////////////77
                obj = objDAO.ListarPorClave(Convert.ToInt32(this.txtIdPerfil.Text));

                this.txtNombrePerfil.Text = obj.NombrePerfil;
                if (obj.Estado == "1")
                    this.chkEstado.Checked = true;
                else
                    this.chkEstado.Checked = false;

                this.panRegistro.Visible = true;
                this.panLista.Visible = false;
                this.panFunciones.Visible = true;

                this.btnGrabar.Visible = false;
                this.btnActualizar.Visible = true;
                this.btnEliminar.Visible = true;
                this.btnCancelar.Visible = true;

                //LISTAR FUNCIONES
                ListarFunciones(obj.IdPerfil);

            }
            else
            {
                obj = objDAO.ListarPorClave(Convert.ToInt32(this.txtIdPerfil.Text));
                obj.NombrePerfil = this.txtNombrePerfil.Text;
                if (this.chkEstado.Checked)
                    obj.Estado = "1";
                else
                    obj.Estado = "0";

                objDAO.Actualizar(obj);
                this.lblMensaje.Text = "Se actualizo el registro";
            }

            Listar();
        }