public async Task <PageSummaryReport> GetPageReportSummary(PageReportQuery query)
        {
            var sql = "msp_Report_Page_ByDate";

            using (var ccn = _connectionFactory.GetConnection)
            {
                var list = await SqlMapper.QueryAsync <PageSummaryReport>(ccn, sql, new { query.PageId, query.UserId, query.IsMobile, query.FromDate, query.ToDate }, commandType : CommandType.StoredProcedure);

                return(list.FirstOrDefault());
            }
        }
        public async Task <List <PageViewType> > GetPageReportReferer(PageReportQuery query)
        {
            var sql = "msp_Report_Page_TrafficReferer";

            using (var ccn = _connectionFactory.GetConnection)
            {
                var list = await SqlMapper.QueryAsync <PageViewType>(ccn, sql, new { query.PageId, query.IsMobile, query.FromDate, query.ToDate }, commandType : CommandType.StoredProcedure);

                return(list.ToList());
            }
        }
        public async Task <List <PageSummaryDaily> > GetPageReportDaily(PageReportQuery query)
        {
            var sql = "msp_Report_Page_Daily";

            using (var ccn = _connectionFactory.GetConnection)
            {
                var list = await SqlMapper.QueryAsync <PageSummaryDaily>(ccn, sql, new { query.PageId, query.IsMobile, query.FromDate, query.ToDate }, commandType : CommandType.StoredProcedure);

                _connectionFactory.Dispose();
                return(list.ToList());
            }
        }
예제 #4
0
        public async Task <IHttpActionResult> GetPageReportTrafficChannel(PageReportQuery query)
        {
            try
            {
                var res = await _uow.PunnelTracking.GetPageReportChannel(query);

                return(Ok(res));
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                return(Ok(false));
            }
        }
예제 #5
0
        public async Task <IHttpActionResult> GetPageReportSummary(PageReportQuery query)
        {
            try
            {
                if (query.Range == "today")
                {
                    query.FromDate = DateTime.Today;
                    query.ToDate   = DateTime.Today;
                }
                else if (query.Range == "yesterday")
                {
                    query.FromDate = DateTime.Today.AddDays(-1);
                    query.ToDate   = DateTime.Today.AddDays(-1);
                }
                else if (query.Range == "thisweek")
                {
                    var range = DateTimeUtils.ThisWeek(DateTime.Today);
                    query.FromDate = range.Start;
                    query.ToDate   = range.End;
                }
                else if (query.Range == "thismonth")
                {
                    var range = DateTimeUtils.ThisMonth(DateTime.Today);
                    query.FromDate = range.Start;
                    query.ToDate   = range.End;
                }
                else
                {
                    query.FromDate = DateTime.Today;
                    query.ToDate   = DateTime.Today;
                }
                //get all mobile + desktop
                query.IsMobile = null;
                query.UserId   = this.CurrentUserId;
                var res = await _uow.PunnelTracking.GetPageReportSummary(query);

                return(Ok(res));
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                return(Ok(false));
            }
        }