protected void btnCrear_Click(object sender, EventArgs e) { if (Page.IsValid) { RolLaboratorioLogica rol = new RolLaboratorioLogica(); rol.RolLaboratorio_id = txtID.Text; rol.Nombre = txtNombre.Text; rol.Detalle = txtDetalle.Text; if (logica.InsertarRolLaboratorio(rol)) { lblMensaje.Text = "Rol Laboratorio " + txtNombre.Text + " creado correctamente"; consecutivoLogica.ActualizarConsecutivo(consecutivo); } } }
protected void btnActualizar_Click(object sender, EventArgs e) { if (Page.IsValid) { RolLaboratorioLogica rol = new RolLaboratorioLogica(); rol.RolLaboratorio_id = txtID.Text; rol.Nombre = txtNombre.Text; rol.Detalle = txtDetalle.Text; if (logica.ActualizarRolLaboratorio(rol)) { lblMensaje.Text = "Rol Laboratorio " + txtNombre.Text + " actualizado correctamente"; this.CargarRoles(); Limpiar(); } } }
protected void gvRolLaboratorio_RowCommand(object sender, GridViewCommandEventArgs e) { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvRolLaboratorio.Rows[index]; string id = row.Cells[1].Text; RolLaboratorioLogica rol = new RolLaboratorioLogica(); rol = logica.BuscarRolLaboratorio(id); txtID.Text = rol.RolLaboratorio_id; txtNombre.Text = rol.Nombre; txtDetalle.Text = rol.Detalle; btnActualizar.Visible = true; btnLimpiar.Visible = true; btnEliminar.Visible = true; }