public IList <HuntViewModel> GetAllHuntsForCurrentMarketingYear() { MarketingYearDto marketingYear = _marketingYearDao.GetCurrent(); List <HuntViewModel> huntViewModels = ( from hunt in Hunts join huntsman in Huntsmans on hunt.HuntsmanId equals huntsman.Id join huntedGame in HuntedGames on hunt.HuntedGameId equals huntedGame.Id join game in Games on huntedGame.GameId equals game.Id join region in Regions on hunt.RegionId equals region.Id where hunt.Date >= marketingYear.Start && hunt.Date <= marketingYear.End select new HuntViewModel { HuntsmanName = huntsman.Name, HuntsmanLastName = huntsman.LastName, HuntedGameId = huntedGame.Id, GameKindName = game.KindName, GameSubKindName = GetSubKindName(game.SubKindName), GameClass = GetGameClass(huntedGame.GameClass), GameWeight = GetGameWeight(huntedGame.GameWeight), City = region.City, Circuit = region.Circuit, District = region.District, Shots = hunt.Shots, Date = hunt.Date } ).ToList(); return(huntViewModels); }
public IList <CatchViewModel> GetAllCatchesForCurrentMarketingYear() { MarketingYearDto marketingYear = _marketingYearDao.GetCurrent(); List <CatchViewModel> huntViewModels = ( from gameCatch in Catches join huntsman in Huntsmans on gameCatch.HuntsmanId equals huntsman.Id join game in Games on gameCatch.GameId equals game.Id join region in Regions on gameCatch.RegionId equals region.Id where gameCatch.Date >= marketingYear.Start && gameCatch.Date <= marketingYear.End select new CatchViewModel { HuntsmanName = huntsman.Name, HuntsmanLastName = huntsman.LastName, GameKindName = game.KindName, GameSubKindName = GetSubKindName(game.SubKindName), City = region.City, Circuit = region.Circuit, District = region.District, Count = gameCatch.Count, Date = gameCatch.Date } ).ToList(); return(huntViewModels); }
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); }
public MarketingYearModel GetCurrentMarketingYearModel() { MarketingYearDto currentMarketingYearDto = _marketingYearDao.GetCurrent(); return(new MarketingYearModel { Id = currentMarketingYearDto.Id, Start = currentMarketingYearDto.Start, End = currentMarketingYearDto.End }); }