Exemple #1
0
        internal byte[] HandleStatistics(string json)
        {
            GetStatisticsRequest res = JsonConvert.DeserializeObject <GetStatisticsRequest>(json);
            Statistic_View       ans = userService.GetStatistics(res.username, res.startTime, res.endTime);
            string jsonAns           = Seralize(new NotifyStatisticsData(ans));

            return(security.Encrypt(jsonAns));
        }
Exemple #2
0
        public void Setup()
        {
            _mockStatisticsRepository = new Mock <IStatisticsRepository>();
            _handler = new GetStatisticsQueryHandler(_mockStatisticsRepository.Object);

            var dataFixture = new Fixture();

            _fakeRepositoryStatistics = dataFixture.Build <Statistics>().Create();

            _exampleValidRequest = new GetStatisticsRequest();
        }
        public async Task <GetStatisticsResponse> GetStatiststics(GetStatisticsRequest dto)
        {
            string                  query     = string.Empty;
            List <dynamic>          result    = new List <dynamic>();
            List <StatisticItemDto> statItems = new List <StatisticItemDto>();

            bool filterByMcc = dto.MccList?.Any() ?? false;

            string queryNoMccFilter = $@"SELECT count(s.id) as Count, date(s.created) as Day, c.mcc as Mcc, sum(c.pricePerSms) as TotalPrice, c.PricePerSms
                                        FROM app2sms.Sms s
                                        INNER JOIN app2sms.Country c on c.id = s.countryId
                                        where date(s.created) >= @dateFrom and date(s.created) <= @dateTo
                                        group by c.mcc, date(s.created)";

            string queryAllFilters = @"SELECT count(s.id) as Count, date(s.created) as Day, c.mcc as Mcc, sum(c.pricePerSms) as TotalPrice, c.PricePerSms
                                       FROM app2sms.Sms s
                                       INNER JOIN app2sms.Country c on c.id = s.countryId
                                       where date(s.created) >= @dateFrom and date(s.created) <= @dateTo
                                       and c.mcc in (@MccList)
                                       group by c.mcc, date(s.created)";

            query = filterByMcc ? queryAllFilters : queryNoMccFilter;

            using (var db = _dbFactory.OpenDbConnection())
            {
                result = await db.SelectAsync <dynamic>(query, new { dto.MccList, dto.DateFrom, dto.DateTo });
            }

            result.ForEach(row =>
            {
                StatisticItemDto item = ConvertExtensions.ConvertToStatDto(row);
                statItems.Add(item);
            });

            return(new GetStatisticsResponse()
            {
                StatisticsItems = statItems
            });
        }
Exemple #4
0
 /// <summary>
 ///  获取电子签章的数据统计信息
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public async Task <GetStatisticsResponse> GetStatistics(GetStatisticsRequest request)
 {
     return(await new GetStatisticsExecutor().Client(this).Execute <GetStatisticsResponse, GetStatisticsResult, GetStatisticsRequest>(request).ConfigureAwait(false));
 }
Exemple #5
0
 /// <summary>
 ///  获取电子签章的数据统计信息
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public GetStatisticsResponse GetStatistics(GetStatisticsRequest request)
 {
     return(new GetStatisticsExecutor().Client(this).Execute <GetStatisticsResponse, GetStatisticsResult, GetStatisticsRequest>(request));
 }
        async public Task SendStatisticsRequest(string username, DateTime?startDate, DateTime?endDate)
        {
            GetStatisticsRequest request = new GetStatisticsRequest(username, startDate, endDate);

            comm.SendRequest(request);
        }
 /// <remarks/>
 public void getStatisticsAsync(GetStatisticsRequest getStatistics1, object userState)
 {
     if ((this.getStatisticsOperationCompleted == null))
     {
         this.getStatisticsOperationCompleted = new System.Threading.SendOrPostCallback(this.OngetStatisticsOperationCompleted);
     }
     this.InvokeAsync("getStatistics", new object[] {
                 getStatistics1}, this.getStatisticsOperationCompleted, userState);
 }
 /// <remarks/>
 public void getStatisticsAsync(GetStatisticsRequest getStatistics1)
 {
     this.getStatisticsAsync(getStatistics1, null);
 }
 /// <remarks/>
 public System.IAsyncResult BegingetStatistics(GetStatisticsRequest getStatistics1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("getStatistics", new object[] {
                 getStatistics1}, callback, asyncState);
 }
 /// <summary>
 /// Get the statistics of a service since its creation
 /// </summary>
 /// <returns> GetStatisticsResponse object</returns>
 /// <param name="request"> GetStatisticsRequest object</param>
 /// <param name='jsonRpcCallId'>
 /// The json rpc call identifier. This is a string generated by the client, which can be used to correlate the response to the request. Max length is 256 characters. A JSON-RPC id must be generated on a per call invocation basis. The Rogerthat platform uses the id of the call to store the call result for a certain amount of time so that if something fails during the communication, the same call (having the same JSON-RPC id) can be resent to the Rogerthat service, allowing to fetch the result, without actually executing the call again. This avoids annoying problems such as duplicate delivery of messages.
 /// 
 /// You should use a different JSON-RPC id for every call you make.
 /// 
 /// In case of an intermittent failure such as a network connectivity problem, you can retry the same call using the same JSON-RPC id, without running the risk of duplicate execution of your call (e.g. duplicate message delivery).
 /// </param>
 public GetStatisticsResponse GetStatistics(GetStatisticsRequest request, string jsonRpcCallId)
 {
     GetStatisticsResponse result = new GetStatisticsResponse();
     WireRequest(0, jsonRpcCallId, "system.get_statistics", (writer) =>
         {
             request.Write(writer, false);
         }, (reader) =>
         {
             result.Read(reader);
         }
     );
     return result;
 }
 /// <summary>
 /// Get the statistics of a service since its creation
 /// </summary>
 /// <returns> GetStatisticsResponse object</returns>
 /// <param name="request"> GetStatisticsRequest object</param>
 public GetStatisticsResponse GetStatistics(GetStatisticsRequest request)
 {
     return GetStatistics(request, Guid.NewGuid().ToString());
 }
 public Task <GetStatisticsResponse> Any(GetStatisticsRequest request)
 {
     return(this._statisticService.GetStatiststics(request));
 }