/// <summary> /// 获取图书阅读分析统计的导出数据 /// </summary> /// <returns></returns> public void GetBookReadExportData(HttpContext context) { int pressId = ConvertHelper.ToInt32(context.Request["pressId"]); int type = ConvertHelper.ToInt32(context.Request["type"]); 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(); } BookCountAccess data = new BookCountAccess(); DataTable dt = data.GetBookReadExportData(type, pressId, bookGuid, startDate, endDate, new BasePage.BasePage().userId); BasePage.ExcelHelper helper = new BasePage.ExcelHelper(); if (type == 0) { helper.ExportDataGridToCSV(dt, "图书阅读统计" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")); } else { helper.ExportDataGridToCSV(dt, "系列阅读统计" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")); } }
/// <summary> /// 获取图书内容统计 /// </summary> /// <returns></returns> public void GetBookContentCountData(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(); DataTable dt = data.GetBookContentCountData(pageIndex, pageSize, pressId, bookGuid, startDate, endDate, new BasePage.BasePage().userId, ref recordCount); BaseResponse result = new BaseResponse(); result.list = dt; result.recordCount = recordCount; 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; int serialId = ConvertHelper.ToInt32(bookType.SelectedValue); 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 totalPersonCount = 0; long totalTimeLength = 0; int totalReadCount = 0; BookCountAccess data = new BookCountAccess(); DataTable dt = data.GetBookReadCountData(pageIndex, 10, serialId, pressID, bookGuID, timestart, timeend, userId, ref recordCount, ref totalPersonCount, ref totalTimeLength, ref totalReadCount); num.Value = recordCount.ToString(); AspNetPager1.CurrentPageIndex = pageIndex; AspNetPager1.RecordCount = recordCount; AspNetPager1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { string bookGuid = Request["bookGuid"]; string startDate = Request["startDate"]; string endDate = Request["endDate"]; BookCountAccess data = new BookCountAccess(); DataTable dt = data.GetBookReadCount_Detail(bookGuid, startDate, endDate); repData.DataSource = dt; repData.DataBind(); }
/// <summary> /// 获取图书阅读统计导出信息 /// </summary> /// <param name="context"></param> public void GetBookReadExportCount(HttpContext context) { int pressId = ConvertHelper.ToInt32(context.Request["pressId"]); //出版社ID int bookType = ConvertHelper.ToInt32(context.Request["bookType"]); //0图书,1系列 string bookGuid = context.Request["bookGuid"]; //图书GUID DateTime timeStart = ConvertHelper.ToDateTime(context.Request["timeStart"]); //开始时间 DateTime timeEnd = ConvertHelper.ToDateTime(context.Request["timeEnd"]); //结束时间 BookCountAccess data = new BookCountAccess(); DataTable dt = data.GetBookReadCountData_Export(bookType, pressId, bookGuid, timeStart.ToShortDateString(), timeEnd.ToShortDateString(), new BasePage.BasePage().userId); BasePage.ExcelHelper helper = new BasePage.ExcelHelper(); if (bookType == 0) { helper.ExportDataGridToCSV(dt, "图书阅读统计" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")); } else { helper.ExportDataGridToCSV(dt, "系列阅读统计" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")); } }
/// <summary> /// 明细导出 /// </summary> /// <param name="context"></param> /// <returns></returns> public void GetBookReadCount_Detail(HttpContext context) { 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(); } BookCountAccess data = new BookCountAccess(); DataTable dt = data.GetBookReadCount_Detail(bookGuid, startDate, endDate); BasePage.ExcelHelper helper = new BasePage.ExcelHelper(); helper.ExportDataGridToCSV(dt, "图书热点明细统计" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")); }
/// <summary> /// 获取图书阅读分析统计 /// </summary> /// <returns></returns> public void GetBookReadCountData(HttpContext context) { int pageIndex = ConvertHelper.ToInt32(context.Request["pageIndex"]); int pageSize = ConvertHelper.ToInt32(context.Request["pageSize"]); int pressId = ConvertHelper.ToInt32(context.Request["pressId"]); int type = ConvertHelper.ToInt32(context.Request["type"]); 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 totalPersonCount = 0; long totalTimeLength = 0; int totalReadCount = 0; BookCountAccess data = new BookCountAccess(); DataTable dt = data.GetBookReadCountData(pageIndex, pageSize, type, pressId, bookGuid, startDate, endDate, new BasePage.BasePage().userId, ref recordCount, ref totalPersonCount, ref totalTimeLength, ref totalReadCount); ResponseBookReadCountModel result = new ResponseBookReadCountModel(); result.list = dt; result.recordCount = recordCount; result.avgTimeLength = totalReadCount == 0 ? 0 : (int)(totalTimeLength / totalReadCount); result.totalPersonCount = totalPersonCount; result.totalReadCount = totalReadCount; string strResult = JsonConvert.SerializeObject(result); context.Response.Write(strResult); }