public string GetClassInfo() { DataTable dt = Production_Report_BLL.GetClassInfo(); string json = JSONTools.DataTableToJson(dt); return(json); }
public string GetList(HttpContext context) { string StartTime = context.Request["start_time"]; string EndTime = context.Request["end_time"]; string clnameid = context.Request["clnameid"]; int PageSize = Convert.ToInt32(context.Request["rows"]); int PageIndex = Convert.ToInt32(context.Request["page"]); StringBuilder commandText = new StringBuilder(); string where = ""; if (!string.IsNullOrWhiteSpace(clnameid)) { where += " and cl_name like'%" + clnameid + "%' "; if (!string.IsNullOrWhiteSpace(StartTime)) { StartTime = StartTime.Substring(0, 10); where += " and product_date>='" + StartTime + "'"; string endtime = Convert.ToDateTime(StartTime).AddDays(1).ToString(); where += " and product_date<='" + endtime.Substring(0, 10) + "'"; } } else { if (!string.IsNullOrWhiteSpace(StartTime)) { where += " and product_date>='" + StartTime + "'"; } if (!string.IsNullOrWhiteSpace(EndTime)) { where += " and product_date<='" + EndTime + "'"; } } string sort = RequstString("sidx"); //排序名称 string order = RequstString("sord"); //排序方式 DataListModel <Production_Model> userList = Production_Report_BLL.GetList(PageIndex, PageSize, sort, order, where); string json = JSONTools.ScriptSerialize <DataListModel <Production_Model> >(userList); return(json); }
public string GetListNew(HttpContext context) { string StartTime = context.Request["start_time"]; string EndTime = context.Request["end_time"]; if (string.IsNullOrEmpty(StartTime)) { DateTime t = DateTime.Now; StartTime = t.AddDays(-1).ToString("yyyy-MM-dd hh:mm:ss"); } if (string.IsNullOrEmpty(EndTime)) { DateTime t = DateTime.Now; EndTime = t.ToString("yyyy-MM-dd hh:mm:ss"); } string clid = context.Request["clnameid"]; int clnameid = 0; if (string.IsNullOrEmpty(clid)) { clnameid = 0; } else { clnameid = Convert.ToInt32(clid); } string clname = context.Request["clname"]; int PageSize = Convert.ToInt32(context.Request["rows"]); int PageIndex = Convert.ToInt32(context.Request["page"]); string sort = RequstString("sidx"); //排序名称 string order = RequstString("sord"); //排序方式 DataListModel <Production_Model> userList = Production_Report_BLL.GetListNew(StartTime, EndTime, clnameid, clname, PageIndex, PageSize); string json = JSONTools.ScriptSerialize <DataListModel <Production_Model> >(userList); return(json); }
public void Print(HttpContext context) { string StartTime = context.Request["start_time"]; string EndTime = context.Request["end_time"]; if (string.IsNullOrEmpty(StartTime)) { DateTime t = DateTime.Now; StartTime = t.AddDays(-1).ToString("yyyy-MM-dd hh:mm:ss"); } if (string.IsNullOrEmpty(EndTime)) { DateTime t = DateTime.Now; EndTime = t.ToString("yyyy-MM-dd hh:mm:ss"); } string clid = context.Request["clnameid"]; int clnameid = 0; if (string.IsNullOrEmpty(clid)) { clnameid = 0; } else { clnameid = Convert.ToInt32(clid); } string clname = context.Request["clname"]; int PageSize = Convert.ToInt32(context.Request["rows"]); int PageIndex = Convert.ToInt32(context.Request["page"]); string sidx = RequstString("sidx"); //排序名称 string sort = RequstString("sord"); //排序方式 if ("-1" == sort) { sort = "id"; } if ("-1" == order) { order = "asc"; } string json = ""; string fileName = HttpContext.Current.Request.MapPath("~/App_Data/生产报表.xlsx"); try { int StartIndex = 1; int EndIndex = -1; int totalcount = 0; DataTable resTable = Production_Report_BLL.getTable(StartTime, EndTime, clnameid, clname, StartIndex, EndIndex, out totalcount); string title = " 生产报表 - 班次(小时)"; string html = DataHelper.ExportDatatableToHtml(resTable, title); string ss = "true"; json = "{\"Result\":\"" + ss + "\"," + "\"Html\":\"" + html + "\"}"; } catch (Exception e) { string ss1 = "false"; json = "{\"Result\":\"" + ss1 + "\"}"; } context.Response.ContentType = "json"; context.Response.Write(json); }