Exemplo n.º 1
0
        private bool createClient(DAOClientes dao)
        {
            bool success = false;

            if (this.CheckEmptyFields())
            {
                if (this.checkDNInot0())
                {
                    Persona persona = new Persona(this.fieldName.Text, this.fieldSurname.Text, this.fieldDocument.Text, this.fieldStreet.Text, this.birthTimePicker.Value, this.idPersona);
                    Cliente cliente = new Cliente(this.fieldTelephone.Text, this.fieldMail.Text, this.fieldZipcode.Text, this.idPersona, this.checkHabilitado.Checked);

                    try
                    {
                        dao.crearPersona(persona);
                        cliente.setIdCliente(dao.getIdPersona(persona));
                        dao.crearCliente(cliente);
                        success = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message.ToString());
                    }

                    MessageBox.Show("El cliente fue creado exitosamente");
                    this.Close();
                }
            }
            return(success);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public AltaCliente(DataGridViewRow row)
        {
            InitializeComponent();
            this.Text            = "Modifique al cliente";
            this.saveButton.Text = "Modificar";
            this.dao             = new DAOClientes();
            this.clientId        = 1;
            this.completarCampos(row);

            Persona personaprevia = new Persona(this.fieldName.Text, this.fieldSurname.Text, this.fieldDocument.Text, this.fieldStreet.Text, this.birthTimePicker.Value, this.clientId);

            this.idPersona = dao.getIdPersona(personaprevia);
        }