protected void grvLectores_RowCommand(object sender, GridViewCommandEventArgs e) { try { int fila = Convert.ToInt16(e.CommandArgument);//Manejo la fila en la que hizo click if (e.CommandName == "Editar") { String vcod = grvLectores.Rows[fila].Cells[1].Text; objBE = objBL.ConsultarLector(vcod); lblID.Text = objBE.Id_Lector; txtNombres.Text = objBE.Nom_Lector; txtApePaterno.Text = objBE.ApePat_Lector; txtApeMaterno.Text = objBE.ApeMat_Lector; txtDni.Text = objBE.Dni; txtDireccion.Text = objBE.Dir; txtTelefono.Text = objBE.Tel; txtEmail.Text = objBE.Email_Lector; txtDistrito.Text = objBE.Id_Distrito; lblMensaje2.Text = String.Empty; lblId2.Visible = true; lblID.Visible = true; hdfAccion.Value = "M"; PopMant.Show(); } } catch (Exception ex) { lblMensaje.Text = ex.Message; } }
protected void grvLibros_RowCommand(object sender, GridViewCommandEventArgs e) { try { int fila = Convert.ToInt16(e.CommandArgument);//Manejo la fila en la que hizo click if (e.CommandName == "Editar") { String vcod = grvLibros.Rows[fila].Cells[1].Text; objBE = objBL.ConsultarLibro(vcod); lblID.Text = objBE.Id_Libro; txtTitulo.Text = objBE.Tit_Libro; txtAutor.Text = objBE.Id_Autor; txtCategoria.Text = objBE.Id_Categoria; txtEditorial.Text = objBE.Id_Editorial; txtIdioma.Text = objBE.Id_Idioma; txtAño.Text = objBE.Año_Lanz; lblMensaje2.Text = String.Empty; lblId2.Visible = true; lblID.Visible = true; hdfAccion.Value = "M"; PopMant.Show(); } } catch (Exception ex) { lblMensaje.Text = ex.Message; } }
protected void btnNuevo_Click(object sender, EventArgs e) { lblMensaje2.Text = String.Empty; lblID.Visible = false; lblId2.Visible = false; hdfAccion.Value = "A"; PopMant.Show(); }
protected void btnGrabar_Click(object sender, EventArgs e) { try { if (txtNombres.Text == String.Empty) { throw new Exception("El nombre es obligatorio"); } //CARGO MI ENTIDAD DE NEGOCIOS objBE.Nom_Lector = txtNombres.Text.Trim(); objBE.ApePat_Lector = txtApePaterno.Text.Trim(); objBE.ApeMat_Lector = txtApeMaterno.Text.Trim(); objBE.Dni = txtDni.Text.Trim(); objBE.Dir = txtDireccion.Text.Trim(); objBE.Tel = txtTelefono.Text.Trim(); objBE.Email_Lector = txtEmail.Text.Trim(); objBE.Id_Distrito = txtDistrito.Text.Trim(); if (hdfAccion.Value == "A") { if (objBL.InsertarLector(objBE) == true) { Enlazar(); } else { throw new Exception("Error al insertar, revisar."); } } if (hdfAccion.Value == "M") { objBE.Id_Lector = lblID.Text; if (objBL.ActualizarLector(objBE) == true) { Enlazar(); } else { throw new Exception("Error al Actualizar, revisar."); } } } catch (Exception ex) { lblMensaje2.Text = ex.Message; PopMant.Show(); } }
protected void btnGrabar_Click(object sender, EventArgs e) { try { if (txtTitulo.Text == String.Empty) { throw new Exception("El nombre es obligatorio"); } //CARGO MI ENTIDAD DE NEGOCIOS objBE.Tit_Libro = txtTitulo.Text.Trim(); objBE.Id_Autor = txtAutor.Text.Trim(); objBE.Id_Categoria = txtCategoria.Text.Trim(); objBE.Id_Editorial = txtEditorial.Text.Trim(); objBE.Id_Idioma = txtIdioma.Text.Trim(); objBE.Año_Lanz = txtAño.Text.Trim(); if (hdfAccion.Value == "A") { if (objBL.InsertarLibro(objBE) == true) { Enlazar(); } else { throw new Exception("Error al insertar, revisar."); } } if (hdfAccion.Value == "M") { objBE.Id_Libro = lblID.Text; if (objBL.ActualizarLibro(objBE) == true) { Enlazar(); } else { throw new Exception("Error al Actualizar, revisar."); } } } catch (Exception ex) { lblMensaje2.Text = ex.Message; PopMant.Show(); } }
protected void btnNuevo_Click(object sender, EventArgs e) { txtApellido.Text = ""; txtEdad.Text = ""; txtNick.Text = ""; txtNombre.Text = ""; chkCapitan.Checked = false; dropEquipo.SelectedIndex = 0; lblMensaje2.Text = ""; txtNombre.Focus(); PopMant.Show(); }
protected void btnNuevo_Click(object sender, EventArgs e) { //LIMPIAR LOS CONTROLES txtNombres.Text = String.Empty; txtApePaterno.Text = String.Empty; txtApeMaterno.Text = String.Empty; txtDni.Text = String.Empty; txtDireccion.Text = String.Empty; txtTelefono.Text = String.Empty; txtEmail.Text = String.Empty; txtDistrito.Text = String.Empty; lblMensaje2.Text = String.Empty; lblID.Visible = false; lblId2.Visible = false; hdfAccion.Value = "A"; PopMant.Show(); }
protected void btnEliminar_Click(object sender, EventArgs e) { try { if (objBL.EliminarLibro(lblID.Text) == true) { Enlazar(); } else { throw new Exception("No se pudo eliminar el registro porque esta asociado a otra tabla"); } } catch (Exception ex) { lblMensaje2.Text = ex.Message; PopMant.Show(); } }
protected void btnGrabar_Click(object sender, EventArgs e) { try { jugadorBE.IdJugador = 0; jugadorBE.NomJugador = txtNombre.Text.Trim(); jugadorBE.ApeJugador = txtApellido.Text.Trim(); jugadorBE.EdadJugador = Convert.ToInt16(txtEdad.Text.Trim()); jugadorBE.NickJugador = txtNick.Text.Trim(); jugadorBE.PaisJugador = txtPais.Text.Trim(); jugadorBE.RolJugador = dropRol.SelectedValue.ToString(); if (chkCapitan.Checked) { jugadorBE.CapJugador = 'C'; } else { jugadorBE.CapJugador = 'X'; } jugadorBE.IdEquipo = Convert.ToInt32(dropEquipo.SelectedValue); if (jugadorBL.InsertarJugador(jugadorBE)) { CargarDatos(); } else { throw new Exception("No se insertó correctamente el nuevo jugador."); } } catch (Exception ex) { lblMensaje2.Text = ex.Message; PopMant.Show(); } }