public async Task <List <ParkingDto> > MapAsync(DbDataReader reader)
        {
            if (reader.IsNull())
            {
                return(null);
            }

            var parkingStatsMapper = new CollectionMapper <ParkingStatsDto, ParkingStatsDtoRowMapper>();
            var currentStatsMapper = new CollectionMapper <ParkingDto, ParkingDtoRowMapper>();

            var parkingStats = await parkingStatsMapper.MapAsync(reader);

            var currentStats = await reader.MapNextResultAsync(currentStatsMapper);

            currentStats.ForEach(c => c.Forecast = parkingStats
                                                   .Where(p => p.VehicleType == c.VehicleType && p.ParkingId == c.ParkingId)
                                                   .Select(p => new ParkingForecastDto
            {
                AvailablePlaces  = p.AvailablePlaces,
                AvailablePercent = p.AvailablePercent,
                Time             = p.Time
            })
                                                   .ToList());

            return(currentStats);
        }
Beispiel #2
0
        public async Task <PageContainer <UserProfileDto> > MapAsync(DbDataReader reader)
        {
            if (reader.IsNull())
            {
                return(null);
            }
            var arrivaltimemapper = new CollectionMapper <ArrivalTimeDto, ArrivalTimeDtoRowMapper>();
            var userprofilemapper = new CollectionMapper <UserProfileDto, UserProfileDtoRowMapper>();

            var arrivaltimestats = await arrivaltimemapper.MapAsync(reader);

            var userprofilestats = await reader.MapNextResultAsync(userprofilemapper);

            userprofilestats.ForEach(p => p.ArrivalTime = arrivaltimestats
                                                          .Where(l => l.UserEmailId == p.Email)
                                                          .Select(l => new ArrivalTimeDto
            {
                DayOfTheWeek = l.DayOfTheWeek,
                Time         = l.Time,
                UserEmailId  = l.UserEmailId
            })
                                                          .ToList());

            var collection = userprofilestats;
            var totalCount = await reader.GetNextScalarAsync <int>("TotalCount");

            return(collection.ToPageContainer(totalCount));
        }
        public async Task <List <LevelDto> > MapAsync(DbDataReader reader)
        {
            if (reader.IsNull())
            {
                return(null);
            }

            var levelStatsMapper   = new CollectionMapper <LevelStatsVehicleDto, LevelStatsVehicleDtoRowMapper>();
            var parkingStatsMapper = new CollectionMapper <LevelDto, LevelDtoRowMapper>();

            var levelStats = await levelStatsMapper.MapAsync(reader);

            var parkingStats = await reader.MapNextResultAsync(parkingStatsMapper);

            parkingStats.ForEach(p => p.Stats = levelStats
                                                .Where(l => l.VehicleType == p.VehicleType && l.ParkingId == p.ParkingId)
                                                .Select(l => new LevelStatsDto
            {
                LevelStatsId          = l.LevelStatsId,
                LevelName             = l.LevelName,
                LevelId               = l.LevelId,
                AvailablePlaces       = l.AvailablePlaces,
                OccupiedPlaces        = l.OccupiedPlaces,
                Rank                  = l.Rank,
                LevelAvailablePercent = l.LevelAvailablePercent
            })
                                                .ToList());

            return(parkingStats);
        }
        public async Task <List <ParkingInfoDto> > MapAsync(DbDataReader reader)
        {
            if (reader.IsNull())
            {
                return(null);
            }

            var mapper     = new CollectionMapper <ParkingInfoDto, ParkingInfoDtoRowMapper>();
            var collection = await mapper.MapAsync(reader);

            return(collection);
        }
Beispiel #5
0
        public async Task <List <BuildingLevelEditDto> > MapAsync(DbDataReader reader)
        {
            if (reader.IsNull())
            {
                return(null);
            }

            var levelListMapper = new CollectionMapper <BuildingLevelEditDto, BuildingEditDtoRowMapper>();

            var levels = await levelListMapper.MapAsync(reader);

            return(levels);
        }
        public async Task <PageContainer <AdminUserEditDto> > MapAsync(DbDataReader reader)
        {
            if (reader.IsNull())
            {
                return(null);
            }

            var mapper     = new CollectionMapper <AdminUserEditDto, AdminUserEditDtoRowMapper>();
            var collection = await mapper.MapAsync(reader);

            var totalCount = await reader.GetNextScalarAsync <int>("TotalCount");

            return(collection.ToPageContainer(totalCount));
        }