Ejemplo n.º 1
0
        private void comboBox_Modelo_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataTable patentes = DAOAutomovil.getPatentes(comboBox_Modelo.Text);

            comboBox_Patente.DisplayMember = "COCHE_PATENTE";
            comboBox_Patente.DataSource    = patentes;
        }
Ejemplo n.º 2
0
        public override bool ejecutar()
        {
            DAO          Dao          = FabricaDAO.CrearDaoAutomovil();
            DAOAutomovil DaoAutomovil = (DAOAutomovil)Dao;

            return(DaoAutomovil.existeMatricula(this._objeto));
        }
Ejemplo n.º 3
0
        public override List <Entidad> ejecutar()
        {
            DAO          Dao          = FabricaDAO.CrearDaoAutomovil();
            DAOAutomovil DaoAutomovil = (DAOAutomovil)Dao;

            return(DaoAutomovil.ConsultarTodos());
        }
Ejemplo n.º 4
0
 public Automovil()
 {
     this.dao = new DAOAutomovil();
     InitializeComponent();
     setupComboMarcas();
     setupGrid();
 }
Ejemplo n.º 5
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();
                }
            }
        }
Ejemplo n.º 6
0
        private void actualizarTurnosAutomovil(string patente)
        {
            DataRow row;
            int     cont;

            for (cont = 0; cont < Turno.Items.Count; cont++)
            {
                int estadoTurno = Convert.ToInt32(Turno.GetItemChecked(cont));
                if (estadoTurno == 0)
                {
                    row = ((DataRowView)this.Turno.Items[cont]).Row;
                    string detalle = (row[this.Turno.ValueMember]).ToString();
                    DAOAutomovil.modificarTurnoAutomovilPorPatente(patente, detalle, estadoTurno);
                }
            }

            for (cont = 0; cont < TurnoDeshabilitado.Items.Count; cont++)
            {
                int estadoTurno = Convert.ToInt32(TurnoDeshabilitado.GetItemChecked(cont));
                if (estadoTurno == 1)
                {
                    row = ((DataRowView)this.TurnoDeshabilitado.Items[cont]).Row;
                    string detalle = (row[this.TurnoDeshabilitado.ValueMember]).ToString();
                    DAOAutomovil.modificarTurnoAutomovilPorPatente(patente, detalle, estadoTurno);
                }
            }
        }
Ejemplo n.º 7
0
        public override Entidad ejecutar()
        {
            DAO          Dao          = FabricaDAO.CrearDaoAutomovil();
            DAOAutomovil DaoAutomovil = (DAOAutomovil)Dao;

            return(DaoAutomovil.Consultar(this._objeto));
        }
Ejemplo n.º 8
0
        private void comboBox_Marca_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataTable modelos = DAOAutomovil.getModelos(comboBox_Marca.Text);

            comboBox_Modelo.DisplayMember = "COCHE_MODELO_CODIGO";
            comboBox_Modelo.DataSource    = modelos;
        }
Ejemplo n.º 9
0
        public override List <SelectListItem> ejecutar()
        {
            DAO          Dao          = FabricaDAO.CrearDaoAutomovil();
            DAOAutomovil DaoAutomovil = (DAOAutomovil)Dao;

            return(DaoAutomovil.listarAnios());
        }
Ejemplo n.º 10
0
        public override bool ejecutar()
        {
            DAO          Dao          = FabricaDAO.CrearDaoAutomovil();
            DAOAutomovil DaoAutomovil = (DAOAutomovil)Dao;

            return(DaoAutomovil.ActivarDesactivar(this._objeto));
        }
Ejemplo n.º 11
0
        public override List <SelectListItem> ejecutar()
        {
            DAO          Dao          = FabricaDAO.CrearDaoAutomovil();
            DAOAutomovil DaoAutomovil = (DAOAutomovil)Dao;

            return(DaoAutomovil.listarCantidad(this._cantidad));
        }
Ejemplo n.º 12
0
        private void button2_Click(object sender, EventArgs e)
        {
            var resultado = Mensaje_Pregunta("¿Está seguro que desea dar la alta del automovil?", "Alta Automovil");

            if (resultado == DialogResult.Yes)
            {
                string marca   = comboBox_Marca.Text;
                string modelo  = comboBox_Modelo.Text;
                string patente = textBox_Patente.Text;
                int    chofer  = Convert.ToInt32(textBox_chofer_dni.Text);
                int    estado  = 1;

                if (!(ValidarAutomovil(patente, chofer)))
                {
                    return;
                }
                else
                {
                    DAOAutomovil.altaAutomovil(marca, modelo, patente, chofer, estado);
                    this.actualizarTurnosAutomovil(patente);
                    Mensaje_OK("El automovil fue dado de alta");
                    this.Close();
                }
            }
        }
Ejemplo n.º 13
0
        private bool ValidarAutomovil(string patente, int chofer)
        {
            int cont = 0;

            if ((String.IsNullOrEmpty(patente)) || (patente == ""))
            {
                Mensaje_Error("Patente del automovil vacia"); cont++;
            }
            if (DAOAutomovil.validarPatente(patente))
            {
                Mensaje_Error("La patente ya existe"); cont++;
            }
            if (DAOAutomovil.choferAsignado(chofer, patente))
            {
                Mensaje_Error("El chofer ya posee automovil"); cont++;
            }
            if (Turno.CheckedItems.Count == 0)
            {
                Mensaje_Error("No se ha/n seleccionado turno/s"); cont++;
            }
            if (cont == 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 14
0
        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);
        }
Ejemplo n.º 15
0
        public BajaAutomovil()
        {
            InitializeComponent();
            DataTable marcas = DAOAutomovil.getMarcas();

            comboBox_Marca.DisplayMember = "MARCA_NOMBRE";
            comboBox_Marca.DataSource    = marcas;
        }
Ejemplo n.º 16
0
 public AltaModificacionAutomoviles()
 {
     this.dao = new DAOAutomovil();
     InitializeComponent();
     this.comboTurno.Enabled = false;
     setupComboMarcas();
     setupComboChoferes();
 }
Ejemplo n.º 17
0
        private void comboBox_Marca_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataTable modelos = DAOAutomovil.getModelos(comboBox_Marca.Text);

            comboBox_Modelo.DisplayMember = "COCHE_MODELO_CODIGO";
            comboBox_Modelo.DataSource    = modelos;
            Turno.DataSource  = DAOTurno.getTurnoDescripcionHabilitado();
            Turno.ValueMember = "TURNO_DESCRIPCION";
        }
Ejemplo n.º 18
0
        private void button4_Click(object sender, EventArgs e)
        {
            var resultado = Mensaje_Pregunta("¿Está seguro que desea dar la baja del automovil?", "Baja Automovil");

            if (resultado == DialogResult.Yes)
            {
                string patente = comboBox_Patente.Text;
                DAOAutomovil.bajaAutomovilPorPatente(patente);
                Mensaje_OK("El automovil fue dado de baja");
                this.Close();
            }
        }
Ejemplo n.º 19
0
        public ModificacionAutomovil()
        {
            InitializeComponent();
            DataTable marcas = DAOAutomovil.getMarcas();

            comboBoxMarca.DisplayMember = "MARCA_NOMBRE";
            comboBoxMarca.DataSource    = marcas;

            /* button_buscar_Chofer.Visible = false;
             * textBox_chofer_nombre.Visible = false;
             * textBox_chofer_dni.Visible = false;
             * checkBoxEstado.Visible = false;
             * label8.Visible = false;
             * label5.Visible = false;
             * label7.Visible = false;*/
        }
Ejemplo n.º 20
0
        private void comboBox_Patente_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataTable table = DAOAutomovil.getEstadoYChofer(comboBox_Patente.Text);
            DataRow   row   = table.Rows[0];

            checkBox_Estado.Enabled = false;
            textBox_Chofer.Text     = ((row["PERSONA"]) as string);
            if (Convert.ToInt32(row["COCHE_ESTADO"]) == 1)
            {
                checkBox_Estado.Checked = true;
                checkBox_Estado.Visible = true;
            }
            else
            {
                checkBox_Estado.Visible = false;
            }
        }
Ejemplo n.º 21
0
        private void buttonSeleccionar_Click(object sender, EventArgs e)
        {
            DataTable table = DAOAutomovil.getEstadoYChofer(comboBoxPatente.Text);
            DataRow   row   = table.Rows[0];

            textBox_chofer_dni.Visible = true;
            checkBoxEstado.Visible     = true;
            label5.Visible             = true;
            label7.Visible             = true;
            int    estado = Convert.ToInt32(row["COCHE_ESTADO"]);
            string chofer = row["PERSONA"] as string;
            string dni    = Convert.ToString(row["PERS_DNI"]);

            button_buscar_Chofer.Visible  = true;
            textBox_chofer_nombre.Visible = true;
            textBox_chofer_dni.Visible    = true;
            label8.Visible                 = true;
            textBox_chofer_nombre.Text     = chofer;
            textBox_chofer_nombre.ReadOnly = true;
            textBox_chofer_dni.Text        = dni;
            textBox_chofer_dni.ReadOnly    = true;
            if (estado == 1)
            {
                modificacionDeEstado         = 0;
                checkBoxEstado.Visible       = false;
                label7.Visible               = false;
                textBox_chofer_dni.Enabled   = true;
                checkBoxEstado.Checked       = true;
                labelTurnoHabilitado.Visible = true;
                Turno.Visible              = true;
                label4.Visible             = true;
                TurnoDeshabilitado.Visible = true;
                this.cargarTurnosHabilitados(DAOTurno.getTurnoAsignadoACoche(comboBoxPatente.Text), 1);
                this.cargarTurnosDeshabilitados(DAOTurno.getTurnoNoAsignadoACoche(comboBoxPatente.Text), 0);
            }
            else
            {
                checkBoxEstado.Visible     = true;
                label7.Visible             = true;
                textBox_chofer_dni.Enabled = false;
                modificacionDeEstado       = 1;
            }
            buttonAceptar.Visible = true;
        }
Ejemplo n.º 22
0
 private void cargarTodo()
 {
     this.fechaRendicion.Value = DateUtils.getDateFromConfig();
     this.choferes             = new List <ViajeChofer>();
     this.turnos                 = new List <Turno>();
     this.dao                    = new DAOViajes();
     this.tur                    = new DAOAutomovil();
     this.daoren                 = new DAORendicionViaje();
     turnos                      = tur.getAllTurn();
     this.cbTurno.Enabled        = false;
     this.comboChofer.Enabled    = false;
     this.btCalcular.Enabled     = false;
     this.btRendir.Enabled       = false;
     this.fechaRendicion.Enabled = true;
     setComboTurno();
     dgViajesRealizados.DataSource = null;
     dgMontoTotal.DataSource       = null;
     //dgViajesRealizados.Refresh();
     //dgMontoTotal.Refresh();
 }
Ejemplo n.º 23
0
        private void cargarPorUsuario()
        {
            this.fechaRendicion.Value = DateUtils.getDateFromConfig();
            this.choferes             = new List <ViajeChofer>();
            this.turnos                 = new List <Turno>();
            this.dao                    = new DAOViajes();
            this.tur                    = new DAOAutomovil();
            this.daoren                 = new DAORendicionViaje();
            this.cbTurno.Enabled        = false;
            this.comboChofer.Enabled    = false;
            this.btCalcular.Enabled     = false;
            this.btRendir.Enabled       = false;
            this.fechaRendicion.Enabled = true;
            turnos = tur.getAllTurn();
            setComboTurno();
            List <ViajeChofer> ca = daoren.getviajessinturno(this.idechofer);

            if (ca.Count().Equals(0))
            {
                MessageBox.Show("Usted no posee viajes");
                this.fechaRendicion.Enabled = false;
            }
            else
            {
                ViajeChofer c = ca.First();
                this.idechofer         = c.getId();
                this.txtCNombre.Text   = c.getName();
                this.txtCApellido.Text = c.getLastname();
                this.txtCDoc.Text      = c.getDoc();
                this.txtCTel.Text      = c.getPhone();
                this.txtCMail.Text     = c.getEmail();
                this.dtCFecha.Value    = c.getDate();
                //this.btCalcular.Enabled = true;
                dgViajesRealizados.DataSource = null;
                dgMontoTotal.DataSource       = null;
                //dgViajesRealizados.Refresh();
                //dgMontoTotal.Refresh();
            }
        }