public ActionResult Index() { var model = new StatisticsFilterModel(); model.CodecTypes = _statisticsManager.GetCodecTypes(); model.CodecTypes.Insert(0, new CodecType() { Name = Resources.All, Id = Guid.Empty }); model.Owners = _statisticsManager.GetOwners(); model.Owners.Insert(0, new Owner() { Name = Resources.All, Id = Guid.Empty }); model.Regions = _statisticsManager.GetRegions(); model.Regions.Insert(0, new Region() { Name = Resources.All, Id = Guid.Empty }); model.Users = _statisticsManager.GetSipUsers(); return(View(model)); }
public virtual ActionResult Index(StatisticsFilterModel filter = null) { filter = filter ?? new StatisticsFilterModel(); ViewBag.UserName = filter.UserName; ViewBag.Filter = filter; ViewBag.CountryDepartmentList = SearchModel.GetCountryDeparmentList(); ViewBag.SectorDepartmentList = SearchModel.GetSectorDeparmentList(); ViewBag.DivisionList = SearchModel.GetDivisionBySectorDeparment(null); ViewBag.CountryList = SearchModel.GetCountryByCountryDeparment(null); ViewBag.OperationTypeList = MasterDataModel.GetMasterDataModels("OPERATION TYPE"); ((List <ConvergenceMasterDataModel>)ViewBag.OperationTypeList).Insert(0, this.CreateSelectDataModel("Operation Type")); ViewBag.OverallStageList = MasterDataModel.GetMasterDataModels("OVERALL_STAGE"); ((List <ConvergenceMasterDataModel>)ViewBag.OverallStageList).Insert(0, this.CreateSelectDataModel("Overall Stage")); var FundList = MasterDataModel.GetMasterDataModels("FUND"); ViewBag.FundList = MasterDataModel.GetMasterDataModels("FUND"); ((List <ConvergenceMasterDataModel>)ViewBag.FundList).Insert(0, this.CreateSelectDataModel("Fund")); ViewBag.SelectedFilter = SelectedFilter.none; var model = new SearchQueryModel(); model.UserName = filter.UserName; model.ClauseStatus = filter.ClauseStatus; return(View(model)); }
public ActionResult GetStatistics(StatisticsFilterModel model) { var filtersForGames = new List <Expression <Func <GameBL, bool> > >(); if (model.FilterByDate) { Expression <Func <GameBL, bool> > dateFilter = g => g.DateSubmitted >= model.DateFrom && g.DateSubmitted <= model.DateTo; filtersForGames.Add(dateFilter); } if (!model.GetForSingleFaction) { var games = _tournamentService.GetTournamentGames(null, filtersForGames.ToArray()); if (model.FilterByDate) { games = games.Where(g => g.DateSubmitted >= model.DateFrom && g.DateSubmitted <= model.DateTo); } var statsModel = _statsHelper.RecoverAllFactionsStats(games.ToList()); return(PartialView("_AllFactionsStatsPartial", statsModel)); } else { var factionId = model.FactionId; var heroes = _heroService.GetAllByFaction(model.FactionId); var heroesId = heroes.Select(h => h.Id).ToArray(); Expression <Func <GameBL, bool> > factionFilter = g => g.Faction1Id == factionId || g.Faction2Id == factionId; filtersForGames.Add(factionFilter); var games = _tournamentService.GetTournamentGames(null, filtersForGames.ToArray()); var statsModel = _statsHelper.RecoverFactionHeroesStats(games.ToList(), factionId, heroesId); var heroNames = heroes.Select(h => h.NameRus); statsModel.HeroNames = heroNames.ToArray(); return(PartialView("_FactionHeroesStatsPartial", statsModel)); } }
public async Task <IActionResult> Statistics(StatisticsFilterModel filter) { string myId = _userManager.GetUserId(User); List <AuktionBudViewModel> allAuktions = await _service.ListAuktionBudsAsync(true); List <AuktionBudViewModel> filteredAuktions = allAuktions .WhereIf(!filter.ShowMine, a => a.SkapadAv != myId) .WhereIf(!filter.ShowOthers, a => a.SkapadAv == myId) .Where(a => a.SlutDatum.Year == filter.TimeYear && a.SlutDatum.Month == (int)filter.TimeMonth) .ToList(); var model = new StatisticsViewModel { Filter = filter, Auktions = filteredAuktions }; return(View(model)); }