public AltaModificacionAutomoviles(DataGridViewRow unAuto, bool flagAgregarTurno)
        {
            this.dao    = new DAOAutomovil();
            this.unAuto = unAuto;
            InitializeComponent();
            this.turnoViejo = new Turno(unAuto);
            if (flagAgregarTurno == true)
            {
                this.groupDatosAuto.Enabled  = false;
                this.comboChofer.Enabled     = false;
                this.checkHabilitado.Enabled = false;
                this.flagAuto = 1;

                this.Text = "Agregar Turno";
                Chofer_Auto unChofer = new Chofer_Auto(unAuto);
                setupComboTurnos(unChofer);
            }
            else
            {
                this.Text = "Modifique al cliente";
                this.buttonGuardar.Text     = "Modificar";
                this.buttonEliminar.Enabled = true;
                this.flagAuto = 2;
                setupComboMarcas();
                setupComboChoferes();
            }

            this.completarCampos(unAuto);
        }
        private void comboChofer_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.comboTurno.Enabled = true;
            Chofer_Auto unChofer = this.comboChofer.SelectedItem as Chofer_Auto;

            this.setupComboTurnos(unChofer);
        }
 private void setupComboTurnos(Chofer_Auto unChofer)
 {
     this.comboTurno.ValueMember   = "id";
     this.comboTurno.DisplayMember = "descripcion";
     this.comboTurno.DataSource    = dao.getAllTurnFree(unAuto, unChofer);
     this.comboTurno.SelectedItem  = null;
 }
        private Auto getFormData()
        {
            Marca       m = this.comboMarca.SelectedItem as Marca;
            Turno       t = this.comboTurno.SelectedItem as Turno;
            Chofer_Auto c = this.comboChofer.SelectedItem as Chofer_Auto;

            return(new Auto(textPatente.Text, checkHabilitado.Checked, c.getId(), m.getId(), textModelo.Text, t.getId()));
        }
        private void completarCampos(DataGridViewRow unAuto)
        {
            Marca       marca  = new Marca(unAuto);
            Turno       turno  = new Turno(unAuto);
            Chofer_Auto chofer = new Chofer_Auto(unAuto);

            this.comboMarca.Text         = marca.getMarca();
            this.textModelo.Text         = unAuto.Cells["Modelo"].Value.ToString();
            this.textPatente.Text        = unAuto.Cells["Patente"].Value.ToString();
            this.comboTurno.Text         = turno.getTurno();
            this.comboChofer.Text        = chofer.getChofer();
            this.checkHabilitado.Checked = (bool)unAuto.Cells["Habilitado"].Value;
        }