예제 #1
0
        private T SetPlans <T>(T model, List <int> gameIds, int?gameClass = null) where T : MonthlyReportGameBaseModel
        {
            if (gameClass.HasValue)
            {
                if (HuntPlans.Any(x => gameIds.Contains(x.GameId) && x.Class == gameClass))
                {
                    model.HuntPlanCulls = (int)HuntPlans.FirstOrDefault(x => gameIds.Contains(x.GameId) && x.Class == gameClass).Cull;
                }

                model.Culls  = HuntedGames.Count(x => gameIds.Contains(x.GameId) && x.GameClass == gameClass);
                model.Losses = LossGames.Count(x => gameIds.Contains(x.GameId) && x.Class == gameClass);
            }
            else
            {
                if (HuntPlans.Any(x => gameIds.Contains(x.GameId)))
                {
                    model.HuntPlanCulls = (int)HuntPlans.Where(x => gameIds.Contains(x.GameId)).Sum(x => x.Cull);
                }

                model.Culls   = HuntedGames.Count(x => gameIds.Contains(x.GameId));
                model.Catches = CaughtGames.Where(x => gameIds.Contains(x.GameId)).Sum(x => x.Count);
                model.Losses  = LossGames.Count(x => gameIds.Contains(x.GameId));
            }

            return(model);
        }
예제 #2
0
        private MonthlyReportGameModel GetMonthlyReportData(GameType gameType)
        {
            ReportGameType = (int)gameType;

            var gamesByKind = GamesByType.GroupBy(x => x.Kind);
            var monthlyReportKindGameModels = new List <MonthlyReportKindGameModel>();

            foreach (var gameByKind in gamesByKind)
            {
                if (!HuntPlans.Any(x => x.GameId == gameByKind.FirstOrDefault().Id))
                {
                    continue;
                }

                if (ReportGameType == (int)GameType.Big && gameByKind.Key.IsIn(new List <GameKind> {
                    GameKind.Moose, GameKind.DeerSika
                }))
                {
                    continue;
                }

                MonthlyReportKindGameModel kindGameModel = GetKindMonthlyReportModel(gameByKind);

                monthlyReportKindGameModels.Add(kindGameModel);
            }

            var monthlyReportModel = new MonthlyReportGameModel
            {
                MonthlyReportKindGameModels = monthlyReportKindGameModels
            };

            return(monthlyReportModel);
        }