Exemple #1
0
        /// <summary>
        /// 获取图书购买统计
        /// </summary>
        /// <returns></returns>
        public void GetBuyBookCountData(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;
            BookCountAccess data          = new BookCountAccess();
            int             totalMxzCount = 0; //总计梦想钻数量
            int             totalMxbCount = 0; //总计梦想币数量
            DataTable       dt            = data.GetBuyBookCountData(pageIndex, pageSize, pressId, bookGuid, startDate, endDate, new BasePage.BasePage().userId, ref recordCount, ref totalMxzCount, ref totalMxbCount);

            ResponseBookBuyCountModel result = new ResponseBookBuyCountModel();

            result.list          = dt;
            result.recordCount   = recordCount;
            result.totalMxbCount = totalMxbCount;
            result.totalMxzCount = totalMxzCount;
            string strJson = JsonConvert.SerializeObject(result);

            context.Response.Write(strJson);
        }
        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;
            BookCountAccess data          = new BookCountAccess();
            int             totalMxzCount = 0; //总计梦想钻数量
            int             totalMxbCount = 0; //总计梦想币数量
            DataTable       dt            = data.GetBuyBookCountData(pageIndex, 10, pressID, bookGuID, timestart, timeend, userId, ref recordCount, ref totalMxzCount, ref totalMxbCount);

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