示例#1
0
        /// <summary>
        /// 获取图书下载统计
        /// </summary>
        /// <returns></returns>
        public void GetBookDownloadCountData(HttpContext context)
        {
            int    pageIndex = ConvertHelper.ToInt32(context.Request["pageIndex"]);
            int    pageSize  = ConvertHelper.ToInt32(context.Request["pageSize"]);
            int    pressId   = ConvertHelper.ToInt32(context.Request["pressId"]);
            string bookGuid  = context.Request["bookGuid"];
            string startDate = context.Request["startDate"];
            string endDate   = context.Request["endDate"];

            if (string.IsNullOrEmpty(startDate))
            {
                startDate = DateTime.Now.AddDays(-7).ToShortDateString();
            }
            if (string.IsNullOrEmpty(endDate))
            {
                endDate = DateTime.Now.ToShortDateString();
            }
            int recordCount        = 0;
            int totalDownLoadCount = 0;
            int totalPersonCount   = 0;

            BookCountAccess data = new BookCountAccess();
            DataTable       dt   = data.GetBookDownloadCountData(pageIndex, pageSize, pressId, bookGuid, startDate, endDate, new BasePage.BasePage().userId, ref recordCount, ref totalDownLoadCount, ref totalPersonCount);

            ResponseBookDownloadModel result = new ResponseBookDownloadModel();

            result.list               = dt;
            result.recordCount        = recordCount;
            result.totalDownLoadCount = totalDownLoadCount;
            result.totalPersonCount   = totalPersonCount;

            string strResult = JsonConvert.SerializeObject(result);

            context.Response.Write(strResult);
        }
        private void BindData(int pageIndex)
        {
            int    pressID   = ConvertHelper.ToInt32(hidPressID.Value);
            string bookGuID  = txtBookGuidLink.Value;
            string timestart = textTimeStart.Text;
            string timeend   = textTimeEnd.Text;

            if (string.IsNullOrEmpty(timestart))
            {
                timestart          = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
                textTimeStart.Text = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd");
            }
            if (string.IsNullOrEmpty(timeend))
            {
                timeend          = DateTime.Now.ToString("yyyy-MM-dd");
                textTimeEnd.Text = DateTime.Now.ToString("yyyy-MM-dd");
            }
            if (pageIndex <= 0)
            {
                pageIndex = 1;
            }
            int             recordCount        = 0;
            int             totalDownLoadCount = 0;
            int             totalPersonCount   = 0;
            BookCountAccess data = new BookCountAccess();
            DataTable       dt   = data.GetBookDownloadCountData(pageIndex, 10, pressID, bookGuID, timestart, timeend, userId, ref recordCount, ref totalDownLoadCount, ref totalPersonCount);

            num.Value = recordCount.ToString();
            AspNetPager1.CurrentPageIndex = pageIndex;
            AspNetPager1.RecordCount      = recordCount;
            AspNetPager1.DataBind();
        }