private void txtBusqueda_TextChanged(object sender, EventArgs e) { if (cbTipoBusqueda.Text == "Nombre/Apellido") { NChofer.BuscarPorNombre(dgvSelChofer, txtBusqueda.Text); //OcultarColumnas(); } else if (cbTipoBusqueda.Text == "Dni") { NChofer.BuscarPorDni(dgvSelChofer, txtBusqueda.Text); //OcultarColumnas(); } else if (cbTipoBusqueda.Text == "Modelo") { NChofer.BuscarPorMarcaModelo(dgvSelChofer, txtBusqueda.Text); //OcultarColumnas(); } else if (cbTipoBusqueda.Text == "Patente") { NChofer.BuscarPorPatente(dgvSelChofer, txtBusqueda.Text); //OcultarColumnas(); } else { Mostrar(); } //OcultarColumnas(); }
private void chkMostrarDesactivados_CheckedChanged(object sender, EventArgs e) { if (chkMostrarDesactivados.Checked == true) { NChofer.MostrarDesactivados(dgbListado); } else { NChofer.Mostrar(dgbListado); } }
//----------------------METODO MOSTRAR/OCULTAR CHOFERES DESACTIVADOS private void OcultarMostrarDesactivados() { if (chkMostrarDesactivados.Checked == true) { NChofer.MostrarDesactivados(dgbListado); } else { NChofer.Mostrar(dgbListado); } }
//---------------------------------------------------------------- private void NuevoOEditar(bool banderaCHofer, bool banderaVehiculo) { try { if (txtMovil.Text == string.Empty || txtNombreApellido.Text == string.Empty || txtDni.Text == string.Empty || dtpFecha.Text == string.Empty || txtTelefono.Text == string.Empty || txtDireccion.Text == string.Empty || cbEstadoCivil.Text == string.Empty || txtMarcaModelo.Text == string.Empty || txtAnio.Text == string.Empty || txtPatente.Text == string.Empty || txtPropietario.Text == string.Empty) { MessageBox.Show("¡No se admiten campos vacios en (Movil, Nombre/Apellido, Dni, FechaNacimiento, Telefono, Direccion, Estado Civil, Marca/Modelo, Año, Patente!"); } else if (Convert.ToInt32(txtDni.Text) <= 99999999 && Convert.ToInt32(txtDni.Text) >= 999999) { if (IsNuevo == true) { NChofer.Insertar(txtMovil.Text, txtNombreApellido.Text, Convert.ToInt32(txtDni.Text), dtpFecha.Value.ToString(), txtTelefono.Text, txtDireccion.Text, cbEstadoCivil.Text, txtMarcaModelo.Text, txtAnio.Text, txtPatente.Text, txtNroChasis.Text, txtNroMotor.Text, dtpFechaIngreso.Value.ToString(), txtPropietario.Text, txtTelPropietario.Text); GuardarImagenChofer(AlmacenarDireccionImagen(banderaCHofer), txtDni.Text, banderaCHofer); GuardarImagenesVehiculo(txtDni.Text, txtNombreApellido.Text, banderaVehiculo); MessageBox.Show("Datos Guardados Correctamente!"); Mostrar(); Limpiar(); BloquearCampos(false); IsNuevo = false; frmChofer frm = new frmChofer(); frm.Show(); this.Close(); } else if (IsEditar == true) { NChofer.Editar(Convert.ToInt32(txtId.Text), txtMovil.Text, txtNombreApellido.Text, Convert.ToInt32(txtDni.Text), dtpFecha.Value.ToString(), txtTelefono.Text, txtDireccion.Text, cbEstadoCivil.Text, txtMarcaModelo.Text, txtAnio.Text, txtPatente.Text, txtNroChasis.Text, txtNroMotor.Text, dtpFechaIngreso.Value.ToString(), txtPropietario.Text, txtTelPropietario.Text); EditarImagenChofer(AlmacenarDireccionImagen(banderaCHofer), txtDni.Text, banderaCHofer); EditarImagenesVehiculo(txtDni.Text, txtNombreApellido.Text, banderaVehiculo); MessageBox.Show("Datos Editados Correctamente!"); Mostrar(); Limpiar(); BloquearCampos(false); IsEditar = false; frmChofer frm = new frmChofer(); frm.Show(); this.Close(); } else { MessageBox.Show("Error Editar/Nuevo"); } } else { MessageBox.Show("¡Dni Incorrecto!"); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
private void btnEliminar_Click(object sender, EventArgs e) { try { DialogResult Opcion; Opcion = MessageBox.Show("Realmente desea eliminar los registros", "Sistema de ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (Opcion == DialogResult.OK) { string dni, nombreapell; string Codigo; foreach (DataGridViewRow row in dgbListado.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { Codigo = Convert.ToString(dgbListado.CurrentRow.Cells["ID"].Value); dni = Convert.ToString(dgbListado.CurrentRow.Cells["Dni"].Value); nombreapell = Convert.ToString(dgbListado.CurrentRow.Cells["NombreApellido"].Value); NChofer.Eliminar(Convert.ToInt32(Codigo)); EliminarImagenChofer(dni); EliminarImagenesVehiculos(nombreapell); MessageBox.Show("Se Elimino correctamente el registro"); } } } chkEliminar.Checked = false; this.Mostrar(); } catch (System.IO.DirectoryNotFoundException) { MessageBox.Show("Error al eliminar"); this.Mostrar(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); MessageBox.Show("No se puedo eliminar el registro"); this.Mostrar(); } }
private void txtBuscarListado_TextChanged(object sender, EventArgs e) { if (cbTipoBusqueda.Text == "Nombre/Apellido") { NChofer.BuscarPorNombre(dgbListado, txtBuscarListado.Text); OcultarColumnas(); chkEliminar.Checked = false; lblTotal.Text = "REGISTROS: " + dgbListado.Rows.Count.ToString(); } else if (cbTipoBusqueda.Text == "Dni") { NChofer.BuscarPorDni(dgbListado, txtBuscarListado.Text); OcultarColumnas(); chkEliminar.Checked = false; lblTotal.Text = "REGISTROS: " + dgbListado.Rows.Count.ToString(); } else if (cbTipoBusqueda.Text == "Modelo") { NChofer.BuscarPorMarcaModelo(dgbListado, txtBuscarListado.Text); OcultarColumnas(); chkEliminar.Checked = false; lblTotal.Text = "REGISTROS: " + dgbListado.Rows.Count.ToString(); } else if (cbTipoBusqueda.Text == "Patente") { NChofer.BuscarPorPatente(dgbListado, txtBuscarListado.Text); OcultarColumnas(); chkEliminar.Checked = false; lblTotal.Text = "REGISTROS: " + dgbListado.Rows.Count.ToString(); } else { Mostrar(); chkEliminar.Checked = false; lblTotal.Text = "REGISTROS: " + dgbListado.Rows.Count.ToString(); } OcultarColumnas(); chkEliminar.Checked = false; lblTotal.Text = "REGISTROS: " + dgbListado.Rows.Count.ToString(); }
private void Mostrar() { NChofer.Mostrar(dgvSelChofer); }
private void Mostrar() { NChofer.Mostrar(dgbListado); OcultarColumnas(); lblTotal.Text = "REGISTROS: " + dgbListado.Rows.Count.ToString(); }