コード例 #1
0
 public MetricDataService(IMetricRepository metricRepository, IMetricDataRepository metricDataRepository, IHourRepository hourRepository, IServerRepository serverRepository)
 {
     this.metricRepository     = metricRepository;
     this.metricDataRepository = metricDataRepository;
     this.hourRepository       = hourRepository;
     this.serverRepository     = serverRepository;
 }
コード例 #2
0
 public ClusterMonitoringBusiness(IClusterRepository clusterRepository, ILogger <ClusterMonitoringBusiness> logger, IClusterNodeRepository clusterNodeRepository, IMetricRepository metricRepository)
 {
     this.clusterRepository     = clusterRepository;
     this.logger                = logger;
     this.clusterNodeRepository = clusterNodeRepository;
     this.metricRepository      = metricRepository;
 }
コード例 #3
0
ファイル: ServiceHelper.cs プロジェクト: fotonsveta/Chartix
        public ICommandStrategyFactory <IButtonCommand> CreateButtonCSF(
            IBotClient botClient,
            ISourceRepository sourceRepo,
            IMetricRepository metricRepo,
            IValueRepository valueRepo)
        {
            var buttonCommands = new List <IButtonCommand>
            {
                new AddMetricButtonCommand(botClient, sourceRepo),
                new ChooseDelMetricButtonCommand(botClient, sourceRepo, metricRepo),
                new ChooseDelValueButtonCommand(botClient, metricRepo, valueRepo),
                new ChooseMainMetricButtonCommand(botClient, sourceRepo, metricRepo),
                new DelMetricButtonCommand(botClient, sourceRepo, metricRepo),
                new DelValueButtonCommand(botClient, valueRepo),
                new FileMenuButtonCommand(botClient),
                new FromJsonButtonCommand(botClient),
                new PlotButtonCommand(botClient, metricRepo, valueRepo),
                new MetricMenuButtonCommand(botClient),
                new SetMainMetricButtonCommand(botClient, metricRepo),
                new ShowMetricButtonCommand(botClient, metricRepo),
                new ToJsonButtonCommand(botClient, metricRepo, sourceRepo),
                new TopMenuButtonCommand(botClient),
            };

            return(new ButtonCommandStrategyFactory(buttonCommands));
        }
コード例 #4
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    if (metricRepository != null)
                    {
                        metricRepository.Dispose();
                    }
                    if (metricMappingRepository != null)
                    {
                        metricMappingRepository.Dispose();
                    }
                    if (userRepository != null)
                    {
                        userRepository.Dispose();
                    }
                    metricRepository        = null;
                    metricMappingRepository = null;
                    userRepository          = null;
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
コード例 #5
0
 public DashBoardController(IDashboardRepository dashboard_repository, IMetricRepository metricRepository, ITagRepository tagRepository, IChartRepository chartRepository, IElementRepository elementRepository)
 {
     _dashboardRepository = dashboard_repository;
     _iMetricRepository   = metricRepository;
     _iTagRepository      = tagRepository;
     _iChartRepository    = chartRepository;
     _iElementRepository  = elementRepository;
 }
コード例 #6
0
 public AggregateRepository(IMetricRepository metric_rep, IAggregate_Data aggregare_data, IChartRepository chart_rep, ITagRepository tag_rep, IWareHouse_Data warehouse_data)
 {
     // _dbcontext = db;
     _metric_rep     = metric_rep;
     _aggregare_data = aggregare_data;
     _chart_rep      = chart_rep;
     _tag_rep        = tag_rep;
     _warehouse_data = warehouse_data;
 }
コード例 #7
0
 public ValueHandlerService(
     ILogger <ValueHandlerService> logger,
     IBotClient botClient,
     IMetricRepository metricRepository,
     IValueRepository valueRepository)
 {
     _logger           = logger;
     _botClient        = botClient;
     _metricRepository = metricRepository;
     _valueRepository  = valueRepository;
 }
コード例 #8
0
        public ClusterBusiness(IClusterRepository clusterRepository, IDatacenterRepository datacenterRepository,
                               ISshKeyRepository sshKeyRepository, IClusterNodeRepository clusterNodeRepository,
                               IQueueService queueService, ITemplateRepository templateRepository,
                               IConfiguration configuration, IMetricRepository metricRepository, IMapper mapper, ITraefikRouterService traefikRouterService, IDomainRepository domainNameRepository)
        {
            if (clusterRepository == null)
            {
                throw new ArgumentNullException(nameof(clusterRepository));
            }
            if (datacenterRepository == null)
            {
                throw new ArgumentNullException(nameof(datacenterRepository));
            }
            if (sshKeyRepository == null)
            {
                throw new ArgumentNullException(nameof(sshKeyRepository));
            }
            if (clusterNodeRepository == null)
            {
                throw new ArgumentNullException(nameof(clusterNodeRepository));
            }
            if (queueService == null)
            {
                throw new ArgumentNullException(nameof(queueService));
            }
            if (templateRepository == null)
            {
                throw new ArgumentNullException(nameof(templateRepository));
            }
            if (traefikRouterService == null)
            {
                throw new ArgumentNullException(nameof(traefikRouterService));
            }
            if (metricRepository == null)
            {
                throw new ArgumentNullException(nameof(metricRepository));
            }
            if (mapper == null)
            {
                throw new ArgumentNullException(nameof(mapper));
            }

            this.clusterRepository     = clusterRepository;
            this.datacenterRepository  = datacenterRepository;
            this.sshKeyRepository      = sshKeyRepository;
            this.clusterNodeRepository = clusterNodeRepository;
            this.queueService          = queueService;
            this.templateRepository    = templateRepository;
            this.domain               = configuration["Kubernox:Domain"];
            this.metricRepository     = metricRepository;
            this.mapper               = mapper;
            this.traefikRouterService = traefikRouterService;
            this.domainNameRepository = domainNameRepository;
        }
コード例 #9
0
 public MetricsRegistration(
     IMetricsProvider metricsProvider,
     IConfigurationProvider configurationProvider,
     IMetricRepository metricRepository,
     IMetricMetadataFactory metadataFactory)
 {
     _metricsProvider       = metricsProvider;
     _configurationProvider = configurationProvider;
     _metricRepository      = metricRepository;
     _metadataFactory       = metadataFactory;
 }
コード例 #10
0
        /// <summary>
        /// Configures the builder to use a repository
        /// </summary>
        /// <returns>The current builder for chaining</returns>
        public MLOpsBuilder UseMetaDataRepositories(IDbContextFactory contextFactory)
        {
            this.experimentRepository      = new ExperimentRepository(contextFactory);
            this.runRepository             = new RunRepository(contextFactory, new Clock());
            this.dataRepository            = new DataRepository(contextFactory);
            this.metricRepository          = new MetricRepository(contextFactory);
            this.confusionMatrixRepository = new ConfusionMatrixRepository(contextFactory);
            this.hyperParameterRepository  = new HyperParameterRepository(contextFactory);

            return(this);
        }
コード例 #11
0
 public ConnectionSession(ChannelBase channel,
                          Method <TRequest, TResponse> method,
                          IMetricRepository metricRepository,
                          IConfigurationProvider configurationProvider,
                          IAlleyLogger logger)
 {
     _channel               = channel;
     _method                = method;
     _metricRepository      = metricRepository;
     _configurationProvider = configurationProvider;
     _logger                = logger;
     _target                = FormatTarget(_channel.Target);
 }
コード例 #12
0
 public MetricService(
     IServerRepository serverRepository,
     IMetricRepository metricRepository,
     IMetricDataRepository metricDataRepository,
     ICategoryRepository categoryRepository,
     ICategoryScoreRepository categoryScoreRepository)
 {
     this.serverRepository        = serverRepository;
     this.metricRepository        = metricRepository;
     this.metricDataRepository    = metricDataRepository;
     this.categoryRepository      = categoryRepository;
     this.categoryScoreRepository = categoryScoreRepository;
 }
コード例 #13
0
 public ManageController(
     IOutdoorPowerRepository outdoorPowerRepository,
     IMetricRepository metricRepository,
     IUserRepository userRepository,
     IHostingEnvironment environment,
     ILogger <ManageController> logger)
 {
     _outdoorPowerRepository = outdoorPowerRepository;
     _metricRepository       = metricRepository;
     _userRepository         = userRepository;
     _environment            = environment;
     _logger = logger;
 }
コード例 #14
0
 public MetricManager(IMetricRepository metricRepository, IMetricDataPointRepository metricDataPointRepository,
                      IChartMogulApiManager chartMogulApiManager, IGoogleAnalyticsApiManager googleAnalyticsApiManager, IExternalApiAuthManager externalApiAuthManager,
                      IGoogleAuthorizer googleAuthorizer, ICompanyManager companyManager)
     : base(metricRepository)
 {
     _metricRepository          = metricRepository;
     _metricDataPointRepository = metricDataPointRepository;
     _chartMogulApiManager      = chartMogulApiManager;
     _googleAnalyticsApiManager = googleAnalyticsApiManager;
     _externalApiAuthManager    = externalApiAuthManager;
     _googleAuthorizer          = googleAuthorizer;
     _companyManager            = companyManager;
 }
コード例 #15
0
 /// <summary>
 /// Parameterized constructor
 /// </summary>
 /// <param name="metricRepository">Metric Repository</param>
 public MetricManager(IMetricRepository metricRepo,
                      IBaseRepository <MetricMapping> metricMappingRepo,
                      IBaseRepository <User> userRepository)
 {
     if (metricRepo == null || metricMappingRepo == null ||
         userRepository == null)
     {
         throw new ArgumentNullException("Repository", "The given parameter cannot be null.");
     }
     this.metricRepository        = metricRepo;
     this.metricMappingRepository = metricMappingRepo;
     this.userRepository          = userRepository;
 }
コード例 #16
0
        internal MLOpsContext(IModelRepository modelRepository,
                              IExperimentRepository experimentRepository,
                              IRunRepository runRepository,
                              IDataRepository dataRepository,
                              IMetricRepository metricRepository,
                              IConfusionMatrixRepository confusionMatrixRepository,
                              IHyperParameterRepository hyperParameterRepository,
                              IDeploymentRepository deploymentRepository)
        {
            if (modelRepository == null)
            {
                throw new ArgumentNullException(nameof(modelRepository));
            }
            if (experimentRepository == null)
            {
                throw new ArgumentNullException(nameof(experimentRepository));
            }
            if (runRepository == null)
            {
                throw new ArgumentNullException(nameof(runRepository));
            }
            if (dataRepository == null)
            {
                throw new ArgumentNullException(nameof(dataRepository));
            }
            if (metricRepository == null)
            {
                throw new ArgumentNullException(nameof(metricRepository));
            }
            if (confusionMatrixRepository == null)
            {
                throw new ArgumentNullException(nameof(confusionMatrixRepository));
            }
            if (hyperParameterRepository == null)
            {
                throw new ArgumentNullException(nameof(hyperParameterRepository));
            }
            if (deploymentRepository == null)
            {
                throw new ArgumentNullException(nameof(deploymentRepository));
            }

            this.LifeCycle  = new LifeCycleCatalog(experimentRepository, runRepository, new Clock());
            this.Data       = new DataCatalog(dataRepository);
            this.Evaluation = new EvaluationCatalog(metricRepository, confusionMatrixRepository);
            this.Model      = new ModelCatalog(modelRepository, runRepository);
            this.Training   = new TrainingCatalog(hyperParameterRepository);
            this.Deployment = new DeploymentCatalog(deploymentRepository, modelRepository, experimentRepository);
        }
コード例 #17
0
 public SessionFactory(
     IConnectionTargetProvider connectionTargetProvider,
     IMethodFactory <TRequest, TResponse> methodFactory,
     IMetricRepository metricRepository,
     IChannelProvider channelProvider,
     IConfigurationProvider configurationProvider,
     IAlleyLogger logger)
 {
     _connectionTargetProvider = connectionTargetProvider;
     _configurationProvider    = configurationProvider;
     _methodFactory            = methodFactory;
     _metricRepository         = metricRepository;
     _channelProvider          = channelProvider;
     _logger = logger;
 }
コード例 #18
0
 public ProcessMessageVisitor(
     IBotClient botClient,
     ICommandStrategyFactory <ICommand> commands,
     ISourceRepository sourceRepository,
     ICommandStrategyFactory <IButtonCommand> buttonCommands,
     IValueHandlerService valueHandlerService,
     IMetricRepository metricRepository)
 {
     _botClient           = botClient;
     _commands            = commands;
     _sourceRepository    = sourceRepository;
     _buttonCommands      = buttonCommands;
     _valueHandlerService = valueHandlerService;
     _metricRepository    = metricRepository;
 }
コード例 #19
0
 public ImportBuildServices(
     IBuildGateway buildGateway,
     IBuildRepository buildRepository,
     IScoreService scoreService,
     IMetricRepository metricRepository,
     IProjectRepository projectRepository,
     DateTime loadHistorySince)
 {
     this.buildGateway      = buildGateway;
     this.buildRepository   = buildRepository;
     this.scoreService      = scoreService;
     this.metricRepository  = metricRepository;
     this.projectRepository = projectRepository;
     this.loadHistorySince  = loadHistorySince;
 }
コード例 #20
0
        /// <summary>
        /// Configures the builder to use a repository
        /// </summary>
        /// <returns>The current builder for chaining</returns>
        public MLOpsBuilder UseMetaDataRepositories(IDbContextFactory contextFactory)
        {
            var runResolver        = new RunResolver();
            var experimentResolver = new ExperimentResolver(runResolver);

            this.experimentRepository      = new ExperimentRepository(contextFactory, experimentResolver);
            this.runRepository             = new RunRepository(contextFactory, new Clock(), runResolver, new RegisteredModelResolver());
            this.dataRepository            = new DataRepository(contextFactory, new DataResolver(), new DataCalculator());
            this.metricRepository          = new MetricRepository(contextFactory);
            this.confusionMatrixRepository = new ConfusionMatrixRepository(contextFactory);
            this.hyperParameterRepository  = new HyperParameterRepository(contextFactory);
            this.deploymentRepository      = new DeploymentRepository(contextFactory, new Clock(), new DeploymentTargetResolver());

            return(this);
        }
コード例 #21
0
        public StudentInformationType(IStudentInformationRepository studentInformationrepository,
                                      IMetricRepository metricRepository)
        {
            this.AuthorizeWith("Authorized");
            Field(x => x.StudentUniqueId, type: typeof(IdGraphType));
            Field(x => x.FullName);
            Field(x => x.FirstName);
            Field(x => x.MiddleName, nullable: true);
            Field(x => x.LastSurname);
            Field(x => x.AddressLine1);
            Field(x => x.AddressLine2, nullable: true);
            Field(x => x.AddressLine3, nullable: true);
            Field(x => x.City);
            Field(x => x.State);
            Field(x => x.ZipCode);
            Field(x => x.TelephoneNumber, nullable: true);
            Field(x => x.EmailAddress, nullable: true);
            Field(x => x.DateOfBirth);
            Field(x => x.PlaceOfBirth, nullable: true);
            Field(x => x.CurrentAge, nullable: true);
            Field(x => x.Gender);
            Field(x => x.HispanicLatinoEthnicity, nullable: true);
            Field(x => x.Race, nullable: true);
            Field(x => x.HomeLanguage, nullable: true);
            Field(x => x.Language, nullable: true);
            Field(x => x.ParentMilitary, nullable: true);
            Field(x => x.SchoolId, nullable: true);
            Field(x => x.GradeLevel, nullable: true);
            Field(x => x.GradeLevelListDisplayText, nullable: true);
            Field(x => x.GradeLevelSortOrder, nullable: true);
            Field(x => x.LateEnrollment, nullable: true);
            Field(x => x.SchoolName, nullable: true);
            Field(x => x.SchoolCategory, nullable: true);

            Field <ListGraphType <StudentIndicatorType> >(
                "StudentIndicators",
                resolve: context => studentInformationrepository.GetIndicators(studentUniqueId: context.Source.StudentUniqueId).ToList()
                );
            Field <ListGraphType <StudentSchoolInformationType> >(
                "StudentSchoolInformation",
                resolve: context => studentInformationrepository.GetSchools(studentUniqueId: context.Source.StudentUniqueId).ToList()
                );
            Field <ListGraphType <StudentParentInformationType> >(
                "StudentParentInformation",
                resolve: context => studentInformationrepository.GetParentInformations(studentUniqueId: context.Source.StudentUniqueId).ToList()
                );
            Field <ListGraphType <StudentMetricType> >(
                "Metrics",
                arguments: new QueryArguments(new QueryArgument <IdGraphType> {
                Name = "schoolId"
            },
                                              new QueryArgument <IdGraphType> {
                Name = "metricId"
            },
                                              new QueryArgument <ListGraphType <IntGraphType> > {
                Name = "metricIds"
            }),
                resolve: context =>
            {
                var schoolId = context.GetArgument <int?>("schoolId");
                if (schoolId.HasValue)
                {
                    var metricId = context.GetArgument <int?>("metricId");
                    if (metricId.HasValue)
                    {
                        return(metricRepository.GetStudentMetricsById(studentUsi: context.Source.StudentUniqueId, schoolId: schoolId.Value, metricId: metricId).ToList());
                    }
                    var metricIds = context.GetArgument <List <int> >("metricIds");
                    return(metricRepository.GetStudentMetricsById(studentUsi: context.Source.StudentUniqueId, schoolId: schoolId.Value, metricIds: metricIds).ToList());
                }
                return(null);
            });
        }
コード例 #22
0
 public MetricService(IMetricRepository metricRepository, IUnitOfWork unitOfWork)
 {
     this.metricRepository = metricRepository;
     this.unitOfWork       = unitOfWork;
 }
コード例 #23
0
 public MetricController(IMetricRepository repository)
 {
     _repository = repository;
 }
コード例 #24
0
 public ScoreDetailsService(IMetricRepository metricRepository, IScoreService scoreService)
 {
     this.metricRepository = metricRepository;
     this.scoreService = scoreService;
 }
コード例 #25
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="metricRepository"></param>
 /// <param name="confusionMatrixRepository"></param>
 public EvaluationCatalog(IMetricRepository metricRepository, IConfusionMatrixRepository confusionMatrixRepository)
 {
     this.metricRepository          = metricRepository;
     this.confusionMatrixRepository = confusionMatrixRepository;
 }
コード例 #26
0
 public PlotButtonCommand(IBotClient botClient, IMetricRepository metricRepository, IValueRepository valueRepository)
 {
     _botClient        = botClient;
     _metricRepository = metricRepository;
     _valueRepository  = valueRepository;
 }
コード例 #27
0
 public void SetUp()
 {
     _metricClient = MockRepository.GenerateMock<IMetricClient>();
     _clientFactory = MockRepository.GenerateMock<ICoreClientFactory>();
     _metricRepository = MockRepository.GenerateStub<IMetricRepository>();
     _service = new MetricService(_clientFactory, _metricRepository);
 }
コード例 #28
0
        private async Task <IActionResult> GetMetrics(
            IMetricRepository metricRepository,
            DateTime start,
            DateTime?end        = null,
            TimeGroup timeGroup = TimeGroup.None)
        {
            if (TimeSpanTooLarge(start, end, timeGroup))
            {
                return(BadRequest("Time range is too large for the current resolution"));
            }

            if (end.HasValue && end.Value < start)
            {
                return(BadRequest("Time range is negative (To is smaller than From)"));
            }

            var user = await userManager.GetUserAsync(User);

            var raspberryPiId = await GetRaspberryPiId(user);

            if (!raspberryPiId.HasValue)
            {
                return(NotFound("Either the user does not exist or the user does not have a raspberry pi"));
            }

            var settings = await dbSettingsRepository.GetSettingsAsync(user.Id) ?? new Settings();

            var dbMetrics = (await metricRepository.GetMetrics(raspberryPiId.Value, start, end, settings.TimeZoneId))
                            .ToList();

            if (!dbMetrics.Any())
            {
                return(Ok(new
                {
                    QueryTimestamp = DateTime.UtcNow.AddSeconds(1).ToString("o"),
                    Timestamps = new string[0],
                    Usage = new int[0],
                    Solar = new int[0],
                    Redelivery = new int[0],
                    Intake = new int[0],
                }));
            }

            var format = "";
            List <OutMetricModel> metrics;

            switch (timeGroup)
            {
            case TimeGroup.TenSeconds:
            case TimeGroup.Minutes:
                format = "HH:mm:ss";

                metrics = dbMetrics
                          .Select(d => new OutMetricModel
                {
                    DateTime   = d.Created,
                    Gas        = d.UsageGasNow,
                    Intake     = d.UsageNow,
                    Redelivery = d.RedeliveryNow,
                    Solar      = d.SolarNow,
                    Usage      = d.UsageNow + d.SolarNow - d.RedeliveryNow
                })
                          .ToList();
                break;

            case TimeGroup.Hours:
                format = "MM-dd HH:mm";

                metrics = dbMetrics
                          .Select(d => new OutMetricModel
                {
                    DateTime   = d.Created,
                    Gas        = d.UsageGasNow,
                    Intake     = d.UsageNow,
                    Redelivery = d.RedeliveryNow,
                    Solar      = d.SolarNow,
                    Usage      = d.UsageNow + d.SolarNow - d.RedeliveryNow
                })
                          .ToList();
                break;

            case TimeGroup.Days:
                metrics = dbMetrics
                          .GroupBy(m => m.Created.Date)
                          .Select(m => new
                {
                    First         = m.First(),
                    Last          = m.Last(),
                    SolarTotalMin = m.Any(a => a.SolarTotal > 0) ? m.Where(a => a.SolarTotal > 0).Min(a => a.SolarTotal) : 0,
                    SolarTotalMax = m.Any(a => a.SolarTotal > 0) ? m.Where(a => a.SolarTotal > 0).Max(a => a.SolarTotal) : 0
                })
                          .SelectWithNextOrDefault((c, n) =>
                {
                    var current        = c.First;
                    var next           = n?.First ?? c.Last;
                    current.SolarTotal = c.SolarTotalMin > 0 ? c.SolarTotalMin : n?.SolarTotalMin ?? 0;
                    next.SolarTotal    = n?.SolarTotalMin > 0 ? n.SolarTotalMin : c.SolarTotalMax;

                    return(current.ToOutMetricModel(next, settings));
                })
                          .ToList();

                format = user.Settings.ShowDayName ? "yyyy-MM-dd (dddd)" : "yyyy-MM-dd";
                break;

            // case TimeGroup.Weeks:
            // break;
            case TimeGroup.Months:
                metrics = dbMetrics
                          .GroupBy(m => new
                {
                    m.Created.Date.Year,
                    m.Created.Month
                })
                          .Select(m => new
                {
                    First         = m.First(),
                    Last          = m.Last(),
                    SolarTotalMin = m.Any(a => a.SolarTotal > 0) ? m.Where(a => a.SolarTotal > 0).Min(a => a.SolarTotal) : 0,
                    SolarTotalMax = m.Any(a => a.SolarTotal > 0) ? m.Where(a => a.SolarTotal > 0).Max(a => a.SolarTotal) : 0
                })
                          .SelectWithNextOrDefault((c, n) =>
                {
                    var current        = c.First;
                    var next           = n?.First ?? c.Last;
                    current.SolarTotal = c.SolarTotalMin > 0 ? c.SolarTotalMin : n?.SolarTotalMin ?? 0;
                    next.SolarTotal    = n?.SolarTotalMin > 0 ? n.SolarTotalMin : c.SolarTotalMax;

                    return(current.ToOutMetricModel(next, settings));
                })
                          .ToList();

                format = "yyyy-MM";
                break;

            case TimeGroup.Years:
                metrics = dbMetrics
                          .GroupBy(m => new
                {
                    m.Created.Date.Year
                })
                          .Select(m => new
                {
                    First         = m.First(),
                    Last          = m.Last(),
                    SolarTotalMin = m.Any(a => a.SolarTotal > 0) ? m.Where(a => a.SolarTotal > 0).Min(a => a.SolarTotal) : 0,
                    SolarTotalMax = m.Any(a => a.SolarTotal > 0) ? m.Where(a => a.SolarTotal > 0).Max(a => a.SolarTotal) : 0
                })
                          .SelectWithNextOrDefault((c, n) =>
                {
                    var current        = c.First;
                    var next           = n?.First ?? c.Last;
                    current.SolarTotal = c.SolarTotalMin > 0 ? c.SolarTotalMin : n?.SolarTotalMin ?? 0;
                    next.SolarTotal    = n?.SolarTotalMin > 0 ? n.SolarTotalMin : c.SolarTotalMax;

                    return(current.ToOutMetricModel(next, settings));
                })
                          .ToList();

                format = "yyyy";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(timeGroup), timeGroup, null);
            }

            var cultureInfo     = new System.Globalization.CultureInfo("nl-NL");
            var timestamps      = metrics.Select(m => m.DateTime.ToString(format, cultureInfo)).ToList();
            var usageList       = metrics.Select(m => m.Usage.DivideByThousand()).ToList();
            var intakeList      = metrics.Select(m => m.Intake.DivideByThousand()).ToList();
            var solarList       = metrics.Select(m => m.Solar.DivideByThousand()).ToList();
            var redeliveryList  = metrics.Select(m => m.Redelivery.DivideByThousand()).ToList();
            var gasList         = metrics.Select(m => m.Gas.DivideByThousand()).ToList();
            var usageCosts      = metrics.Select(m => m.UsageCost).ToList();
            var intakeCosts     = metrics.Select(m => m.IntakeCost).ToList();
            var redeliveryCosts = metrics.Select(m => m.RedeliveryCost).ToList();
            var gasCosts        = metrics.Select(m => m.GasCost).ToList();

            var lastDateTime = metrics
                               .OrderBy(m => m.DateTime)
                               .Select(m => m.DateTime)
                               .LastOrDefault();

            lastDateTime = lastDateTime.ConvertToUtc(settings.TimeZoneId);

            return(Ok(new
            {
                QueryTimestamp = lastDateTime.AddSeconds(1).ToString("o"),
                Timestamps = timestamps,
                Usage = usageList,
                Solar = solarList,
                Redelivery = redeliveryList,
                Intake = intakeList,
                Gas = gasList,
                UsageCosts = usageCosts,
                IntakeCosts = intakeCosts,
                RedeliveryCosts = redeliveryCosts,
                GasCosts = gasCosts
            }));
        }
コード例 #29
0
 public ToJsonButtonCommand(IBotClient botClient, IMetricRepository metricRepository, ISourceRepository sourceRepository)
 {
     _botClient        = botClient;
     _metricRepository = metricRepository;
     _sourceRepository = sourceRepository;
 }
コード例 #30
0
ファイル: MetricEngine.cs プロジェクト: acsgn/UserAnalytics
 public MetricEngine(IMetricRepository metricRepository)
 {
     _MetricRepository = metricRepository;
 }
コード例 #31
0
 public MetricService(IMetricRepository metricRepository, IDatasourceRepository datasourceRepository)
 {
     this._metricRepository     = metricRepository;
     this._datasourceRepository = datasourceRepository;
 }
コード例 #32
0
 public MetricService()
 {
     _metricRepository = new MetricRepository(new MetricityContext());
 }
コード例 #33
0
ファイル: MetricService.cs プロジェクト: RetinaInc/SocialGoal
 public MetricService(IMetricRepository metricRepository, IUnitOfWork unitOfWork)
 {
     this.metricRepository = metricRepository;
     this.unitOfWork = unitOfWork;
 }