示例#1
0
        public List <GameLossViewModel> GetAllLossGamesForCurrentMarketingYear()
        {
            IList <LossDto>     losses        = _lossDao.GetAll();
            IList <LossGameDto> lossGames     = _lossGameDao.GetAll();
            IList <GameDto>     games         = _gameDao.GetAll();
            IList <RegionDto>   regions       = _regionDao.GetAll();
            MarketingYearDto    marketingYear = _marketingYearDao.GetCurrent();

            List <GameLossViewModel> gameLossModels =
                (
                    from loss in losses
                    join lossGame in lossGames on loss.LossGameId equals lossGame.Id
                    join game in games on lossGame.GameId equals game.Id
                    join region in regions on loss.RegionId equals region.Id
                    where loss.Date >= marketingYear.Start && loss.Date <= marketingYear.End
                    select new GameLossViewModel
            {
                TypeName = game.Type == 1 ? "Gruba" : "Drobna",
                KindName = game.KindName,
                SubKindName = game.SubKindName,
                Circuit = region.City,
                District = region.District,
                Description = loss.Description,
                SanitaryLoss = loss.SanitaryLoss,
                Date = loss.Date
            }
                ).ToList();

            return(gameLossModels);
        }
示例#2
0
 public PagedData <GameEntity> GetAll(int pageNumber, int pageSize)
 {
     try
     {
         return(_gameDao.GetAll(pageNumber, pageSize));
     }
     catch
     {
         throw;
     }
 }
示例#3
0
        public List <GameModel> GetAllGames()
        {
            IList <GameDto> games = _gameDao.GetAll();

            var gameModels = games.Select(x => new GameModel
            {
                Id          = x.Id,
                Type        = x.Type,
                Kind        = x.Kind,
                KindName    = x.KindName,
                SubKind     = x.SubKind,
                SubKindName = x.SubKindName
            }).ToList();

            return(gameModels);
        }
示例#4
0
        public CarcassRevenueBaseViewModel GetCarcassRevenueViewModel(int marketingYearId)
        {
            MarketingYearModel marketingYearModel = _marketingYearService.GetMarketingYearModel(marketingYearId);

            IList <CarcassRevenueDto> carcassRevenueDtos = _carcassRevenueDao.GetByMarketingYear(marketingYearId);
            IList <HuntDto>           huntDtos           = _huntDao.GetByMarketingYear(marketingYearId);
            IList <HuntedGameDto>     huntedGameDtos     = _huntedGameDao.GetByMarketingYear(marketingYearId);
            IList <GameDto>           gameDtos           = _gameDao.GetAll();
            IList <GameClassDto>      gameClassDtos      = _gameClassDao.GetAll();

            List <CarcassRevenueViewModel> carcassRevenueViewModels =
                (
                    from carcassRevenue in carcassRevenueDtos
                    join huntedGame in huntedGameDtos on carcassRevenue.HuntedGameId equals huntedGame.Id
                    join hunt in huntDtos on huntedGame.Id equals hunt.HuntedGameId
                    join game in gameDtos on huntedGame.GameId equals game.Id
                    where hunt.Date >= marketingYearModel.Start && hunt.Date <= marketingYearModel.End
                    select new CarcassRevenueViewModel
            {
                Id = carcassRevenue.Id,
                HuntedGameId = huntedGame.Id,
                GameKind = game.Kind,
                GameKindName = game.KindName,
                GameSubKind = game.SubKind,
                GameSubKindName = game.SubKindName,
                Class = huntedGame.GameClass,
                ClassName = huntedGame.GameClass.HasValue ? gameClassDtos.Single(x => x.Id == huntedGame.GameClass).ClassName : "",
                Revenue = carcassRevenue.Revenue,
                CarcassWeight = carcassRevenue.CarcassWeight,
                HuntDate = hunt.Date
            }
                ).ToList();

            AnnualPlanStatusModel annualPlanStatusModel = _annualPlanStatusService.GetByMarketingYearId(marketingYearId);

            var carcassRevenueBaseViewModel = new CarcassRevenueBaseViewModel
            {
                CarcassRevenueViewModels = carcassRevenueViewModels,
                MarketingYearModel       = marketingYearModel,
                AnnualPlanStatusModel    = annualPlanStatusModel
            };

            return(carcassRevenueBaseViewModel);
        }
示例#5
0
        public void GetAllTest()
        {
            IList <GameDto> results = _gameDao.GetAll();

            Assert.That(results, Is.Not.Empty);
        }