private void BindData(int pageIndex) { int type = ConvertHelper.ToInt32(CountType.Text); string startDate = textTimeStart.Text; string endDate = textTimeEnd.Text; if (pageIndex <= 0) { pageIndex = 1; } if (string.IsNullOrEmpty(startDate)) { startDate = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"); textTimeStart.Text = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"); } if (string.IsNullOrEmpty(endDate)) { endDate = DateTime.Now.ToString("yyyy-MM-dd"); textTimeEnd.Text = DateTime.Now.ToString("yyyy-MM-dd"); } int recordCount = 0; T_User_MXZ_History dataAccess = new T_User_MXZ_History(); int totalPersonCount = 0; int totalCoinCount = 0; DataTable dt = dataAccess.GetMXZOrderCountTable(pageIndex, 10, type, startDate, endDate, ref totalPersonCount, ref totalCoinCount, ref recordCount); AspNetPager1.CurrentPageIndex = pageIndex; AspNetPager1.RecordCount = recordCount; AspNetPager1.DataBind(); }
/// <summary> /// 导出梦想钻日统计数据 /// </summary> /// <param name="context"></param> private void ExportMXZCountTable(HttpContext context) { int type = ConvertHelper.ToInt32(context.Request["type"]); string startDate = context.Request["startDate"]; T_User_MXZ_History dataAccess = new T_User_MXZ_History(); string endDate = context.Request["endDate"]; DataTable dt = dataAccess.GetMXZOrderCountTable(type, startDate, endDate); BasePage.ExcelHelper helper = new BasePage.ExcelHelper(); helper.ExportDataGridToCSV(dt, "梦想钻统计记录" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")); }
/// <summary> /// 获取梦想钻统计分页数据 /// </summary> /// <param name="context"></param> private void GetMXZCountTable(HttpContext context) { int type = ConvertHelper.ToInt32(context.Request["type"]); string startDate = context.Request["startDate"]; string endDate = context.Request["endDate"]; int pageIndex = ConvertHelper.ToInt32(context.Request["pageIndex"]); if (pageIndex <= 0) { pageIndex = 1; } int pageSize = ConvertHelper.ToInt32(context.Request["pageSize"]); if (pageSize <= 0) { pageSize = 10; } if (string.IsNullOrEmpty(startDate)) { startDate = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd"); } if (string.IsNullOrEmpty(endDate)) { endDate = DateTime.Now.ToString("yyyy-MM-dd"); } int recordCount = 0; T_User_MXZ_History dataAccess = new T_User_MXZ_History(); int totalCoinCount = 0; int totalPersonCount = 0; DataTable dt = dataAccess.GetMXZOrderCountTable(pageIndex, pageSize, type, startDate, endDate, ref totalPersonCount, ref totalCoinCount, ref recordCount); ResponseMxzCountModel result = new ResponseMxzCountModel(); result.totalPersonCount = totalPersonCount; result.totalCoinCount = totalCoinCount; result.list = dt; result.recordCount = recordCount; string strResult = JsonConvert.SerializeObject(result); context.Response.Write(strResult); }