Пример #1
0
 public void cargarDGVAutomovil()
 {
     automoviles             = AutomovilDAO.getAllAutomoviles();
     tablaListado.DataSource = automoviles;
     tablaListado.Columns["turno_id"].Visible  = false;
     tablaListado.Columns["chofer_id"].Visible = false;
 }
Пример #2
0
        // METODOS GENERALES

        private void cargarAutomovilDisponible()
        {
            try
            {
                AutomovilDTO auto = AutomovilDAO.getAutomovilDisponible(choferGlobal.id);
                autoGlobal = auto;

                txtAutomovil.Text = auto.patente;

                cargarTurnosDeAuto(auto.id);
            }
            catch (ApplicationException e)
            {
                txtNombreChofer.Text = "";
                txtDNIChofer.Text    = "";
                Utility.ShowError("Registro de viaje", e);
            }
        }
Пример #3
0
 private void btnCrearAutomovil_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(cmbMarca.Text) && !string.IsNullOrWhiteSpace(cmbModelo.Text) && !string.IsNullOrWhiteSpace(txtPatente.Text) && !string.IsNullOrWhiteSpace(txtLicencia.Text) && !string.IsNullOrWhiteSpace(txtChoferDni.Text) && turnos.Count != 0)
     {
         try
         {
             AutomovilDTO nuevoAutomovil = this.cargarAutomovil();
             AutomovilDAO.addNewAutomovil(nuevoAutomovil, turnos);
             MessageBox.Show("Se agrego el automovil correctamente");
             listener.onOperationFinish();
             this.Close();
         }
         catch (ApplicationException ex)
         {
             Utility.ShowError("Error al agregar el automovil", ex);
         }
     }
     else
     {
         MessageBox.Show("Debe completar todos los campos", "Error");
     }
 }
Пример #4
0
        protected void botonBaja_Click_1(object sender, EventArgs e)
        {
            if (tablaListado.SelectedRows.Count == 1 && tablaListado.RowCount != 0)
            {
                DataGridViewRow row = this.tablaListado.SelectedRows[0];

                int id = Convert.ToInt32(row.Cells["id"].Value);

                if (Convert.ToBoolean(row.Cells["activo"].Value) == true)
                {
                    if (AutomovilDAO.deleteAutomovil(id) == 1)
                    {
                        MessageBox.Show("Automovil dado de baja correctamente");
                        cargarDGVAutomovil();
                    }
                }
                else
                {
                    MessageBox.Show("El automovil ya esta deshabilitado");
                }
            }
        }
Пример #5
0
        protected void botonBuscar_Click(object sender, EventArgs e)
        {
            filtrosAutomovilList = new Dictionary <string, object>();


            if (cmbFiltroModelo.SelectedIndex != -1 && ((ModeloDTO)cmbFiltroModelo.SelectedItem) != null)
            {
                filtrosAutomovilList.Add("mod_nombre", ((ModeloDTO)cmbFiltroModelo.SelectedItem).nombre.ToString());
            }

            if (cmbFiltroMarca.SelectedIndex != -1 && ((MarcaDTO)cmbFiltroMarca.SelectedItem) != null)
            {
                filtrosAutomovilList.Add("marca_nombre", ((MarcaDTO)cmbFiltroMarca.SelectedItem).descripcion);
            }

            if (!string.IsNullOrWhiteSpace(txtFiltroPatente.Text))
            {
                filtrosAutomovilList.Add("auto_patente", txtFiltroPatente.Text);
            }

            // Correspondera al nombre.

            if (!string.IsNullOrWhiteSpace(txtFiltroChofer.Text))
            {
                filtrosAutomovilList.Add("chof_nombre", txtFiltroChofer.Text);
            }


            if (filtrosAutomovilList.Count > 0)
            {
                //Tiene filtros
                automoviles             = AutomovilDAO.getAutomovilesFilter(filtrosAutomovilList);
                tablaListado.DataSource = automoviles;
            }
            else
            {
                cargarDGVAutomovil();
            }
        }
Пример #6
0
 private void btnModificar_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(cmbMarca.Text) && !string.IsNullOrWhiteSpace(cmbModelo.Text) && !string.IsNullOrWhiteSpace(txtPatente.Text) && !string.IsNullOrWhiteSpace(txtLicencia.Text) && !string.IsNullOrWhiteSpace(txtChoferDni.Text))
     {
         try
         {
             AutomovilDTO automovil = cargarAutomovil();
             automovil.id     = AutomovilAModificar.id;
             automovil.activo = chkAutoActivo.Checked;
             AutomovilDAO.updateAutomovil(automovil, turnos);
             MessageBox.Show("Automovil modificado con exito");
             this.Close(); //Cierro formulario
             listener.onOperationFinish();
         }
         catch (ApplicationException ex)
         {
             Utility.ShowError("Error al agregar el automovil", ex);
         }
     }
     else
     {
         MessageBox.Show("Debe completar todos los campos", "Error");
     }
 }