Ejemplo n.º 1
0
        private void recargar()
        {
            DataTable autos;

            if (modificacion)
            {
                autos = SQLAutomovil.obtenerTodosLosAutomoviles();
            }
            else
            {
                autos = SQLAutomovil.obtenerTodosLosAutomovilesHabilitados();
            }
            tablaAutomoviles.DataSource = autos;

            selectMarca.Items.Clear();
            tablaMarcas = SQLAutomovil.obtenerTodasLasMarcas();
            foreach (DataRow row in tablaMarcas.Rows)
            {
                selectMarca.Items.Add(row["nombre"].ToString());
            }

            this.tablaAutomoviles.Columns[0].Visible = false; //autoID
            this.tablaAutomoviles.Columns[3].Visible = false; //marcaID
            this.tablaAutomoviles.Columns[9].Visible = false; //choferID

            DataGridViewRow autoRow = tablaAutomoviles.Rows[0];

            autoSeleccionado = new Automovil(autoRow);

            selectMarca.Text     = "";
            txtModelo.Text       = "";
            txtPatente.Text      = "";
            txtChoferNombre.Text = "";
        }
Ejemplo n.º 2
0
        private void ListaAutomoviles_Load(object sender, EventArgs e)
        {
            //Obtener todos los automoviles cuando se carga el formulario
            DataTable autos;

            if (modificacion)
            {
                autos = SQLAutomovil.obtenerTodosLosAutomoviles();
            }
            else
            {
                autos = SQLAutomovil.obtenerTodosLosAutomovilesHabilitados();
            }
            tablaAutomoviles.DataSource = autos;
            selectMarca.Items.Clear();
            tablaMarcas = SQLAutomovil.obtenerTodasLasMarcas();
            foreach (DataRow row in tablaMarcas.Rows)
            {
                selectMarca.Items.Add(row["nombre"].ToString());
            }

            this.tablaAutomoviles.Columns[0].Visible = false; //autoID
            this.tablaAutomoviles.Columns[3].Visible = false; //marcaID
            this.tablaAutomoviles.Columns[9].Visible = false; //choferID

            DataGridViewRow autoRow = tablaAutomoviles.Rows[0];

            autoSeleccionado = new Automovil(autoRow);
        }
Ejemplo n.º 3
0
        public void cargarForm()
        {
            cmbChofer.Items.Clear();
            tablaChoferes = SQLChofer.obtenerTodosLosChoferesHabilitados();
            foreach (DataRow row in tablaChoferes.Rows)
            {
                cmbChofer.Items.Add(row["nombre"].ToString() + " " + row["apellido"].ToString());
            }

            selectMarca.Items.Clear();
            tablaMarcas = SQLAutomovil.obtenerTodasLasMarcas();
            foreach (DataRow row in tablaMarcas.Rows)
            {
                selectMarca.Items.Add(row["nombre"].ToString());
            }
        }