Esempio n. 1
0
        public ActionResult GetStatByChart(int TagId)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <TagDTO, TagVM>()
                .ForMember(t => t.Ads, p => p.Ignore());
                cfg.CreateMap <InfoReviewTagDTO, InfoReviewTagVM>();
            });
            var mapper = config.CreateMapper();
            var tag    = mapper.Map <TagDTO, TagVM>(tagService.GetTag(TagId));
            List <InfoReviewTagVM> ReviewTag = new List <InfoReviewTagVM>();

            ReviewTag = tag.InfoReviewTags.ToList();

            GetStatistics stat = new GetStatistics(ReviewTag);

            stat.ListStat();
            List <StatisticsForChart> statForChart = stat.ListStatForChart();

            if (statForChart != null)
            {
                return(PartialView(statForChart));
            }
            else
            {
                return(new EmptyResult());
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Service method responsible for handling HTTP Get verb of GetStatistics DTO request
        /// </summary>
        /// <param name="request">an object of GetStatistics DTO type</param>
        /// <returns>an object of GetStatisticsResponse DTO type</returns>
        public async Task <GetStatisticsResponse> Get(GetStatistics request)
        {
            var filteredSMSList = await _smsRepository.GroupByCountryDayAsync(
                DateTime.Parse(request.DateFrom),
                DateTime.Parse(request.DateTo),
                request.MccList);

            var statisticsResponses = new List <StatisticsResponse>();

            foreach (var item in filteredSMSList)
            {
                var itemCountry = await _countryRepository.GetByMobileCodeAsync(item.MobileCountryCode);

                statisticsResponses.Add(new StatisticsResponse
                {
                    Count       = item.Count,
                    Day         = item.SendDate.Date.ToString("yyyy-MM-dd"),
                    Mcc         = item.MobileCountryCode,
                    PricePerSMS = decimal.Parse(itemCountry.PricePerSMS.ToString().TrimEnd('0').TrimEnd('.')),
                    TotalPrice  = decimal.Parse((item.Count * itemCountry.PricePerSMS).ToString().TrimEnd('0').TrimEnd('.'))
                });
            }

            return(new GetStatisticsResponse {
                Items = statisticsResponses
            });
        }
Esempio n. 3
0
        public JsonResult GetReviewByTag(int TagId)
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <TagDTO, TagVM>()
                .ForMember(t => t.Ads, p => p.Ignore());
                cfg.CreateMap <InfoReviewTagDTO, InfoReviewTagVM>();
            });
            var mapper = config.CreateMapper();
            var tag    = mapper.Map <TagDTO, TagVM>(tagService.GetTag(TagId));
            List <InfoReviewTagVM> ReviewTag = new List <InfoReviewTagVM>();

            ReviewTag = tag.InfoReviewTags.ToList();

            GetStatistics     stat     = new GetStatistics(ReviewTag);
            List <Statistics> statList = stat.ListStat();

            return(Json(statList, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
File: router.cs Progetto: berak/cs
 /// <remarks/>
 public void GetStatisticsAsync(GetStatistics GetStatistics1, object userState)
 {
     if ((this.GetStatisticsOperationCompleted == null)) {
         this.GetStatisticsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetStatisticsOperationCompleted);
     }
     this.InvokeAsync("GetStatistics", new object[] {
                 GetStatistics1}, this.GetStatisticsOperationCompleted, userState);
 }
Esempio n. 5
0
File: router.cs Progetto: berak/cs
 /// <remarks/>
 public void GetStatisticsAsync(GetStatistics GetStatistics1)
 {
     this.GetStatisticsAsync(GetStatistics1, null);
 }
Esempio n. 6
0
File: router.cs Progetto: berak/cs
 /// <remarks/>
 public System.IAsyncResult BeginGetStatistics(GetStatistics GetStatistics1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("GetStatistics", new object[] {
                 GetStatistics1}, callback, asyncState);
 }
Esempio n. 7
0
        public async Task <List <Statistics> > Handle(GetStatistics request, CancellationToken cancellationToken)
        {
            var fields = await this.context.Statistics.OrderBy(h => h.City).ToListAsync();

            return(fields);
        }