예제 #1
0
 public Alta_Chofer()
 {
     InitializeComponent();
     this.dao  = new DAOChofer();
     this.pers = new DAOClientes();
     this.id   = 1;
 }
예제 #2
0
 public ABMChofer()
 {
     InitializeComponent();
     this.dao = new DAOChofer();
     bt_nuevo_chofer.Visible = true;
     BTModificar.Visible     = true;
 }
예제 #3
0
        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");
 }
예제 #5
0
        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");
        }
예제 #6
0
        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);
        }
예제 #7
0
 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);
 }