Esempio n. 1
0
        private static Collection <VehicleHistory> Read(SqlDataReader reader)
        {
            Collection <VehicleHistory> vehicleHistories = new Collection <VehicleHistory>();

            while (reader.Read())
            {
                int            i = -1;
                VehicleHistory vehicleHistory = new VehicleHistory();
                vehicleHistory.Id              = reader.GetInt32(++i);
                vehicleHistory.EvidenceId      = reader.GetString(++i);
                vehicleHistory.StartDate       = reader.GetDateTime(++i);
                vehicleHistory.StartDate       = reader.GetDateTime(++i);
                vehicleHistory.CarLicensePlate = !reader.IsDBNull(++i)?reader.GetString(i):"";
                vehicleHistory.vehicle         = VehicleTable.Select(reader.GetInt32(++i));
                vehicleHistory.city            = CityTable.Select(reader.GetInt32(++i));
                vehicleHistory.depot           = DepotTable.Select(reader.GetInt32(++i));
                vehicleHistory.Podtyp          = reader.GetString(++i);

                vehicleHistories.Add(vehicleHistory);
            }
            return(vehicleHistories);
        }
Esempio n. 2
0
        private static Collection <Vehicle> Read(SqlDataReader reader)
        {
            Collection <Vehicle> vehicles = new Collection <Vehicle>();

            while (reader.Read())
            {
                int     i       = -1;
                Vehicle vehicle = new Vehicle();
                vehicle.Id = reader.GetInt32(++i);
                vehicle.ConstructionYear = reader.GetInt32(++i);
                vehicle.State            = reader.GetString(++i);
                vehicle.EvidenceId       = reader.GetString(++i);
                vehicle.MainPhotoPath    = (reader.IsDBNull(++i))? "": reader.GetString(i);
                vehicle.CarLicensePlate  = (reader.IsDBNull(++i)) ? "" : reader.GetString(i);
                vehicle.vehicleModel     = VehicleModelTable.Select(reader.GetInt32(++i));
                vehicle.city             = CityTable.Select(reader.GetInt32(++i));
                vehicle.depot            = DepotTable.Select(reader.GetInt32(++i));
                vehicle.Podtyp           = reader.GetString(++i);


                vehicles.Add(vehicle);
            }
            return(vehicles);
        }