public ActionResult GenerateExcelResult(GenerateExcelModel model) { DateTimeOffset start = model.StartDate.ToSwedishDateTime(); DateTimeOffset end = model.EndDate.ToSwedishDateTime(); var brokerId = User.TryGetBrokerId(); var organisationId = User.TryGetCustomerOrganisationId(); var customerUnits = User.IsInRole(Roles.CentralAdministrator) ? null : User.TryGetLocalAdminCustomerUnits(); switch (model.SelectedReportType) { case ReportType.OrdersForCustomer: var orders = _statService.GetOrders(start, end, organisationId, customerUnits); return(CreateExcelFile(StatisticsService.GetOrderExcelFileRows(orders, model.SelectedReportType), orders.OrderRequests.First().CustomerName, model.SelectedReportType)); case ReportType.DeliveredOrdersCustomer: var deliveredOrders = _statService.GetDeliveredOrders(start, end, organisationId, customerUnits); return(CreateExcelFile(StatisticsService.GetOrderExcelFileRows(deliveredOrders, model.SelectedReportType), deliveredOrders.OrderRequests.First().CustomerName, model.SelectedReportType)); case ReportType.DeliveredOrdersBrokers: var deliveredOrdersBrokers = _statService.GetDeliveredRequestsForBroker(start, end, brokerId.Value); return(CreateExcelFile(StatisticsService.GetOrderExcelFileRows(deliveredOrdersBrokers, model.SelectedReportType), deliveredOrdersBrokers.OrderRequests.First().BrokerName, model.SelectedReportType)); case ReportType.RequestsForBrokers: var requestsForBrokers = _statService.GetRequestsForBroker(start, end, brokerId.Value); return(CreateExcelFile(StatisticsService.GetOrderExcelFileRows(requestsForBrokers, model.SelectedReportType), requestsForBrokers.OrderRequests.First().BrokerName, model.SelectedReportType)); case ReportType.OrdersForSystemAdministrator: var ordersForSystemAdministrator = _statService.GetOrders(start, end, organisationId); return(CreateExcelFile(StatisticsService.GetOrderExcelFileRows(ordersForSystemAdministrator, model.SelectedReportType), string.Empty, model.SelectedReportType)); case ReportType.DeliveredOrdersSystemAdministrator: var deliveredOrdersForSystemAdministrator = _statService.GetDeliveredOrders(start, end, organisationId); return(CreateExcelFile(StatisticsService.GetOrderExcelFileRows(deliveredOrdersForSystemAdministrator, model.SelectedReportType), string.Empty, model.SelectedReportType)); case ReportType.RequisitionsForSystemAdministrator: var requisitionsForSystemAdministrator = _statService.GetRequisitions(start, end, organisationId); return(CreateExcelFile(StatisticsService.GetRequisitionsExcelFileRows(requisitionsForSystemAdministrator, model.SelectedReportType), string.Empty, model.SelectedReportType)); case ReportType.RequisitionsForBroker: var requisitionsForBroker = _statService.GetRequisitions(start, end, null, null, brokerId.Value); return(CreateExcelFile(StatisticsService.GetRequisitionsExcelFileRows(requisitionsForBroker, model.SelectedReportType), requisitionsForBroker.Requisitions.First().BrokerName, model.SelectedReportType)); case ReportType.RequisitionsForCustomer: var requisitionsForCustomer = _statService.GetRequisitions(start, end, organisationId, customerUnits); return(CreateExcelFile(StatisticsService.GetRequisitionsExcelFileRows(requisitionsForCustomer, model.SelectedReportType), requisitionsForCustomer.Requisitions.First().CustomerName, model.SelectedReportType)); case ReportType.ComplaintsForSystemAdministrator: var complaintsForSystemAdministrator = _statService.GetComplaints(start, end, organisationId); return(CreateExcelFile(StatisticsService.GetComplaintsExcelFileRows(complaintsForSystemAdministrator, model.SelectedReportType), string.Empty, model.SelectedReportType)); case ReportType.ComplaintsForBroker: var complaintsForBroker = _statService.GetComplaints(start, end, null, null, brokerId.Value); return(CreateExcelFile(StatisticsService.GetComplaintsExcelFileRows(complaintsForBroker, model.SelectedReportType), complaintsForBroker.Complaints.First().BrokerName, model.SelectedReportType)); case ReportType.ComplaintsForCustomer: var complaintsForCustomer = _statService.GetComplaints(start, end, organisationId, customerUnits); return(CreateExcelFile(StatisticsService.GetComplaintsExcelFileRows(complaintsForCustomer, model.SelectedReportType), complaintsForCustomer.Complaints.First().CustomerName, model.SelectedReportType)); } return(RedirectToAction(nameof(List))); }
public StatisticsController( ISwedishClock clock, StatisticsService statService) { _clock = clock; _statService = statService; }
static void Main(string[] args) { bool exitProgram = false; IUiMessageFactory uiMessageFactory = new UiMessageFactory(); IGameService gameService = new GameService(); IStatisticsService statsService = new StatisticsService(); while (!exitProgram) { Console.Clear(); uiMessageFactory.WelcomeMessage(); if (Console.ReadKey().Key == ConsoleKey.D1) { statsService.Begin(); } if (Console.ReadKey().Key == ConsoleKey.D2) { gameService.Begin(); } if (Console.ReadKey().Key == ConsoleKey.Escape) { exitProgram = true; } } }
public HttpResponseMessage Get(string type) { try { switch (type.ToLower()) { case "pagevisits": var pages = _statsRepository.FetchPageVisits().Select(pv => new PageVisit(pv).GetJSON()); return(Request.CreateResponse(HttpStatusCode.OK, pages)); case "clicks": var visits = StatisticsService.GetPageVisitAggregation(_statsRepository); return(Request.CreateResponse(HttpStatusCode.OK, visits)); case "browsers": var browsers = StatisticsService.GetBrowserStats(); return(Request.CreateResponse(HttpStatusCode.OK, browsers)); default: throw new ArgumentException("Requestion Type Not Found:" + type); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
public StatisticsController() { db = new ApplicationDbContext(); userStore = new UserStore <ApplicationUser>(db); userManager = new ApplicationUserManager(userStore); statisticsService = new StatisticsService(db); }
public async Task AddSameTags_VariousRepos_FlattenedProperly() { //arrange var db = new StatisticsDatabase(Settings); StatisticsService service = new StatisticsService(db, new Mapper(MappingConfigurationFactory.Create())); var parameter1 = new RepositoryQueryParameter(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); await service.Update(parameter1, new [] { "FirstTag", "SecondTag", "Third" }).ConfigureAwait(false); await service.Update(parameter1, new[] { "FIRSTTAG", "", "Fourth" }).ConfigureAwait(false); await service.Update(parameter1, new[] { "FIRSTTAG", "SecondTag", "Fourth" }).ConfigureAwait(false); parameter1 = new RepositoryQueryParameter(Guid.NewGuid().ToString(), Guid.NewGuid().ToString()); await service.Update(parameter1, new[] { "FirstTag", "SecondTag", "Fourth" }).ConfigureAwait(false); await service.Update(parameter1, new[] { "Fifth", "Sixth" }).ConfigureAwait(false); //act List <SearchKeywordData> result = (await service.GetFlattened().ConfigureAwait(false)).ToList(); //assert result.Count.Should().Be(6); result.Single(x => x.Keyword == "FirstTag").SearchCount.Should().Be(4); result.Single(x => x.Keyword == "SecondTag").SearchCount.Should().Be(3); result.Single(x => x.Keyword == "Third").SearchCount.Should().Be(1); result.Single(x => x.Keyword == "Fourth").SearchCount.Should().Be(3); result.Single(x => x.Keyword == "Fifth").SearchCount.Should().Be(1); result.Single(x => x.Keyword == "Sixth").SearchCount.Should().Be(1); }
public async Task AddSameTags_ValuesIncrementedProperly() { var db = new StatisticsDatabase(Settings); StatisticsService service = new StatisticsService(db, new Mapper(MappingConfigurationFactory.Create())); string organizationOne = Guid.NewGuid().ToString(); string repoOne = Guid.NewGuid().ToString(); var parameter = new RepositoryQueryParameter(organizationOne, repoOne); string[] words = new[] { "FirstTag", "SecondTag", "Third" }; SearchStatistics stats1 = await service.Update(parameter, words).ConfigureAwait(false); SearchStatistics stats2 = await service.Update(parameter, words).ConfigureAwait(false); stats1.RepositoryName.Should().Be(stats2.RepositoryName); stats1.SearchKeywordData.Count.Should().Be(3); foreach (SearchKeywordData searchKeywordData in stats1.SearchKeywordData) { Assert.AreEqual(1, searchKeywordData.SearchCount); } stats2.SearchKeywordData.Count.Should().Be(3); foreach (SearchKeywordData searchKeywordData in stats2.SearchKeywordData) { Assert.AreEqual(2, searchKeywordData.SearchCount); } }
public void GetWeeklyStatistics(int weekBefore, int thisWeek, decimal expectedPercentageDiff, StatisticsChangeType expectedChangeType) { WeeklyStatisticsModel ws = StatisticsService.GetWeeklyStatistics(weekBefore, thisWeek, string.Empty); Assert.Equal(expectedPercentageDiff, ws.DiffPercentage); Assert.Equal(expectedChangeType, ws.ChangeType); }
public TriviaController() { this.db = new TriviaContext(); this.questionsService = new QuestionsService(db); this.answersService = new AnswersService(db); this.statisticsService = new StatisticsService(db); }
public StatisticsServiceTests() { _tolkDbContext = CreateTolkDbContext(); _clock = new StubSwedishClock(DateTimeOffset.Now.ToString()); var mockLanguages = MockEntities.MockLanguages; var mockRankings = MockEntities.MockRankings; var mockCustomers = MockEntities.MockCustomers; var mockCustomerUsers = MockEntities.MockCustomerUsers(mockCustomers); var mockOrders = MockEntities.MockOrders(mockLanguages, mockRankings, mockCustomerUsers); var mockRequisitions = MockEntities.MockRequisitions(mockOrders); var mockComplaints = MockEntities.MockComplaints(mockOrders); var regions = Region.Regions; //Initialize data if not already initialized if (!_tolkDbContext.CustomerOrganisations.Any()) { _tolkDbContext.AddRange(mockCustomers); _tolkDbContext.AddRange(mockCustomerUsers); _tolkDbContext.AddRange(mockLanguages); _tolkDbContext.AddRange(mockRankings); _tolkDbContext.AddRange(mockOrders); _tolkDbContext.AddRange(mockRequisitions); _tolkDbContext.AddRange(mockComplaints); _tolkDbContext.AddRange(regions); } _tolkDbContext.SaveChanges(); _statService = new StatisticsService(_tolkDbContext, _clock); }
public ProfileViewModelFactory([NotNull] ISystemDispatcher systemDispatcher, [NotNull] AsyncDataProvider dataProvider, [NotNull] StatisticsService statistics, [NotNull] IStringsProvider stringsProvider, [NotNull] INavigationService navigationService) { if (systemDispatcher == null) { throw new ArgumentNullException("systemDispatcher"); } if (dataProvider == null) { throw new ArgumentNullException("dataProvider"); } if (statistics == null) { throw new ArgumentNullException("statistics"); } if (stringsProvider == null) { throw new ArgumentNullException("stringsProvider"); } if (navigationService == null) { throw new ArgumentNullException("navigationService"); } _systemDispatcher = systemDispatcher; _dataProvider = dataProvider; _statistics = statistics; _stringsProvider = stringsProvider; _navigationService = navigationService; _userViewModelFactory = new Lazy <IUserViewModelFactory>( () => new UserViewModelFactory(_systemDispatcher, _navigationService, _stringsProvider, _statistics)); }
public static void RegressionChart(IList <KeyValuePair <Employee, float> > predictions, string fileName) { const int minValue = 1500; const int maxValue = 6500; PlotToFile(fileName, pl => { pl.env(minValue, maxValue, minValue, maxValue, AxesScale.Equal, AxisBox.BoxTicksLabelsAxes); pl.lab("Actual", "Predicted", "Distribution of Salary Prediction"); pl.col0(Blue); foreach (var(employee, prediction) in predictions) { var x = employee.Salary; var y = prediction; pl.poin(new double[] { x }, new double[] { y }, Dot); } var points = predictions.Select(p => ((float)p.Key.Salary, p.Value)).ToList(); StatisticsService.CalculateRegressionLine(points, minValue, maxValue, out var y1, out var y2); pl.col0(Red); pl.line(new double[] { minValue, maxValue }, new double[] { y1, y2 }); });
public List <AnnDataPoint> GetAnnData(Stock stock, HistoricalData historicalData, bool recalculateMeans = true) { var rawAnnDataPoints = GetRawAnnDataPoints(stock, historicalData); var numberOfInputs = rawAnnDataPoints.First().Inputs.Length; var numberOfOutputs = rawAnnDataPoints.First().Outputs.Length; // calculate means and stddevs if we are dea if (recalculateMeans) { TrainingMeansInput = new double[numberOfInputs]; TrainingStdDevsInput = new double[numberOfInputs]; TrainingMeansOutput = new double[numberOfOutputs]; TrainingStdDevsOutput = new double[numberOfOutputs]; for (int i = 0; i < numberOfInputs; i++) { TrainingMeansInput[i] = StatisticsService.Mean(rawAnnDataPoints.Select(x => x.Inputs[i]).ToArray()); TrainingStdDevsInput[i] = StatisticsService.StandardDeviation(rawAnnDataPoints.Select(x => x.Inputs[i]).ToArray()); } for (int i = 0; i < numberOfOutputs; i++) { TrainingMeansOutput[i] = StatisticsService.Mean(rawAnnDataPoints.Select(x => x.Outputs[i]).ToArray()); TrainingStdDevsOutput[i] = StatisticsService.StandardDeviation(rawAnnDataPoints.Select(x => x.Outputs[i]).ToArray()); } } return(Normalize(rawAnnDataPoints)); }
public async Task <JsonResult> CompanyEmployeesSalaries() { StatisticsService statistics = new StatisticsService(_employeeRepository); var model = await statistics.CompanyEmployeesSalaries(CurrentCompanyId); return(Json(model, JsonRequestBehavior.AllowGet)); }
// This method gets called by the runtime. Use this method to add services to the container. // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { var appConfiguration = Configuration.Get <AppConfiguration>(); var httpClient = new HttpClient(); var zWayService = new ZWayService(httpClient, LoggerFactory.CreateLogger <ZWayService>()); var weatherService = new WeatherService(httpClient, LoggerFactory.CreateLogger <WeatherService>()); var sunService = new SunService(httpClient, LoggerFactory.CreateLogger <SunService>()); var virtualService = new DeviceGroupService(zWayService); var aggregatedService = new AggregatedDeviceService(zWayService, virtualService, weatherService, sunService); var statisticsService = new StatisticsService(LoggerFactory.CreateLogger <StatisticsService>(), aggregatedService, appConfiguration.Statistics); zWayService.InitAsync(appConfiguration.ZWay).Wait(); weatherService.InitAsync(appConfiguration.Weather).Wait(); sunService.InitAsync(appConfiguration.Sun).Wait(); virtualService.Init(appConfiguration.DeviceGroups); aggregatedService.Init(appConfiguration.ToggleAutomationRules); statisticsService.Init(); services.AddMvc(); services.AddSingleton <HttpClient>(new HttpClient()); services.AddSingleton <IDeviceService>(aggregatedService); services.AddSingleton <VersionService>(new VersionService()); services.AddSingleton <StatisticsService>(statisticsService); //services.AddSignalR(); }
public void SetUp() { mockMapper = new Mock <IMapper>(); mockRepoWrapper = new Mock <IRepositoryWrapper>(); settings = new Mock <StatisticsServiceSettings>(); statisticsService = new StatisticsService(mockRepoWrapper.Object, settings.Object, mockMapper.Object); }
protected void CheckStatistics() { StatisticsInfo s = StatisticsService.GetStatistics(); bool update = false; int totalPosts = PostService.GetPostCount(-1, -1, -1, (int)PostStatus.Published, 0); if (totalPosts != s.PostCount) { s.PostCount = totalPosts; update = true; } int totalComments = CommentService.GetCommentCount(true); if (totalComments != s.CommentCount) { s.CommentCount = totalComments; update = true; } int totalTags = TagService.GetTagList().Count; if (totalTags != s.TagCount) { s.TagCount = totalTags; update = true; } if (update == true) { StatisticsService.UpdateStatistics(); } }
public UserActivityViewModel([NotNull] ISystemDispatcher dispatcher, [NotNull] StatisticsService statistics, [NotNull] AsyncDataProvider dataProvider, [NotNull] IStringsProvider stringsProvider, [NotNull] IPhoneTasks tasks, int userId, DetailsType detailsType) : base(dispatcher) { if (statistics == null) { throw new ArgumentNullException("statistics"); } if (dataProvider == null) { throw new ArgumentNullException("dataProvider"); } if (stringsProvider == null) { throw new ArgumentNullException("stringsProvider"); } if (tasks == null) { throw new ArgumentNullException("tasks"); } _statistics = statistics; _dataProvider = dataProvider; _stringsProvider = stringsProvider; _tasks = tasks; _userId = userId; _detailsType = detailsType; _statistics.PublishActivityPageLoaded(_detailsType == DetailsType.Questions); LoadMoreCommand = new RelayCommand(_ => LoadNext()); LoadNext(); }
public void CallRimsWithTiresRepoAllMethodOnce() { //Arrange var mockedTiresRepo = new Mock <IDbRepository <Tire> >(); var mockedRimsRepo = new Mock <IDbRepository <Rim> >(); var mockedRimsWithTiresRepo = new Mock <IDbRepository <RimWithTire> >(); var statisticsService = new StatisticsService(mockedTiresRepo.Object, mockedRimsRepo.Object, mockedRimsWithTiresRepo.Object); var tires = new List <Tire> { new Tire() }; mockedTiresRepo.Setup(x => x.All()).Returns(tires.AsQueryable()); var rims = new List <Rim> { new Rim() }; mockedRimsRepo.Setup(x => x.All()).Returns(rims.AsQueryable()); var rimsWithTires = new List <RimWithTire> { new RimWithTire() }; mockedRimsWithTiresRepo.Setup(x => x.All()).Returns(rimsWithTires.AsQueryable()); //Act var count = statisticsService.TotalAds(); //Assert mockedRimsWithTiresRepo.Verify(x => x.All(), Times.Once); }
public StatisticsController() { db = new ApplicationDbContext(); userStore = new UserStore<ApplicationUser>(db); userManager = new ApplicationUserManager(userStore); statisticsService = new StatisticsService(db); }
public LoginViewModelFactory([NotNull] ISystemDispatcher dispatcher, [NotNull] INavigationService navigation, [NotNull] IApplicationSettings settings, AsyncDataProvider dataProvider, [NotNull] StatisticsService statistics) { if (dispatcher == null) { throw new ArgumentNullException("dispatcher"); } if (navigation == null) { throw new ArgumentNullException("navigation"); } if (settings == null) { throw new ArgumentNullException("settings"); } if (statistics == null) { throw new ArgumentNullException("statistics"); } _dispatcher = dispatcher; _navigation = navigation; _settings = settings; _dataProvider = dataProvider; _statistics = statistics; }
public void ReturnsCorrectAnswer() { //Arrange var mockedTiresRepo = new Mock <IDbRepository <Tire> >(); var mockedRimsRepo = new Mock <IDbRepository <Rim> >(); var mockedRimsWithTiresRepo = new Mock <IDbRepository <RimWithTire> >(); var statisticsService = new StatisticsService(mockedTiresRepo.Object, mockedRimsRepo.Object, mockedRimsWithTiresRepo.Object); var tires = new List <Tire> { new Tire() }; mockedTiresRepo.Setup(x => x.All()).Returns(tires.AsQueryable()); var rims = new List <Rim> { new Rim() }; mockedRimsRepo.Setup(x => x.All()).Returns(rims.AsQueryable()); var rimsWithTires = new List <RimWithTire> { new RimWithTire() }; mockedRimsWithTiresRepo.Setup(x => x.All()).Returns(rimsWithTires.AsQueryable()); //Act var count = statisticsService.TotalAds(); //Assert Assert.True(count == 3); }
public UserViewModelFactory([NotNull] ISystemDispatcher dispatcher, [NotNull] INavigationService navigation, [NotNull] IStringsProvider stringsProvider, [NotNull] StatisticsService statistics) { if (dispatcher == null) { throw new ArgumentNullException("dispatcher"); } if (navigation == null) { throw new ArgumentNullException("navigation"); } if (stringsProvider == null) { throw new ArgumentNullException("stringsProvider"); } if (statistics == null) { throw new ArgumentNullException("statistics"); } _dispatcher = dispatcher; _navigation = navigation; _stringsProvider = stringsProvider; _statistics = statistics; }
// I_SERVICE public void Init() { _playerManager = Core.Instance.GetService <PlayerManager>(); _statistic = Core.Instance.GetService <StatisticsService>(); //ResetAllData(); // LoadSaveGame(); }
public async Task <ActionResult> Statistics() { var db = new TriviaContext(); var statisticsService = new StatisticsService(db); return(View(await statisticsService.GenerateStatistics())); }
private void buildSessionFactory() { Configuration configuration1 = buildConfiguration(); this.sessionFactory = configuration1.buildSessionFactory(); try { if (this.sessionFactory.Statistics != null && this.sessionFactory.Statistics.StatisticsEnabled) { string str = ServiceName.ToString(); if (str.IndexOf("type=service", StringComparison.Ordinal) != -1) { str = str.replaceAll("type=service", "type=stats"); } else { str = str + ",type=stats"; } this.hibernateStatisticsServiceName = new ObjectName(str); StatisticsService statisticsService = new StatisticsService(); statisticsService.SessionFactory = this.sessionFactory; Server.registerMBean(statisticsService, this.hibernateStatisticsServiceName); } bind(); } catch (Exception exception) { forceCleanup(); throw exception; } this.dirty = false; sendNotification(new Notification("hibernate.sessionfactory.create", ServiceName, NextNotificationSequenceNumber)); this.runningSince = DateTime.Now; log.info("SessionFactory successfully built and bound into JNDI [" + this.sessionFactoryName + "]"); }
public MainWindow(Configuration configuration, Program program, StatisticsService statisticsService) { InitializeComponent(); Configuration = configuration; Program = program; StatisticsService = statisticsService; IsFirstLine = true; ShuttingDown = false; DataContext = new MainWindowDataContext(configuration); Assembly entryAssembly = Assembly.GetEntryAssembly(); Version version = entryAssembly.GetName().Version; Title = string.Format("Riot Control r{0}", version.Revision); RevisionLabel.Content = string.Format("r{0}", version.Revision); TimeLabel.Content = Nil.Assembly.GetAssemblyBuildTime(entryAssembly).ToString(); WebsiteLabel.Content = Website; UpdateHelpLabel(); var iconStream = System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/Resources/Icon.ico")).Stream; TrayIcon = new NotifyIcon(); TrayIcon.Icon = new Icon(iconStream); TrayIcon.MouseDoubleClick += TrayIconDoubleClick; iconStream.Close(); LoadOptions(); }
public ProfileViewModel(ISystemDispatcher dispatcher, [NotNull] AsyncDataProvider dataProvider, int id, [NotNull] StatisticsService statistics, [NotNull] IUserViewModelFactory userViewModelFactory, INavigationService navigation) : base(dispatcher) { if (dataProvider == null) { throw new ArgumentNullException("dataProvider"); } if (statistics == null) { throw new ArgumentNullException("statistics"); } if (userViewModelFactory == null) { throw new ArgumentNullException("userViewModelFactory"); } _dataProvider = dataProvider; _id = id; _statistics = statistics; _userViewModelFactory = userViewModelFactory; _navigation = navigation; _navigation.CleanNavigationStack(); Initialize(); _statistics.ReportProfilePageLoaded(); SelectNewUserCommand = new RelayCommand(SelectNewUser); }
public StatisticsServiceTestBase() { Cache = new Mock <ICacheManager>(); Repository = new Mock <ISpeakerMeetRepository>(); Service = new StatisticsService(Cache.Object, Repository.Object); }
public ActionResult _ajax_GetCourseUsersPassed(int courseid, int company, int department, string start, string end, int user) { var username = System.Security.Principal.WindowsPrincipal.Current.Identity.Name; var profile = UserService.GetUserProfilesBy(username, FilterUserProfiles.Username).FirstOrDefault(); var userRole = UserService.IdentifyUserRoleByUsername(username); if (userRole == RolesNames.user) { user = profile.Id; } else if (userRole == RolesNames.manager) { department = profile.DepartmentId; } else if (userRole == RolesNames.administrator) { company = profile.CompanyId; } DateTime?startDateTime = null; DateTime?endDateTime = null; if (!start.Equals("")) { startDateTime = DateTime.ParseExact(start, dateFormat, CultureInfo.InvariantCulture); } if (!end.Equals("")) { endDateTime = DateTime.ParseExact(end, dateFormat, CultureInfo.InvariantCulture); } var result = StatisticsService.GetGraphTimeLineData(user, company, department, courseid, startDateTime, endDateTime); return(Json(result, JsonRequestBehavior.AllowGet)); }
protected RankingsController CreateRankingController(EloConfiguration eloConfiguration, TypeEloCalculator?typeEloCalculator) { var eloCalculatorFactory = CreateEloCalculatorFactory(typeEloCalculator); var rankingService = new StatisticsService(_gamesService, eloConfiguration, eloCalculatorFactory); return(new RankingsController(rankingService, _memoryCache, eloConfiguration)); }
public async Task <JsonResult> EmployeeSalary(string username) { StatisticsService statistics = new StatisticsService(_employeeRepository); var model = await statistics.EmployeeSalary(username); return(Json(model, JsonRequestBehavior.AllowGet)); }
public ActionResult Index() { if(!User.Identity.IsAuthenticated) { return View("Home"); } else { ViewBag.Message = "Make your life green....."; var model = new StatisticsService().GetStatisticsForUser(User.Identity.Name); return View(model); } }
public Program() { Serialiser = new Nil.Serialiser<Configuration>(ConfigurationPath); Configuration = Serialiser.Load(); //Check for configuration errors Configuration.Check(); //Store it right away to automatically remove unused content and provide new default values Serialiser.Store(Configuration); Database databaseProvider = new Database(Configuration); StatisticsService = new StatisticsService(this, Configuration, databaseProvider); WebService = new WebService(this, Configuration, StatisticsService, databaseProvider); UpdateService = new UpdateService(Configuration, this, this); MainWindow = new MainWindow(Configuration, this, StatisticsService); }
public bool Initialise() { try { Serialiser = new Nil.Serialiser<Configuration>(ConfigurationPath); Configuration = Serialiser.Load(); } catch (Exception exception) { MessageBox.Show(exception.Message); return false; } Database databaseProvider = new Database(Configuration.Database); StatisticsService = new StatisticsService(this, Configuration, databaseProvider); WebService = new WebService(this, Configuration, StatisticsService, databaseProvider); MainWindow = new MainWindow(Configuration, this, StatisticsService); return true; }
public void GetWatchingsTest() { //Arrange var domain1 = new DomainStatWatching(); var domain2 = new DomainStatWatching(); var entity1 = new StatWatchingV2Entity() { Tick = Tick1 }; var entity2 = new StatWatchingV2Entity() { Tick = Tick2 }; var entities = new List<StatWatchingV2Entity>() { entity1, entity2 }; var repository = new Mock<IRepository<StatWatchingV2Entity>>(); var repositoryFactory = new Mock<IRepositoryFactory>(); var tableValueConverter = new Mock<ITableValueConverter>(); var statMapper = new Mock<IStatMapper>(); repositoryFactory.Setup(m => m.Create<StatWatchingV2Entity>(Tables.StatWatchingV2)).Returns(repository.Object); repository.Setup(m => m.GetStatEntities(It.Is<StatQueryObject>(p => p.StartInterval == Tick2 && p.EndInterval == Tick1 && p.IsStartInclude == false && p.IsEndInclude == false))) .Returns(entities); tableValueConverter.Setup(m => m.DateTimeToComparerTick(_startDate)).Returns(Tick2); tableValueConverter.Setup(m => m.DateTimeToComparerTick(_finishDate)).Returns(Tick1); statMapper.Setup(m => m.StatWatchingToDomain(entity1)).Returns(domain1); statMapper.Setup(m => m.StatWatchingToDomain(entity2)).Returns(domain2); var statisticsService = new StatisticsService(repositoryFactory.Object, tableValueConverter.Object, statMapper.Object); //Act var result = statisticsService.GetWatchings(_interval).ToList(); //Assert Assert.AreEqual(2, result.Count); CollectionAssert.Contains(result, domain1); CollectionAssert.Contains(result, domain2); }
public MainWindow(Configuration configuration, Program program, StatisticsService statisticsService) { InitializeComponent(); Configuration = configuration; Program = program; StatisticsService = statisticsService; IsFirstLine = true; ShuttingDown = false; DataContext = new MainWindowDataContext(configuration); Assembly entryAssembly = Assembly.GetEntryAssembly(); Version version = entryAssembly.GetName().Version; Title = string.Format("Riot Control r{0}", version.Revision); RevisionLabel.Content = string.Format("r{0}", version.Revision); TimeLabel.Content = Nil.Assembly.GetAssemblyBuildTime(entryAssembly).ToString(); WebsiteLabel.Content = Website; UpdateHelpLabel(); }
public WelcomeController(IUnitOfWork unitOfWork) : base(unitOfWork) { StatisticsService = new StatisticsService(UnitOfWork); }
public DashboardController(IUnitOfWork unitOfWork) : base(unitOfWork) { StatisticsService = new StatisticsService(UnitOfWork); }
public BasePhoenixCustomRule(StatisticsService statisticsService) { this.m_statisticsService = statisticsService; }
public TestPhoenixRule(StatisticsService statisticsService) : base(statisticsService) { }
public AvoidNonNullMethodResultComparedByNull(StatisticsService statisticsService) : base(statisticsService) { }
public void GetProjectStateForAbsentProjectIdTest() { //Arrange const string projectId1 = "projectId1"; var entity1 = new StatProjectStateV3Entity() { ProjectId = projectId1, ActionType = StatActionType.Avsx }; var entity2 = new StatProjectStateV3Entity() { ProjectId = projectId1, ActionType = StatActionType.Screenshot }; var entity3 = new StatProjectStateV3Entity() { ProjectId = projectId1, ActionType = StatActionType.Video }; var entities = new List<StatProjectStateV3Entity>() { entity1, entity2, entity3 }; var domain1 = new DomainStatProjectState(); var repositoryFactory = new Mock<IRepositoryFactory>(); var tableValueConverter = new Mock<ITableValueConverter>(); var statMapper = new Mock<IStatMapper>(); var repository = new FakeRepository<StatProjectStateV3Entity>(entities); repositoryFactory.Setup(m => m.Create<StatProjectStateV3Entity>(Tables.StatProjectStateV3)).Returns(repository); statMapper.Setup(m => m.StatProjectStateToDomain(It.Is<StatProjectStateV3Entity>(p => p.ProjectId == projectId1 && p.ActionType == null && p.Producer == null), false)).Returns(domain1); var statisticsService = new StatisticsService(repositoryFactory.Object, tableValueConverter.Object, statMapper.Object); //Act var projectState1 = statisticsService.GetProjectState(projectId1); //Assert Assert.AreEqual(domain1, projectState1); }
public AvoidReasignLocal(StatisticsService statisticsService) : base(statisticsService) { }