//导出数据 protected void Button1_Click(object sender, EventArgs e) { string packnum1 = packnum.Value; string StartTime1 = StartTime.Value; string EndTime1 = EndTime.Value; if (packnum1 == "") { packnum1 = "0"; } if (StartTime1 == "") { StartTime1 = "0"; } if (EndTime1 == "") { EndTime1 = "0"; } TeModel tm = new TeModel(); // result.table = tm.findtisanemachineInfo(Convert.ToInt32(tisanenum), StartTime, EndTime); DataTable dt = tm.findpackmachineInfo(Convert.ToInt32(packnum1), StartTime1, EndTime1); System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; string now = currentTime.ToString("yyyyMMdd"); CreateExcel(dt, "application/ms-excel", "包装机工作量统计" + now); }
//提供数据的方法 public dotNetFlexGrid.DataHandlerResult DotNetFlexGrid3DataHandler(dotNetFlexGrid.DataHandlerParams p) { dotNetFlexGrid.DataHandlerResult result = new dotNetFlexGrid.DataHandlerResult(); result.page = p.page; //设定当前返回的页号 result.total = 100; //总计的数据条数,此处用100进行模拟,查询和筛选时需要根据实际 result.table = dotNetFlexGrid.DemoMemoryTable(p.page * 100, p.rp); string packnum = "0"; if (p.extParam.ContainsKey("packnum")) { packnum = p.extParam["packnum"]; } if (packnum == "") { packnum = "0"; } string StartTime = "0"; if (p.extParam.ContainsKey("StartTime")) { StartTime = p.extParam["StartTime"]; } if (StartTime == "") { StartTime = "0"; } string EndTime = "0"; if (p.extParam.ContainsKey("EndTime")) { EndTime = p.extParam["EndTime"]; } if (EndTime == "") { EndTime = "0"; } TeModel tm = new TeModel(); // result.table = tm.findtisanemachineInfo(Convert.ToInt32(tisanenum), StartTime, EndTime); result.table = tm.findpackmachineInfo(Convert.ToInt32(packnum), StartTime, EndTime); return(result); }