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"; }
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(); } }
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(); } }
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(); }