public Alta_Chofer() { InitializeComponent(); this.dao = new DAOChofer(); this.pers = new DAOClientes(); this.id = 1; }
public ABMChofer() { InitializeComponent(); this.dao = new DAOChofer(); bt_nuevo_chofer.Visible = true; BTModificar.Visible = true; }
private bool createChofer(DAOChofer dao) { bool success = false; if (this.CheckEmptyFields()) { if (this.checkDNInot0()) { Persona persona = new Persona(this.tb_nombre.Text, this.tb_apellido.Text, this.tb_DNI.Text, this.tb_calle.Text, this.birthTimePicker.Value, this.id); Chofer chofer = new Chofer(this.id, this.tb_telefono.Text, this.tb_mail.Text, this.cbHabilitado.Checked); try { pers.crearPersona(persona); chofer.setIdChofer(pers.getIdPersona(persona)); dao.crearChofer(chofer); success = true; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } MessageBox.Show("El cliente fue creado exitosamente"); this.Close(); } } return(success); }
public ABMChofer() { InitializeComponent(); this.dao = new DAOChofer(); bt_nuevo_chofer.Visible = true; BTModificar.Visible = true; tb_obtener_filtro.Text = inicialTB; CBbuscarf.Items.Insert(0, "DNI"); CBbuscarf.Items.Insert(1, "Apellido"); CBbuscarf.Items.Insert(2, "Nombre"); }
private void updateOrDeleteChofer(DAOChofer dao) { Persona persona = new Persona(this.tb_nombre.Text, this.tb_apellido.Text, this.tb_DNI.Text, this.tb_calle.Text, this.birthTimePicker.Value, this.id); Chofer chofer = new Chofer(this.id, this.tb_telefono.Text, this.tb_mail.Text, this.cbHabilitado.Checked); verifyFields(pers, dao, persona, chofer); pers.modificarPersona(persona); dao.modificarChofer(chofer); MessageBox.Show("Cambios guardados"); }
public Alta_Chofer(DataGridViewRow row) { InitializeComponent(); this.dao = new DAOChofer(); this.pers = new DAOClientes(); this.id = 1; this.completarCampos(row); Persona personaprevia = new Persona(this.tb_nombre.Text, this.tb_apellido.Text, this.tb_DNI.Text, this.tb_calle.Text, this.birthTimePicker.Value, this.id); this.id = pers.getIdPersona(personaprevia); }
private bool verifyFields(DAOClientes pers, DAOChofer dao, Persona persona, Chofer chofer) { if (pers.getDNIById(persona) != 0) { MessageBox.Show("El numero de DNI ya existe para otra persona", "DNI ya existe"); return(false); } if (dao.getMailById(chofer) != 0) { MessageBox.Show("La direccion de mail ya existe para otra persona", "Mail ya existe"); return(false); } return(true); }