Esempio n. 1
0
        public List <ClaseVehiculo> listaClaseVehiculos()
        {
            List <ClaseVehiculo> listaClase = new List <ClaseVehiculo>();
            SqlCommand           comando    = new SqlCommand();

            comando.Connection  = this.conexion;
            comando.CommandText = "Select * from CLASEVEHICULO";
            try
            {
                SqlDataReader registro = comando.ExecuteReader();
                while (registro.Read())
                {
                    ClaseVehiculo CV = new ClaseVehiculo();
                    CV.id          = registro.GetDecimal(0);
                    CV.descripcion = registro.GetString(1);
                    listaClase.Add(CV);
                }
                registro.Close();
            }
            catch (Exception ex)
            {
                this.error = ex.Message;
            }
            return(listaClase);
        }
Esempio n. 2
0
        public Vehiculo BuscarVehiculo(int?id)
        {
            this.error = "";
            Vehiculo   unVehiculo = null;
            SqlCommand comando    = new SqlCommand();

            comando.Connection  = this.conexion;
            comando.CommandText = "SELECT * FROM VEHICULO WHERE ID=" + id;
            try
            {
                SqlDataReader registro = comando.ExecuteReader();
                if (registro.Read())
                {
                    unVehiculo       = new Vehiculo();
                    unVehiculo.id    = Convert.ToInt32(registro.GetDecimal(0));
                    unVehiculo.placa = registro.GetString(1);

                    Linea linea = new Linea();
                    linea.id           = registro.GetDecimal(2);
                    unVehiculo.idLinea = linea;

                    unVehiculo.modelo      = registro.GetString(3);
                    unVehiculo.numeroMotor = registro.GetString(4);
                    unVehiculo.color       = registro.GetString(5);

                    ClaseVehiculo clase = new ClaseVehiculo();
                    clase.id = registro.GetDecimal(6);
                    unVehiculo.idClaseVehiculo = clase;
                    TipoServicio tipo = new TipoServicio();
                    tipo.id = registro.GetDecimal(7);
                }
                registro.Close();
            }
            catch (Exception ex)
            {
                this.error = ex.Message;
            }
            return(unVehiculo);
        }
Esempio n. 3
0
 public Vehiculo(decimal id, string placa, Linea idLinea, string modelo, string numeroMotor, string color, ClaseVehiculo idClaseVehiculo, TipoServicio idTipoServicio)
 {
     this.id              = id;
     this.placa           = placa;
     this.idLinea         = idLinea;
     this.modelo          = modelo;
     this.numeroMotor     = numeroMotor;
     this.color           = color;
     this.idClaseVehiculo = idClaseVehiculo;
     this.idTipoServicio  = idTipoServicio;
 }