private void BtnActualizar_Click(object sender, EventArgs e) { try { if (this.validacionImgError()) { this.convertir(); EParte Obj = new EParte(); Obj.parteID = Convert.ToInt32(this.txtId.Text); Obj.nombre = this.txtNombre.Text.Trim(); NParte.update(Obj); this.MostrarDB(); this.LimpiarPRegistro(); } else { throw new Exception("Datos Obligatorios"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Sistema Odontograma"); } }
private void MostrarDB() { this.dataListado.DataSource = NParte.mostrar(this.txtBuscar.Text); //this.dataListado.AutoResizeRows(); this.ordenarColumnas(); this.dataListado.AutoResizeColumns(); lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count); }
private void BtnGuardar_Click(object sender, EventArgs e) { try { this.convertir(); EParte Obj = new EParte(); Obj.nombre = this.txtNombre.Text.Trim(); NParte.save(Obj); this.LimpiarPRegistro(); this.MostrarDB(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Sistema de Odontograma Guardar"); } }
private void DataListado_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataListado.Columns["Eliminar"].Index) { DialogResult Opcion; Opcion = MessageBox.Show("Realmente desea Eliminar El Registro", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (Opcion == DialogResult.OK) { string Codigo; string Rpta = ""; Codigo = Convert.ToString(this.dataListado.CurrentRow.Cells["parteID"].Value); EParte Obj = new EParte(); Obj.parteID = Convert.ToInt32(Codigo); Rpta = Convert.ToString(NParte.delete(Obj)); if (Rpta.Equals("OK")) { this.MensajeOk("Se ELimino Correctamente el Registro"); } else { this.MensajeError(Rpta); } this.MostrarDB(); } } else { if (e.ColumnIndex == dataListado.Columns["Editar"].Index) { this.txtId.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["parteID"].Value); this.txtNombre.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["nombre"].Value); this.OcultarPRegistro(false, false); this.lbModificar.Visible = true; this.lbAgregar.Visible = false; } } }