Exemplo n.º 1
0
        private void buttonAceptar_Click(object sender, EventArgs e)
        {
            string patente = comboBoxPatente.Text;
            int    estado  = Convert.ToInt32(checkBoxEstado.Checked);
            int    chofer  = Convert.ToInt32(textBox_chofer_dni.Text);
            string nombre  = textBox_chofer_nombre.Text;

            var resultado = Mensaje_Pregunta("¿Está seguro que desea modificar el automovil?", "Modificar Automovil");

            if (resultado == DialogResult.Yes)
            {
                if (modificacionDeEstado == 0)
                {
                    if (Turno.CheckedItems.Count == 0)
                    {
                        Mensaje_Error("No se ha/n seleccionado turno/s"); return;
                    }
                }
                if (DAOAutomovil.choferAsignado(chofer, patente) == true)
                {
                    Mensaje_Error("El chofer ya posee auto"); return;
                }
                if (!(DAOPersona.choferActivo(chofer, nombre)))
                {
                    Mensaje_Error("El chofer no se encuentra habilitado"); return;
                }
                else
                {
                    DAOAutomovil.modificarAutomovilPorPatente(patente, estado, chofer);
                    this.actualizarTurnosAutomovil(patente);
                    Mensaje_OK("El automovil fue modificado");
                    this.Close();
                }
            }
        }