private void BtnActualizar_Click(object sender, EventArgs e) { try { if (this.validacionImgError()) { this.convertir(); EPaciente Obj = new EPaciente(); Obj.pacienteID = Convert.ToInt32(this.txtId.Text); Obj.nombre = this.txtNombre.Text.Trim(); Obj.apellido = this.txtApellido.Text.Trim(); Obj.telefono = this.txtTelefono.Text.Trim(); Obj.ci = this.txtCI.Text.Trim(); Obj.fechaNacimiento = Convert.ToDateTime(this.txtFecha.Text); Obj.direccion = this.txtDireccion.Text.Trim(); Obj.sexo = this.sexo; NPacientes.update(Obj); this.MostrarDB(); this.LimpiarPRegistro(); } else { throw new Exception("Datos Obligatorios"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Sistema Odontograma"); } }
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["pacienteID"].Value); EPaciente Obj = new EPaciente(); Obj.pacienteID = Convert.ToInt32(Codigo); Rpta = Convert.ToString(NPacientes.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.LimpiarPRegistro(); this.txtId.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["pacienteID"].Value); this.txtNombre.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["nombre"].Value); this.txtApellido.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["apellido"].Value); this.txtTelefono.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["telefono"].Value); this.txtCI.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["ci"].Value); this.txtFecha.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["fechaNacimiento"].Value); this.txtDireccion.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["direccion"].Value); this.sexo = Convert.ToString(this.dataListado.CurrentRow.Cells["sexo"].Value); if (this.sexo == "Masculino") { this.txtM.Checked = true; } else { this.txtF.Checked = true; } this.OcultarPRegistro(false, false); this.lbModificar.Visible = true; this.lbAgregar.Visible = false; } } }
private void MostrarDB() { this.dataListado.DataSource = NPacientes.mostrar(this.txtBuscarNombre.Text, this.txtBuscarApellido.Text, siguientePag); this.ordenarColumnas(); this.dataListado.AutoResizeColumns(); int dataTotal = NPacientes.mostrarTotal(this.txtBuscarNombre.Text, this.txtBuscarApellido.Text) / 10; if (dataTotal == 0) { this.btnIncio.Enabled = false; this.btnAtras.Enabled = false; this.btnFin.Enabled = false; this.btnSiguiente.Enabled = false; } else { if (dataTotal == siguientePag) { this.btnIncio.Enabled = true; this.btnAtras.Enabled = true; this.btnFin.Enabled = false; this.btnSiguiente.Enabled = false; } else { if (Convert.ToInt32(this.siguientePag) > 0) { this.btnAtras.Enabled = true; this.btnIncio.Enabled = true; this.btnFin.Enabled = true; this.btnSiguiente.Enabled = true; } else { this.btnIncio.Enabled = false; this.btnAtras.Enabled = false; this.btnFin.Enabled = true; this.btnSiguiente.Enabled = true; } } } lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count); }
private void BtnFin_Click(object sender, EventArgs e) { this.siguientePag = NPacientes.mostrarTotal(this.txtBuscarNombre.Text, this.txtBuscarApellido.Text) / 10; this.MostrarDB(); }
private void UiButton1_Click(object sender, EventArgs e) { this.data.DataSource = NPacientes.mostrar("", "", 1); }
private void FrmReportePacientes_Load(object sender, EventArgs e) { this.reportViewer1.LocalReport.DataSources.Clear(); this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", NPacientes.mostrarTodo())); this.reportViewer1.RefreshReport(); this.reportViewer1.RefreshReport(); }