public ActionResult Statistics() { var model = new StatisticsViewModel(); if (this.HttpContext.Cache.Get("Stats") != null) { model.Reviews = ((int[])this.HttpContext.Cache.Get("Stats"))[0]; model.Tutorials = ((int[])this.HttpContext.Cache.Get("Stats"))[1]; model.Comments = ((int[])this.HttpContext.Cache.Get("Stats"))[2]; model.Likes = ((int[])this.HttpContext.Cache.Get("Stats"))[3]; } else { var stats = this.statistics.GetStatistics(); model.Reviews = stats[0]; model.Tutorials = stats[1]; model.Comments = stats[2]; model.Likes = stats[3]; this.HttpContext.Cache.Add("Stats", stats, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 10, 0), CacheItemPriority.Normal, null); } return this.PartialView("_StatisticsPartial", model); }
// GET: Statistics public ActionResult Index() { var citiesCount = this.Cache.Get( "citiesCount", () => this.cities.GetAll().Count(), 1 * 60); var communitiesCount = this.Cache.Get( "communitiesCount", () => this.communities.GetAll().Count(), 1 * 60); var usersCount = this.Cache.Get( "usersCount", () => this.users.GetAll().Count(), 1 * 60); var statisctics = new StatisticsViewModel() { CitiesCount = citiesCount, CommunitiesCount = communitiesCount, UsersCount = usersCount }; return this.PartialView("_StatisticsPartial", statisctics); }
public ActionResult Statistics() { var model = new StatisticsViewModel() { ApplicationsCount = this.applications.All().Count(), DirectorsCount = this.directors.All().Count(), StudentsCount = this.students.All().Count(), UniversitiesCount = this.universities.All().Count() }; return this.PartialView("_Statistics", model); }
public IActionResult Index() { var vm = new StatisticsViewModel(); vm.totCustomers = _context.Customers.Count(); vm.totAccounts = _context.Accounts.Count(); var accs = _context.Accounts.ToList(); foreach (var acc in accs) { vm.totBalance += acc.Balance; } return(View(vm)); }
public async Task <ActionResult> Index(string date, DateTime?from = null, DateTime?to = null) { DateTime now = DateTime.Now; DateTime fromDate, toDate; switch (date) { case "thisMonth": fromDate = new DateTime(now.Year, now.Month, 1); toDate = fromDate.AddMonths(1).AddDays(-1); break; case "lastMonth": fromDate = new DateTime(now.Year, now.Month - 1, 1); toDate = fromDate.AddMonths(1).AddDays(-1); break; case "last7Day": fromDate = now.AddDays(-7); toDate = now; break; case "options": fromDate = from.GetValueOrDefault(); toDate = to.GetValueOrDefault(); break; default: fromDate = new DateTime(now.Year, 1, 1); toDate = fromDate.AddYears(1).AddDays(-1); break; } var list = new StatisticsViewModel { Summary = await _unitOfWork._StatisticsRepo.SummaryAsync(fromDate, toDate), TopSellers = await _unitOfWork._StatisticsRepo.TopSellersAsync(fromDate, toDate), TopCustomers = await _unitOfWork._StatisticsRepo.TopCustomersAsync(fromDate, toDate) }; if (Request.IsAjaxRequest()) { return(PartialView("_ListData", list)); } return(View(list)); }
/// <summary> /// 获取统计数据 /// </summary> /// <param name="begin"></param> /// <param name="end"></param> /// <returns></returns> public StatisticsViewModel GetTotalData(DateTime?begin, DateTime?end) { StatisticsViewModel model = new StatisticsViewModel(); string strWhere = string.Empty; try { if (begin != null && end != null) { strWhere = " createtime >=@begin and createtime <=@end and "; } else if (begin == null && end != null) { strWhere = " createtime <=@end and "; } else if (begin != null && end == null) { strWhere = " createtime >=@begin and "; } else { strWhere = " 1=1 "; } string sql1 = @"select ISNULL(SUM(Ep),0) as TotalEp from loginfo where " + strWhere; string sql2 = @"select ISNULL(SUM(Number),0) as TotalScore from LogInfo where LogType=1 and" + strWhere; string sql4 = @"select ISNULL( SUM(Zfc),0) as TotalZfc from loginfo where " + strWhere; using (var db = ReadOnlySanNongDunConn()) { decimal totalEp = db.DbConnecttion.ExecuteScalar <decimal>(sql1, Engineer.ggg, new { begin = begin, end = end }); decimal totalScore = db.DbConnecttion.ExecuteScalar <decimal>(sql2, Engineer.ggg, new { begin = begin, end = end }); decimal totalZfc = db.DbConnecttion.ExecuteScalar <decimal>(sql4, Engineer.ggg, new { begin = begin, end = end }); model.TotalEp = totalEp; model.TotalZfc = totalZfc; model.TotalScore = totalScore; } } catch (Exception ex) { LogHelper.WriteLog(typeof(LogDal), "GetTotalData", Engineer.ggg, new { begin = begin, end = end }, ex); } return(model); }
public ActionResult Index() { if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage cache"))) { return(new HttpUnauthorizedResult()); } var model = new StatisticsViewModel { CacheItems = _cacheService .GetCacheItems() .Where(x => x.Tenant.Equals(_shellSettings.Name, StringComparison.OrdinalIgnoreCase)) .ToList() .OrderByDescending(x => x.CachedOnUtc), }; return(View(model)); }
public void Setup() { _orchestrator = new Mock <StatisticsOrchestrator>(null, null); _statisticsViewModel = new StatisticsViewModel { TotalAccounts = 1, TotalAgreements = 2, TotalLegalEntities = 3, TotalPayeSchemes = 4, TotalPayments = 5 }; _orchestrator.Setup(m => m.Get()).ReturnsAsync(_statisticsViewModel); _controller = new StatisticsController(_orchestrator.Object); }
public ActionResult Index() { List <ApplicationUser> users = db.Users.Where(a => !a.Status.Equals(CoreController.UserStatus.Deleted.ToString())).ToList(); List <ApplicationUser> Clients = db.Users.Where(a => a.Type.Equals(CoreController.UserType.Client.ToString())).ToList(); List <ApplicationUser> ServiceProviders = db.Users.Where(a => a.Type.Equals(CoreController.UserType.Service_Provider.ToString())).ToList(); List <Service> AllServices = db.Services.ToList(); StatisticsViewModel result = new StatisticsViewModel(); result.AllClients = Clients.Count(); result.AllUsers = users.Count(); result.AllServiceProviders = ServiceProviders.Count(); result.AllActiveClients = result.AllClients - (int)(result.AllClients * 0.8); result.AllActiveServices = AllServices.Where(a => a.Status.Equals(CoreController.ServiceStatus.Active.ToString())).Count(); result.AllDoneServices = AllServices.Where(a => a.Status.Equals(CoreController.ServiceStatus.Done.ToString())).Count(); result.AllServices = AllServices.Count(); Random random = new Random(); result.AllActiveClientsInThePastThreeDays = result.AllClients + (int)(result.AllClients * 0.7); result.AllDreamUsers = helper.getServiceProviders(CoreController.UserWorkCode.Dream.ToString(), CoreController.UserStatus.Active.ToString()).Count(); result.AllRouqiaUsers = helper.getServiceProviders(CoreController.UserWorkCode.Rouqia.ToString(), CoreController.UserStatus.Active.ToString()).Count(); result.AllIftaaUsers = helper.getServiceProviders(CoreController.UserWorkCode.Iftaa.ToString(), CoreController.UserStatus.Active.ToString()).Count(); result.AllIstasharaUsers = helper.getServiceProviders(CoreController.UserWorkCode.Istishara.ToString(), CoreController.UserStatus.Active.ToString()).Count(); result.AllMedicalUsers = helper.getServiceProviders(CoreController.UserWorkCode.Medical.ToString(), CoreController.UserStatus.Active.ToString()).Count(); result.AllLawUsers = helper.getServiceProviders(CoreController.UserWorkCode.Law.ToString(), CoreController.UserStatus.Active.ToString()).Count(); List <UserBalance> balancer = new List <UserBalance>(); foreach (var item in ServiceProviders) { balancer.Add(helper.getUserBalance(item)); } if (ServiceProviders.Count > 0) { result.TotalBalance = balancer.Sum(a => a.TransferedBalance); result.AvailableBalance = balancer.Sum(a => a.DoneBalance); result.SuspendedBalance = balancer.Sum(a => a.SuspendedBalance); result.AllPaymentsSum = db.Payments.Sum(a => a.Amount); result.Profit = result.AllPaymentsSum - (result.TotalBalance + result.AvailableBalance + result.SuspendedBalance); } return(View(result)); }
protected async override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.view_stats); var name = Intent.GetStringExtra("name"); var id = Intent.GetStringExtra("id"); viewModel = new StatisticsViewModel(Mvx.Resolve <IMeetupService>(), Mvx.Resolve <IDataService>()); viewModel.Init(id, name); SupportActionBar.Title = viewModel.GroupName; barChart = FindViewById <BarChartView>(Resource.Id.barChart); barChart.LegendColor = Color.Black; progressBar = FindViewById <ProgressBar>(Resource.Id.progressBar); viewModel.ShowPopUps = false; // Perform any additional setup after loading the view, typically from a nib. }
private StatisticsViewModel GetTotalMoney(List <Storage> transactions) { var result = new StatisticsViewModel(); if (transactions.Any()) { var totalPrice = 0; var totalSellPrice = 0; foreach (var transaction in transactions) { totalPrice += transaction.Quantity * Convert.ToInt32(transaction.Product.Price); totalSellPrice += transaction.Quantity * Convert.ToInt32(transaction.Product.SellPrice); } result.Price = totalPrice.ToString(); result.SellPrice = totalSellPrice.ToString(); } return(result); }
public ActionResult Index() { var tripCount = this.Cache.Get( "statisticsTripCpimt", () => this.statisticsServices.GetTotalTripsCount(), CacheTimeConstants.StatisticsTodaysTrips); var topDestomatopm = this.Cache.Get( "topDestination", () => this.statisticsServices.GetTopDestination(), CacheTimeConstants.StatisticsTodaysTrips); var usersCount = this.Cache.Get( "usersCount", () => this.userServices.GetUsersCountInRole(RoleConstants.PassengerRole), CacheTimeConstants.StatisticsTodaysTrips); var driversCount = this.Cache.Get( "driversCount", () => this.userServices.GetUsersCountInRole(RoleConstants.PassengerRole), CacheTimeConstants.StatisticsTodaysTrips); var averageTripRating = this.Cache.Get( "averageTripRating", () => string.Format("{0:N2}", this.statisticsServices.GetAverateTripRating()), CacheTimeConstants.StatisticsTodaysTrips); var tripViews = this.Cache.Get( "tripViews", () => this.statisticsServices.GetTripViews(), CacheTimeConstants.StatisticsTodaysTrips); StatisticsViewModel viewModel = new StatisticsViewModel() { TripsCount = tripCount, TopDestination = topDestomatopm, UsersCount = usersCount, DriversCount = driversCount, AverageTripRating = averageTripRating, TripViews = tripViews }; return this.View(viewModel); }
private async void Process_OnClick(object sender, RoutedEventArgs e) { MainGrid.IsEnabled = false; Results.Visibility = Visibility.Visible; var vm = (BatchViewModel)DataContext; await vm.Process(); MainGrid.IsEnabled = true; var stats = new StatisticsViewModel() { WorkingDir = vm.WorkingDir, IsRecursive = vm.IsRecursive }; new StatisticsWindow() { DataContext = stats }.Show(); }
public ActionResult Statistics(int id = 0) { StatisticsViewModel viewModel = new StatisticsViewModel(); List <Question> questions; if (id > 0) { questions = _questionRepo.FindAll().Where(q => q.EventID == id).ToList(); } else { questions = _questionRepo.FindAll().ToList(); } viewModel.Event = _eventRepo.FindByID(id); questions.ForEach(delegate(Question question) { if (IsAvailable(question.Teacher)) { viewModel.Teacher.Add(question.Teacher.Value); } if (IsAvailable(question.Location)) { viewModel.Location.Add(question.Location.Value); } if (IsAvailable(question.Food)) { viewModel.Food.Add(question.Food.Value); } if (IsAvailable(question.Overall)) { viewModel.Overall.Add(question.Overall.Value); } viewModel.Opinions.Add(question.Opinion); }); return(View(viewModel)); }
public ActionResult Index(PagerParameters pagerParameters) { if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage cache"))) { return(new HttpUnauthorizedResult()); } var pager = new Pager(_siteService.GetSiteSettings(), pagerParameters); var pagerShape = Services.New.Pager(pager).TotalItemCount(_cacheStorageProvider.GetCacheItemsCount()); var model = new StatisticsViewModel { CacheItems = _cacheStorageProvider .GetCacheItems(pager.GetStartIndex(), pager.PageSize) .ToList(), Pager = pagerShape }; return(View(model)); }
public StatisticsViewModel GetStatisticsModel(DateTime?begin, DateTime?end) { StatisticsViewModel model = new StatisticsViewModel(); //获取充值总值 model.SumMoney = _userDal.GetSumMoney(begin, end); // 获取总积分和总绿氧 model.SumGreenScore = _accountDal.GetSumGreenAndScore(null, null); //总激活人数 model.TotalActivation = _userDal.GetAllActivationUser().Count; //用户总数 model.TotalUser = _userDal.GetAllUser().Count; //总资产 model.TotalAssets = _accountDal.GetTotalAssets(null, null); //总提现 model.SumOutMoney = _tixian.SumTiXian(begin, end); return(model); }
private void RunSimulation(MainWindow obj) { MainTabMenu.SelectedIndex = 2; var engine = ContainerConfig.Resolve <IEngine>(); var settings = new SimulationSettings { IncomingFlights = FlightsOrganizer.IncomingFlights.ToList(), OutgoingFlights = FlightsOrganizer.OutgoingFlights.ToList(), Multiplier = FlightsOrganizer.Multiplier, Ascs = FlightsOrganizer.CurrentAscSettings, Pscs = FlightsOrganizer.CurrentPscSettings, TransBaggagePercentage = FlightsOrganizer.TransBaggagePercentage, Nodes = ConvertToSettingsService.NodesCreationData, }; engine.ActualRun(settings); StatisticsViewModel.StartStatisticsTimer(); }
public ActionResult StatisticsContent(int school, int year) { var existingFees = db.fees .Where(x => x.duedate.Year == year && x.user.classes_students_allocateds .First(y => y.year == year) .school_class.schoolid == school) .GroupBy(z => z.fees_type); var viewmodel = new StatisticsViewModel() { statname = string.Format("{0} {1} Student Fee Statistics", year, db.schools.Single(x => x.id == school).name) }; foreach (var ftype in existingFees.OrderBy(x => x.Key.name)) { var byschoolyears = ftype.GroupBy(x => x.user.classes_students_allocateds.First(y => y.year == year).school_class.school_year); var feestat = new FeeRow() { feename = ftype.Key == null ? string.Join(", ", ftype.Select(x => x.name).ToArray()) : ftype.Key.name }; foreach (var byschoolyear in byschoolyears.OrderBy(x => x.Key.name)) { var stat = new StatRow { schoolyear = byschoolyear.Key.name, paid = byschoolyear.Count(x => x.status == FeePaymentStatus.PAID.ToDescriptionString()), unpaid = byschoolyear.Count(x => x.status == FeePaymentStatus.UNPAID.ToDescriptionString() && x.duedate > DateTime.UtcNow), overdue = byschoolyear.Count(x => x.status == FeePaymentStatus.UNPAID.ToDescriptionString() && x.duedate < DateTime.UtcNow) }; feestat.entries.Add(stat); } viewmodel.feetypes.Add(feestat); } return(View(viewmodel)); }
public MainWindowViewModel() { // IFactory factory = new Factory(); // IActionQueue actionQueue = new BlockingActionQueue(); // IAchievementManager manager = null; if (!IsInDesignMode) { // manager = factory.CreateAchievementManager(); manager.FindAllAchievements(); Settings.Default.Achievements = Settings.Default.Achievements ?? new AchievementsSettings(); Settings.Default.Achievements.Load(manager.Achievements); } // Create sub view models WinListViewModel = new WinListViewModel(); StatisticsViewModel = new StatisticsViewModel(); OptionsViewModel = new OptionsViewModel(); PartyLineViewModel = new PartyLineViewModel(); ConnectionViewModel = new ConnectionViewModel(); PlayFieldPlayerViewModel = new PlayFieldViewModel(); PlayFieldSpectatorViewModel = new PlayFieldSpectatorViewModel(); AchievementsViewModel = new AchievementsViewModel(); PlayFieldViewModel = PlayFieldPlayerViewModel; // by default, player view // ConnectionViewModel.LoginViewModel.OnConnect += OnConnect; // ClientChanged += OnClientChanged; if (!IsInDesignMode) { // Create client Client = new Client.Client(factory, actionQueue, manager); } }
public List <UserWorkViewModel> GetUserWorks() { StatisticsViewModel temp = new StatisticsViewModel(); temp.AllDreamUsers = helper.getServiceProviders(CoreController.UserWorkCode.Dream.ToString(), CoreController.UserStatus.Active.ToString()).Count(); temp.AllRouqiaUsers = helper.getServiceProviders(CoreController.UserWorkCode.Rouqia.ToString(), CoreController.UserStatus.Active.ToString()).Count(); temp.AllIftaaUsers = helper.getServiceProviders(CoreController.UserWorkCode.Iftaa.ToString(), CoreController.UserStatus.Active.ToString()).Count(); temp.AllIstasharaUsers = helper.getServiceProviders(CoreController.UserWorkCode.Istishara.ToString(), CoreController.UserStatus.Active.ToString()).Count(); temp.AllMedicalUsers = helper.getServiceProviders(CoreController.UserWorkCode.Medical.ToString(), CoreController.UserStatus.Active.ToString()).Count(); List <UserWork> UserWorks = db.UserWorks.Where(a => a.Enabled).ToList(); List <UserWorkViewModel> result = new List <UserWorkViewModel>(); foreach (var item in UserWorks) { UserWorkViewModel u = new UserWorkViewModel(); u.UserWork = item; if (item.Code.Equals(CoreController.UserWorkCode.Dream.ToString())) { u.UserCount = temp.AllDreamUsers; } else if (item.Code.Equals(CoreController.UserWorkCode.Rouqia.ToString())) { u.UserCount = temp.AllRouqiaUsers; } else if (item.Code.Equals(CoreController.UserWorkCode.Iftaa.ToString())) { u.UserCount = temp.AllIftaaUsers; } else if (item.Code.Equals(CoreController.UserWorkCode.Istishara.ToString())) { u.UserCount = temp.AllIstasharaUsers; } else if (item.Code.Equals(CoreController.UserWorkCode.Medical.ToString())) { u.UserCount = temp.AllMedicalUsers; } result.Add(u); } return(result); }
public ActionResult Index() { ViewBag.Title = "My Statistics"; var ViewModel = new StatisticsViewModel() { Active = false }; var model = _statisticsRepository.Get(_usersRepository.GetCurrentUserId()); if (model != null) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <StatisticsFull, StatisticsViewModel>(); }); IMapper mapper = config.CreateMapper(); ViewModel = mapper.Map <StatisticsFull, StatisticsViewModel>(model); ViewModel.Active = true; } return(View(ViewModel)); }
public async Task <IActionResult> Statistics() { var storage = await _storageService.GetAllAsync(); var components = await _componentService.GetAllAsync(); if (storage == null || storage.Count() == 0) { return(View(null)); } var model = new StatisticsViewModel(); model.StorageValue = storage.Sum(s => s.Component.Price * s.Piece); model.StorageWeight = storage.Sum(s => s.Component.Weight * s.Piece); model.PieceComponent = storage.OrderByDescending(s => s.Piece).FirstOrDefault()?.Component; model.WeightComponent = storage.OrderByDescending(s => s.Component.Weight).FirstOrDefault()?.Component; return(View(model)); }
private void OnNavigation(string destination) { switch (destination) { case "play": CurrentViewModel = new PlayViewModel(); break; case "player": CurrentViewModel = new PlayerViewModel(); break; case "customize": CurrentViewModel = new CustomizeViewModel(); break; case "statistics": CurrentViewModel = new StatisticsViewModel(); break; default: throw new ArgumentException($"Failed to navigate to '{destination}', the destination was not recognized"); } }
public ActionResult Index() { IList <Statistics> stat = new List <Statistics>(); using (var db = new AppDbContext()) { stat = db.Statisticses.ToList(); } StatisticsViewModel svm = new StatisticsViewModel() { //OnlineUsers = (int)HttpContext.Application["OnlineUsersCount"], TodayVisits = stat.Count(ss => ss.DateStamp.Day == DateTime.Now.Day), TotallVisits = stat.Count, UniquVisitors = stat.GroupBy(ta => ta.IpAddress).Select(ta => ta.Key).Count(), }; return(View(svm)); }
//public IActionResult TaskStatisticsLastMonthDiagram() //{ // UserProfile u = UserProfile.GetUsers(_context).Find(x => x.Mail.ToLower() == User.Identity.Name.ToLower()); // if (u != null) // { // StatisticsViewModel svm = new StatisticsViewModel(_context); // return View("TaskStatisticsLastMonthDiagram", svm); // } // return View("~/Views/Home/MessageForLogin.cshtml"); //} #endregion #region TaskStatisticsWeek public IActionResult TaskStatisticsWeek() { UserProfile u = UserProfile.GetUsers(_context).Find(x => x.Mail.ToLower() == User.Identity.Name.ToLower()); if (u != null) { DateTime dateValue = DateTime.Parse(DateTime.Now.ToShortDateString()); var firstDayOfWeek = CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek; while (dateValue.DayOfWeek != firstDayOfWeek) { dateValue = dateValue.AddDays(-1); } //int dayWeek = DateTime.Now.Day - 7; //if (dayWeek <= 0) // dayWeek = 0; StatisticsViewModel svm = new StatisticsViewModel(_context, dateValue.Day); return(View("TaskStatisticsWeek", svm)); } return(View("~/Views/Home/MessageForLogin.cshtml")); }
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)); }
public StatisticsViewModel GetStatistics() { int enSpeakers = this.Subscribers .Find(s => s.IsActive && !s.IsRemoved && s.PreferedLanguage == Language.EN) .Count(); int bgSpeakers = this.Subscribers .Find(s => s.IsActive && !s.IsRemoved && s.PreferedLanguage == Language.BG) .Count(); IEnumerable <short> yearsRange = this.Statistics .GetAll() .Select(s => s.Year) .Distinct() .OrderByDescending(s => s) .ToList(); var logs = this.UserLogs .GetAll() .OrderByDescending(l => l.Date) .Take(10) .Select(l => new LastLogsViewModel { Date = l.Date, Username = l.User.UserName }) .ToList(); int totalVisits = this.Statistics.GetAll().Sum(s => s.HitsCount); var model = new StatisticsViewModel { BulgarianSpeakersCount = bgSpeakers, EnglishSpeakersCount = enSpeakers, YearsRange = yearsRange, LastLogs = logs, TotaVisits = totalVisits }; return(model); }
public void Setup() { _mediator = new Mock <IMediator>(); _statistics = new StatisticsViewModel { TotalAccounts = 1, TotalPayeSchemes = 2, TotalLegalEntities = 3, TotalAgreements = 4, TotalPayments = 5 }; _response = new GetStatisticsResponse { Statistics = _statistics }; _mediator.Setup(m => m.SendAsync(It.IsAny <GetStatisticsQuery>())).ReturnsAsync(_response); _controller = new StatisticsController(_mediator.Object); }
public ActionResult Index() { var model = new StatisticsViewModel(); model.Categories = EconomyBusiness.GetAllCategories(); model.SubCategories = EconomyBusiness.GetAllSubCategories(); model.Descriptions = EconomyBusiness.GetAllDescriptions(); model.Years = StatisticsBusiness.GetYears(); int selectedYear = -AppSettings.GetAppSettingsInteger("YearsBack");//DateTime.Now.AddYears(-AppSettings.GetAppSettingsInteger("YearsBack")).Year; model.SelectedYear = DateTime.Now.AddYears(selectedYear).Year; model.ChartSrc = StatisticsBusiness.GetChart(new FilterJson { CategoryId = 0, SubCategoryId = 0, Description = string.Empty, FromYear = model.SelectedYear }); return(View(model)); }
//End of Database connection public ActionResult Index() { StatisticsViewModel x = new StatisticsViewModel(); x.CreateNewStatistic(); if (Request.Cookies["UserEMail"] != null) { HttpCookie NewCookie = Request.Cookies["UserName"]; CookieHolder = NewCookie.Value; LoggedIn = true; ShowSidebar(); return(View()); } else { LoggedIn = false; ShowSidebar(); return(View()); } }
public ActionResult Statistics(int patientId) { StatisticsViewModel model = new StatisticsViewModel(); var xSerie = graphRepository.GetXSerie(patientId).ToList(); var yData = graphRepository.GetData(patientId).ToList(); List <double?> correctMeasures = new List <double?>(); List <double?> incorrectMeasures = new List <double?>(); for (int i = 0; i < xSerie.Count(); i++) { correctMeasures.Add(0); incorrectMeasures.Add(0); foreach (var y in yData) { if (y.xValue == xSerie[i]) { if (y.CorrectMeasure) { correctMeasures[i] += 1; } else { incorrectMeasures[i] += 1; } } } } correctMeasures.ForEach(p => model.correctSerie.Add(new ColumnSeriesData { Y = p })); incorrectMeasures.ForEach(p => model.incorrectSerie.Add(new ColumnSeriesData { Y = p })); xSerie.ForEach(p => model.xSerie.Add(p.ToShortDateString())); return(View(model)); }
public async Task <IActionResult> Index() { var result = await _documentDbRepository.GetAllItemsAsync(); var trashCans = new List <TrashCan>(); var viewModel = new StatisticsViewModel(); foreach (var trashCan in result) { if (trashCan.LatestReading != null) { trashCans.Add(trashCan); } } viewModel.TrashCans = trashCans; viewModel.AverageFillPercentage = Math.Round(trashCans.Average(x => x.LatestReading.FillGrade.GetValueOrDefault()) * 100); viewModel.AverageWeight = Math.Round(trashCans.Average(x => x.LatestReading.Weight)); viewModel.CircleClassFillPercentage = GetCircleClassFill(viewModel.AverageFillPercentage); viewModel.CircleClassWeigth = GetCircleClassWeight(viewModel.AverageWeight); return(View(viewModel)); }
public async Task <IActionResult> Index() { ViewBag.Title = "Статистика"; var admin = await userManager.GetUserAsync(User); var hotelsRating = await db.Hotels.Where(h => h.CityId == admin.Hotel.CityId) .OrderByDescending(h => h.StarRating) .Select(h => h.StarRating) .ToListAsync(); hotelsRating = hotelsRating.Distinct().ToList(); var blacklist = await db.Blacklist.Where(b => b.HotelId == admin.HotelId).ToListAsync(); var vm = new StatisticsViewModel() { HotelRank = hotelsRating.IndexOf(admin.Hotel.StarRating) + 1, HotelRating = admin.Hotel.StarRating, Blacklist = blacklist }; return(View(vm)); }
public ActionResult Index() { var model = new StatisticsViewModel(); model.CountOfProduct = _productService.GetList().Count(); model.CountOfCategory = _categoryService.GetList().Count(); model.CountOfCustomer = _customerService.GetList().Count(); model.CountOfRefigerator = _productService.GetList().Where(p => p.ProductName.Contains("Buzdolabı")).Count(); model.CountOfStock = _productService.GetList().Select(p => p.Stock).Sum(); model.CountOfPresentSales = _saleProcessService.GetList().Where(p => p.Date == DateTime.Today).Count(); model.CountOfTrademark = _productService.GetList().DistinctBy(p => p.TradeMark).Count(); model.MaxPrice = _productService.GetList().Select(p => p.SalePrice).Max(); model.MinPrice = _productService.GetList().Select(p => p.SalePrice).Min(); model.AmountInTheSafe = _saleProcessService.GetList().Select(p => p.Total).Sum(); model.TodayAmountInTheSafe = _saleProcessService.GetList().Where(p => p.Date == DateTime.Today).Select(p => p.Total).Sum(); model.CountOfEmployee = _employeeService.GetList().Count(); model.CountOfRefigerator = _productService.GetList().Where(p => p.ProductName.Contains("Laptop")).Count(); model.MaxTrademark = _productService.GetList().GroupBy(p => p.TradeMark).OrderByDescending(p => p.Count()).Select(a => a.Key).FirstOrDefault(); model.CriticalStock = _productService.GetList().Where(p => p.Stock < 2).Count(); return(View(model)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="OverviewVw"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public OverviewVw(SpongeProject project, StatisticsViewModel statisticsModel) { InitializeComponent(); gridGenre.Rows.Add(10); gridTasks.Rows.Add(10); gridGenre.AlternatingRowsDefaultCellStyle.BackColor = ColorHelper.CalculateColor(Color.Black, gridGenre.DefaultCellStyle.BackColor, 10); gridTasks.AlternatingRowsDefaultCellStyle.BackColor = ColorHelper.CalculateColor(Color.Black, gridTasks.DefaultCellStyle.BackColor, 10); var statisticsView = new StatisticsView(statisticsModel); this.Controls.Add(statisticsView); _viewBtnManger = new ViewButtonManager(tsOverview, new Control[] { statisticsView, gridGenre, pnlContributor, gridTasks }); _viewBtnManger.SetView(tsbStatistics); }
public ActionResult Index() { var currentUser = ContextProvider.ContextAccount(); if (currentUser == null) return View(Enumerable.Empty<DynamicData>()); var statistic = Query.For<StatisticalData>().With(new StatisticSearchCriterion(currentUser.PlayerId)); var dynamic = Query.For<IEnumerable<DynamicData>>().With(new StatisticSearchCriterion(currentUser.PlayerId)); var viewModel = new StatisticsViewModel(statistic, dynamic); PopulateViewBag(); return View(viewModel); }