예제 #1
0
        private void BuscarVehiculos(string tipo_busqueda, string texto_busqueda)
        {
            try
            {
                DataTable dtVehiculos =
                    EVehiculos.BuscarVehiculos(tipo_busqueda, texto_busqueda, out string rpta);
                this.panelVehiculos.clearDataSource();
                if (dtVehiculos != null)
                {
                    this.panelVehiculos.BackgroundImage      = null;
                    this.panelVehiculos.PageSize             = 10;
                    this.panelVehiculos.OnBsPositionChanged += PanelVehiculos_OnBsPositionChanged;
                    this.panelVehiculos.SetPagedDataSource(dtVehiculos, this.bindingNavigator1);
                }
                else
                {
                    this.panelVehiculos.BackgroundImage       = Properties.Resources.No_hay_vehiculos;
                    this.panelVehiculos.BackgroundImageLayout = ImageLayout.Center;

                    if (!rpta.Equals("OK"))
                    {
                        throw new Exception(rpta);
                    }
                }
            }
            catch (Exception ex)
            {
                Mensajes.MensajeErrorCompleto(this.Name, "BuscarVehiculos",
                                              "Hubo un error al buscar los vehículos", ex.Message);
            }
        }
        private void FrmCargarVehiculos_Load(object sender, EventArgs e)
        {
            this.lblResultados.Cursor = Cursors.Hand;
            this.CrearTablaErrores();

            this.dtVehiculosExistentes =
                EVehiculos.BuscarVehiculos("COMPLETO", "", out string rpta);
        }
예제 #3
0
 private void FrmNuevoVehiculo_Load(object sender, EventArgs e)
 {
     this.DtVehiculos = EVehiculos.BuscarVehiculos("COMPLETO", "", out string rpta);
     //if (dtVehiculos != null)
     //{
     //    EVehiculos eVehiculo = new EVehiculos(dtVehiculos, 0);
     //    this.txtCodigo.Text = (eVehiculo.Id_vehiculo + 1).ToString();
     //}
 }
예제 #4
0
        private void BuscarVehiculos(string tipo_busqueda, string texto_busqueda)
        {
            try
            {
                DataTable dtVehiculos =
                    EVehiculos.BuscarVehiculos(tipo_busqueda, texto_busqueda, out string rpta);
                if (dtVehiculos != null)
                {
                    this.btnEditar.Enabled = true;

                    this.lblResultados.Text    = "Se encontraron " + dtVehiculos.Rows.Count + " vehículos.";
                    this.dgvVehiculos.Enabled  = true;
                    this.dgvVehiculos.PageSize = 15;
                    this.dgvVehiculos.SetPagedDataSource(dtVehiculos, this.bindingNavigator1);

                    this.dgvVehiculos.Columns["Id_vehiculo"].Visible     = true;
                    this.dgvVehiculos.Columns["Id_vehiculo"].HeaderText  = "Código";
                    this.dgvVehiculos.Columns["Estado_vehiculo"].Visible = false;

                    if (this.dgvVehiculos.Columns.Contains("Propietario"))
                    {
                        this.dgvVehiculos.Columns["Propietario"].Visible = false;
                    }

                    if (this.dgvVehiculos.Columns.Contains("Color"))
                    {
                        this.dgvVehiculos.Columns["Color"].Visible = false;
                    }
                }
                else
                {
                    this.btnEditar.Enabled = false;

                    this.lblResultados.Text   = "No se encontraron vehículos";
                    this.dgvVehiculos.Enabled = false;

                    if (!rpta.Equals("OK"))
                    {
                        throw new Exception(rpta);
                    }
                }
            }
            catch (Exception ex)
            {
                Mensajes.MensajeErrorCompleto(this.Name, "BuscarVehiculos",
                                              "Hubo un error al buscar vehículos", ex.Message);
            }
        }