private void dgvProducciones_DoubleClick(object sender, EventArgs e) { if (dgvProducciones.CurrentRow.Index != -1) { EN.Produccion other = produccionController.ObtenerProduccionPorId(Convert.ToInt32(dgvProducciones.CurrentRow.Cells["id"].Value)); EN.Taxis txs = taxisController.GetTaxi(other.placa); BR.Conductor conductor = conductoresController.MostarConductorxNombre(other.conductor); EN.itemList item = new EN.itemList(conductor.id, conductor.nombre.ToUpper() + " " + conductor.apellido.ToUpper()); int index = cmbConductor.FindString(item.descipcion); cmbConductor.SelectedIndex = index; //Pintar los datos cmbTx.Text = txs.placa.Trim().ToUpper() + " " + txs.marca; dtpInicio.Value = other.inicio; dtpFinal.Value = other.final; double pdia = other.producido / other.dias; txtLiquidaciondia.Text = pdia.ToString(); txtTotal.Text = other.producido.ToString(); txtTotal.ReadOnly = true; txtDiasTrabajados.Text = other.dias.ToString(); txtDiasTrabajados.ReadOnly = true; } else { MessageBox.Show("Seleccione un registro"); } }
private void dgvCxT_DoubleClick(object sender, EventArgs e) { if (dgvCxT.CurrentRow.Index != -1) { EN.ConductoresXtaxis other = conductoresTaxisController.MostarCT(Convert.ToInt32(dgvCxT.CurrentRow.Cells["id"].Value)); EN.Taxis taxi = taxisController.GetTaxi(other.placaTaxi); BR.Conductor conductor = conductoresController.MostarConductor(other.idConductor); cmbTx.Text = (taxi.placa.Trim().ToUpper() + " " + taxi.marca.ToUpper()); cmbConductor.Text = (conductor.cedula + " " + conductor.nombre.Trim() + " " + conductor.apellido.Trim()); } else { MessageBox.Show("Seleccione un registro"); } }
public BR.Conductor MostarConductor(long id) { try { BR.Conductor cd = db.Conductor.Where(x => x.id == id).FirstOrDefault(); if (cd != null) { return(cd); } else { return(null); } } catch (Exception ex) { throw ex; } }
public bool EliminaConducor(long id) { bool resultado = false; try { BR.Conductor conductor = db.Conductor.Where(x => x.id == id).FirstOrDefault(); db.Conductor.Remove(conductor); db.SaveChanges(); resultado = true; } catch (Exception ex) { throw ex; } return(resultado); }
private void btnBuscar_Click_1(object sender, EventArgs e) { if (txtBuscar.Text != "") { if (radioButtonNombre.Checked) { var otherConductor = conductoresController.MostarConductorlike(txtBuscar.Text); if (otherConductor != null) { EN.ConductoresXtaxis other = conductoresTaxisController.BuscarXidConductor(Convert.ToInt32(otherConductor.id)); EN.Taxis taxi = taxisController.GetTaxi(other.placaTaxi); cmbTx.Text = (taxi.placa.Trim().ToUpper() + " " + taxi.marca.ToUpper()); cmbConductor.Text = (otherConductor.cedula + " " + otherConductor.nombre.Trim() + " " + otherConductor.apellido.Trim()); } else { MessageBox.Show("No se encuentra el registro"); } } if (radioButtonPlaca.Checked) { var otherCT = conductoresTaxisController.BuscarXPlaca(txtBuscar.Text.Trim()); if (otherCT != null) { EN.Taxis taxi = taxisController.GetTaxi(otherCT.placaTaxi); BR.Conductor otherConductor = conductoresController.MostarConductor(otherCT.idConductor); cmbTx.Text = (taxi.placa.Trim().ToUpper() + " " + taxi.marca.ToUpper()); cmbConductor.Text = (otherConductor.cedula + " " + otherConductor.nombre.Trim() + " " + otherConductor.apellido.Trim()); } else { MessageBox.Show("No se encuentra el registro"); } } } else { MessageBox.Show("Revise los parametros de su busqueda"); } }
public bool ActualizarConductor(EN.Conductor conductorUpdate) { bool resultado = false; try { BR.Conductor driver = db.Conductor.Where(x => x.id == conductorUpdate.id).FirstOrDefault(); driver.apellido = conductorUpdate.apellido; driver.cedula = conductorUpdate.cedula; driver.nombre = conductorUpdate.nombre; driver.telefono = conductorUpdate.telefono; db.SaveChanges(); resultado = true; } catch (Exception ex) { throw ex; } return(resultado); }
public bool CrearConductor(EN.Conductor conductor) { bool resultado = false; try { //Mapeo BR.Conductor other = new BR.Conductor(); other.apellido = conductor.apellido; other.cedula = conductor.cedula; other.nombre = conductor.nombre; other.telefono = conductor.telefono; //Persitencia db.Conductor.Add(other); db.SaveChanges(); resultado = true; } catch (Exception ex) { throw ex; } return(resultado); }