public void GetHtml(HttpContext context) { string baseDirectory = AppDomain.CurrentDomain.BaseDirectory + "ConfigNoticeXML.xml"; xmlOpe = XElement.Load(baseDirectory); WorkerCurrentPage = int.Parse(xmlOpe.Element("WorkerCurrentPage").Value); OpeTime = xmlOpe.Element("OpeTime").Value; SetViewTime(); dts = PublicMethod.GetPlanNoticeNew(dtpBeginDate, dtpEndDate, OpeTime == "" ? "5" : OpeTime); //总记录数 dSum = dts.Rows.Count; countPage = GetPageCount(); //currentPage = 1; //首先判断数据库中的记录数是否大于每一屏显示的数 [email protected]; string tdRows = string.Empty; if (HttpContext.Current.Request["WorkerCurrentPage"] != null && HttpContext.Current.Request["WorkerCurrentPage"] != "") { tdRows = LoadWaitNurseOpe(Convert.ToInt32(HttpContext.Current.Request["WorkerCurrentPage"])); } JavaScriptSerializer jss = new JavaScriptSerializer(); message msg = new message(true, tdRows, countPage.ToString(), WorkerCurrentPage.ToString()); context.Response.Write(jss.Serialize(msg));//返回给前台页面 context.Response.End(); //} //catch (Exception exp) //{ // htmlbody = ""; // body = "<body style='margin:0 0; padding:0 0; background-color:#000;'>"; // body += "<script language='javascript'> setInterval(someFunction, 20000);function someFunction() {window.location.reload();}</script>"; // body += " <div style='position: absolute;top: 50%;left: 50%;width: 800px;height: 50px;margin-top: -25px; margin-left: -400px; background-color:#000;font: bold 48px/50px Verdana, Geneva, sans-serif; '>"; // body += "<marquee direction='left' scrollamount='5' style='font: bold 48px/50px Verdana, Geneva, sans-serif; color:#FF0000'>"; // body += exp.Message + " 与数据服务器连接中断,请稍候......</marquee></div></body>"; // htmlbody = body; // PublicMethod.WriteLog(exp); // JavaScriptSerializer jss = new JavaScriptSerializer(); // message msg = new message(false, htmlbody); // context.Response.Write(jss.Serialize(msg));//返回给前台页面 // context.Response.End(); //} }
public string GetHtml(HttpContext context) { //try //{ //设置显示信息的开始和结束时间 InitConfig(); SetViewTime(); currentPage = int.Parse(xmlOpe.Element("currentPage").Value); PatientNames = xmlOpe.Element("PatientName").Value; OpeTime = xmlOpe.Element("OpeTime").Value; DataTable dt = new DataTable(); dt = PublicMethod.GetPlanNoticeNew(_beginDate, _endDate, OpeTime == "" ? "5" : OpeTime); DataRow[] sqzb = dt.Select("Szstate = '0' and InRoomTime is not null and OperationBeginTime is null and OperationEndTime is null and OutRoomTime is null"); DataRow[] ssjxz = dt.Select("Szstate = '0' and InRoomTime is not null and OperationBeginTime is not null and OperationEndTime is null and OutRoomTime is null"); DataRow[] ssjxz1 = dt.Select("Szstate = '0' and InRoomTime is not null and OperationBeginTime is not null and OperationEndTime is not null and OutRoomTime is null"); DataRow[] shhf = dt.Select("InRoomTime is not null and OperationBeginTime is not null and OperationEndTime is not null and'" + DateTime.Now + "' < OutRoomTime"); DataRow[] lkssj = dt.Select("InRoomTime is not null and OperationBeginTime is not null and OperationEndTime is not null and '" + DateTime.Now + "' > OutRoomTime"); dts = dt.Clone(); foreach (DataRow row in sqzb) { dts.Rows.Add(row.ItemArray); } foreach (DataRow row in ssjxz) { dts.Rows.Add(row.ItemArray); } foreach (DataRow row in ssjxz1) { dts.Rows.Add(row.ItemArray); } foreach (DataRow row in shhf) { dts.Rows.Add(row.ItemArray); } foreach (DataRow row in lkssj) { dts.Rows.Add(row.ItemArray); } //总记录数 dSum = dts.Rows.Count; countPage = GetPageCount(); string tdRows = string.Empty; if (HttpContext.Current.Request["WorkerCurrentPage"] != null && HttpContext.Current.Request["WorkerCurrentPage"] != "") { LoadWaitNurseOpe(Convert.ToInt32(HttpContext.Current.Request["WorkerCurrentPage"])); } JavaScriptSerializer jss = new JavaScriptSerializer(); message msg = new message(true, body, countPage.ToString(), ""); context.Response.Write(jss.Serialize(msg));//返回给前台页面 context.Response.End(); //} //catch (Exception exp) //{ // body = " <div style='position: absolute;top: 50%;left: 50%;width: 800px;height: 50px;margin-top: -25px; margin-left: -400px; background-color:#000;font: bold 48px/50px Verdana, Geneva, sans-serif; '>"; // body += "<marquee direction='left' scrollamount='5' style='font: bold 48px/50px Verdana, Geneva, sans-serif; color:#FF0000'>"; // body += exp.Message + " 与数据服务器连接中断,请稍候......</marquee></div>"; // PublicMethod.WriteLog(exp); //} return(body); }