private void btnCrear_Click(object sender, EventArgs e) { if (EsNumero(txtNumero.Text) && (dtpExpedicion.Text != null) && (dtpVencimiento.Text) != null) { //Clave foranea para conductor String conductor = cmbConductor.Text; String[] Dataconductor = conductor.Split(' '); long idDriver = coductoresController.MostarIdConductor(Dataconductor[0]); ////Clave foranea para transito int idsecretaria = transitoController.MostrarSecretaria(cmbTransito.Text); BR.Licencias licencia = new BR.Licencias(Convert.ToInt32(txtNumero.Text.Trim()), idDriver, idsecretaria, cmbCategoria.Text.Trim(), dtpExpedicion.Value.Date, dtpVencimiento.Value.Date); licencia.Numero_pase = Convert.ToInt32(txtNumero.Text.Trim()); licencia.id_conductor = idDriver; licencia.id_secretaria = idsecretaria; licencia.categoria = cmbCategoria.Text.Trim(); licencia.expedicon = dtpExpedicion.Value.Date; licencia.vencimiento = dtpVencimiento.Value.Date; //Conexion con la base de datos if (licenciasController.CrearLicencia(licencia)) { MessageBox.Show("Se Añadio la Licencia" + licencia.Numero_pase); Limpiar(); llenarDataGridView(); } else { MessageBox.Show("No se pudo Crear"); } } }
public bool Crear(EN.SeguridadSocial other, string cedula) { bool resultado = false; try { //Mapeo de EN BR BR.SeguridadSocial ss = new BR.SeguridadSocial(conductoresController.MostarIdConductor(cedula), other.pago_anterior, other.pago_siguiente, other.valor); //Inserte en la bd db.SeguridadSocial.Add(ss); db.SaveChanges(); resultado = true; } catch (Exception) { throw; } return(resultado); }
private void btnCrear_Click(object sender, EventArgs e) { //Claves foraneas para id String[] Dataconductor = cmbConductor.Text.Split(' '); int idDriver = conductoresController.MostarIdConductor(Dataconductor[0].Trim()); Console.WriteLine(idDriver); if (seguridadController.esta(idDriver) != true) { if (idDriver.ToString().Length != 0 && txtValor.TextLength != 0) { EN.SeguridadSocial a = new EN.SeguridadSocial(); a.conductor = Dataconductor[1]; a.pago_anterior = dtpInicio.Value.Date; a.pago_siguiente = dtpfinal.Value.Date; a.valor = Convert.ToDouble(txtValor.Text); if (seguridadController.Crear(a, Dataconductor[0])) { MessageBox.Show("Se Añadio El Registro, Ahora el conductor " + Dataconductor[1] + " tiene la SS vigente hasta " + a.pago_siguiente); txtValor.Text = ""; llenarSuma(); llenarVencidos(); llenarProximosVencer(); this.llenarDataGridView(); } else { MessageBox.Show("Ocurio un error, intente de nuevo"); } } } else { MessageBox.Show("Este conductor ya tiene un SS"); } }
private void btnCrear_Click(object sender, EventArgs e) { //Claves foraneas para id String[] Dataconductor = cmbConductor.Text.Split(' '); String[] DataTaxi = cmbTx.Text.Split(' '); int idDriver = conductoresController.MostarIdConductor(Dataconductor[0].Trim()); String placa = DataTaxi[0].Trim(); if (idDriver != 0 && placa != null) { if (conductoresTaxisController.CrearCT(placa, idDriver)) { MessageBox.Show("Se Añadio El Registro, Ahora el conductor " + Dataconductor[1] + " Conduce el vehiculo " + DataTaxi[0]); llenarDataGridView(); } else { MessageBox.Show("Ocurio un error, intente de nuevo"); } } }
private void btnEliminar_Click(object sender, EventArgs e) { if ((MessageBox.Show("¿Esta seguro que desea eliminar el registro selccionado?", "Accion de eliminacion de Conductor", MessageBoxButtons.YesNo) == DialogResult.Yes) && (dgvConductores.CurrentRow.Index != -1)) { long id = conductoresController.MostarIdConductor(Convert.ToString(dgvConductores.CurrentRow.Cells["cedula"].Value)); if (conductoresController.EliminaConducor(id)) { //Console.WriteLine(txtPlaca.Text); MessageBox.Show("Se elimino el registro correctamente"); llenarDataGridView(); Limpiar(); } else { MessageBox.Show("El registro no se encuentra o debe seleccionar uno"); } } }