private void btnModificacion_Click(object sender, EventArgs e) { if (verificarDatosChofer(txtNombre.Text, txtApellido.Text, txtDNI.Text, txtMail.Text, txtTelefono.Text, txtDireccion.Text, txtLocalidad.Text)) { if (SQLChofer.verificarTelefono(int.Parse(txtTelefono.Text), idChofer)) { if (SQLChofer.verificarDNI(int.Parse(txtDNI.Text), idChofer)) { string direccion = obtenerDireccionEntera(txtDireccion.Text, txtPiso.Text, txtDepto.Text, txtLocalidad.Text); Chofer ChoferAModificar = new Chofer(idChofer, txtNombre.Text, txtApellido.Text, Int32.Parse(txtDNI.Text), txtMail.Text, Int32.Parse(txtTelefono.Text), direccion, dateTimeNacimiento.Value, ckbHabilitado.Checked); SQLChofer.modificarChofer(ChoferAModificar); this.DialogResult = DialogResult.OK; MessageBox.Show("El chofer ha sido modificado correctamente"); this.Close(); } else { MessageBox.Show("Ese DNI ya esta en uso", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Ese telefono ya esta en uso", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnAlta2_Click(object sender, EventArgs e) { if (verificarDatosChofer(txtNombre.Text, txtApellido.Text, txtDNI.Text, txtMail.Text, txtTelefono.Text, txtDireccion.Text, txtLocalidad.Text)) { if (SQLChofer.verificarTelefono(int.Parse(txtTelefono.Text), -1)) { if (SQLChofer.verificarDNI(int.Parse(txtDNI.Text), -1)) { string direccion = obtenerDireccionEntera(txtDireccion.Text, txtPiso.Text, txtDepto.Text, txtLocalidad.Text); Chofer nuevoChofer = new Chofer(txtNombre.Text, txtApellido.Text, Int32.Parse(txtDNI.Text), txtMail.Text, Int32.Parse(txtTelefono.Text), direccion, dateTimeNacimiento.Value); SQLChofer.insertarChofer(nuevoChofer); MessageBox.Show("El chofer ha sido dado de alta correctamente"); this.Close(); } else { MessageBox.Show("Ese DNI ya esta en uso", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Ese telefono ya esta en uso", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public RendicionViajes() { InitializeComponent(); lblImporteTotal.Hide(); lblImporteTotalTexto.Hide(); lblNumeroRendicion.Hide(); lblNumeroRendicionTexto.Hide(); lblPrevisualizarImporte.Hide(); lblPrevisualizarImporteTexto.Hide(); lblDetalleRendicion.Hide(); tablaRendicion.Hide(); tablaPreviaRendicion.Hide(); lblPrevisualizar.Hide(); btnConfirmarRendicion.Hide(); tablaTurnos = SQLTurno.obtenerTodosLosTurnos(); foreach (DataRow row in tablaTurnos.Rows) { cmbTurno.Items.Add(row["descripcion"].ToString()); cmbTurno.SelectedIndex = 0; } tablaChoferes = SQLChofer.obtenerTodosLosChoferes(); foreach (DataRow row in tablaChoferes.Rows) { cmbChoferes.Items.Add(row["nombre"].ToString() + " " + row["apellido"].ToString()); cmbChoferes.SelectedIndex = 0; } }
private void btnBuscar_Click(object sender, EventArgs e) { if (verificarDatosBusqueda(txtNombre.Text, txtApellido.Text, txtDNI.Text)) { Chofer clieABuscar = new Chofer(txtNombre.Text, txtApellido.Text, String.IsNullOrEmpty(txtDNI.Text) ? 0 : Int32.Parse(txtDNI.Text)); if (modificacion) { tablaChoferes.DataSource = SQLChofer.filtrarChoferes(clieABuscar); } else { tablaChoferes.DataSource = SQLChofer.filtrarChoferesHabilitados(clieABuscar); } } }
public void cargarForm() { cmbChofer.Items.Clear(); tablaChoferes = SQLChofer.obtenerTodosLosChoferesHabilitados(); foreach (DataRow row in tablaChoferes.Rows) { cmbChofer.Items.Add(row["nombre"].ToString() + " " + row["apellido"].ToString()); } selectMarca.Items.Clear(); tablaMarcas = SQLAutomovil.obtenerTodasLasMarcas(); foreach (DataRow row in tablaMarcas.Rows) { selectMarca.Items.Add(row["nombre"].ToString()); } }
private void ListaChoferes_Load(object sender, EventArgs e) { //Obtener todos los Choferes cuando se carga el formulario DataTable Choferes; if (modificacion) { Choferes = SQLChofer.obtenerTodosLosChoferes(); } else { Choferes = SQLChofer.obtenerTodosLosChoferesHabilitados(); } tablaChoferes.DataSource = Choferes; this.tablaChoferes.Columns[0].Visible = false; //usuarioID DataGridViewRow clieRow = tablaChoferes.Rows[0]; choferSeleccionado = new Chofer(clieRow); }
public RegistroViaje(int id_cliente, int id_rol) { InitializeComponent(); idCliente = id_cliente; esRolAdministrador = id_rol == 1; cmbAutomovil.Hide(); lblAutomovil.Hide(); lblTurno.Hide(); cmbTurnos.Hide(); tablaChoferes = SQLChofer.obtenerTodosLosChoferesHabilitados(); foreach (DataRow row in tablaChoferes.Rows) { cmbChoferes.Items.Add(row["nombre"].ToString() + " " + row["apellido"].ToString()); } tablaClientes = SQLCliente.obtenerTodosLosClientesHabilitados(); if (esRolAdministrador) { cmbCliente.Enabled = true; foreach (DataRow row in tablaClientes.Rows) { cmbCliente.Items.Add(row["nombre"].ToString() + " " + row["apellido"].ToString()); } } else { cmbCliente.Enabled = false; foreach (DataRow row in tablaClientes.Rows) { if (int.Parse(row["id_usuario"].ToString()) == id_cliente) { cmbCliente.Items.Add(row["nombre"].ToString() + " " + row["apellido"].ToString()); cmbCliente.SelectedIndex = 0; break; } } } }
private void recargar() { DataTable Choferes; if (modificacion) { Choferes = SQLChofer.obtenerTodosLosChoferes(); } else { Choferes = SQLChofer.obtenerTodosLosChoferesHabilitados(); } tablaChoferes.DataSource = Choferes; this.tablaChoferes.Columns[0].Visible = false; //usuarioID DataGridViewRow clieRow = tablaChoferes.Rows[0]; choferSeleccionado = new Chofer(clieRow); txtDNI.Text = ""; txtApellido.Text = ""; txtNombre.Text = ""; }
private void btnEliminar_Click(object sender, EventArgs e) { if (tablaChoferes.Rows.Count > 0) { if (choferSeleccionado.habilitado == true) { DialogResult dialogResult = MessageBox.Show("Esta seguro?", "Esta seguro que quiere dar de baja este chofer?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { string response = SQLChofer.eliminarChofer(choferSeleccionado); MessageBox.Show(response); tablaChoferes.DataSource = SQLChofer.obtenerTodosLosChoferesHabilitados(); } } else { MessageBox.Show("El chofer ya esta eliminado", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MessageBox.Show("Debe seleccionar algun chofer", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Error); } }