<%@ WebHandler Language="C#" Class="DataShow" %> using System; using System.Collections.Generic; using System.Web; using System.Data; using System.Data.Common; using System.Web.SessionState; using System.Text; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using eMIS; public class DataShow : IHttpHandler , IRequiresSessionState { private int fixedcolumns=0; private int displaySubprogramCount = 0; private int openSubprogramCount = 0; private int subProgramCount = 0; private string joinCellJs = ""; private int headMaxRow = 0; private int headMaxCel = 0; public void ProcessRequest (HttpContext context) { //context.Response.Redirect("ListGroup.ashx"); string ver = "2020290"; if (context.Session["userid"] == null) { LoginManager lm = new LoginManager(context); if (!lm.VerifyIdentity()) { context.Response.Write("会话丢失,请重新登陆!"); context.Response.End(); } } string wwwroot = context.Request.ApplicationPath; string menuId = context.Request.QueryString["proid"]==null?"":context.Request.QueryString["proid"].ToString(); string menups = menuId; string userId = context.Session["userid"].ToString(); string stateKey = ""; if (!DataManager.IsNumber(menuId)) { menuId = DataManager.Decrypt(menuId); stateKey = StringHelper.GetRightString(menuId); menuId = StringHelper.GetLeftString(menuId); } PageIdManager pim = new PageIdManager(); string instanceId = null; if (context.Request.QueryString["id"] != null) { pim.Init(context.Request.QueryString["id"].ToString()); menuId = pim.MenuID; instanceId = pim.Key; } string userAgent = context.Request.UserAgent.ToLower(); bool isMobile=false; if (userAgent.Contains("android") || userAgent.Contains("iphone") || userAgent.Contains("ipad")) isMobile = true; if (wwwroot == "/") wwwroot = ""; string ip = "";// HttpContext.Current.Request.UserHostAddress; string url_dt = DateTime.Now.Ticks.ToString(); string rand = DataManager.GetToken(userId,url_dt,ip); string ThemePath = wwwroot + "/Themes/" + context.Session["theme"].ToString(); string buttonGroupId = (context.Request.QueryString["bgid"] == null ? "" : context.Request.QueryString["bgid"].ToString()); DataManager sysData = new DataManager(); sysData.Operator.OpenConnection(); InstanceManager instManager = new InstanceManager(context,sysData,menuId); instManager.StateKey = stateKey; /* if (context.Session["userid"].ToString() == "400002") { context.Response.Write(instManager.GetStateValue("dc")); context.Response.End(); } */ instManager.InstanceId = instanceId; string programId = instManager.ProgramID; ProgramManager pm = instManager.Program; DataTable listElements = pm.ListElements; DataRow businessDataRow = null; JObject json = JsonConvert.DeserializeObject("{" + pm.Properties["json"].ToString() + "}"); JObject jsoncfg = (JObject)json["list"]; TagManager tagManger = new TagManager(); tagManger.Context = context; subProgramCount = pm.Subprograms.Rows.Count; int i,l,j,k,ii; string s,s2,s3,web,param,s4; string tjfs; string[] arr_temp; string[] arr_temp1; string url="", xml, str_bg, elementType; string primaryKeyValue; string primaryKey, foreignKey, relationDesc, relationCondition; DataTable listDataTable; string systemName = DataManager.GetSystemName(); string str1 = "", str, pagec="", reltype; int colspan; string subPrimaryKeyValue; DataTable dt1 = null; bool isExistDownload = false; bool first,last,b1; HttpCookie cookie = context.Request.Cookies.Get("ps" + menuId); int PageSize; if (cookie == null) { PageSize = instManager.PageSize; } else { PageSize= int.Parse(cookie.Value); instManager.PageSize = PageSize; } cookie = context.Request.Cookies.Get("pk" + menuId); string spk = ""; if (cookie != null) { spk = ","+cookie.Value.Replace("%2C", ",")+","; } string mini = (context.Request.QueryString["mini"]==null ? instManager.GetStateValue("mini") : context.Request.QueryString["mini"].ToString()); if (context.Request.QueryString["qcond"] != null) { s = context.Request.QueryString["qcond"].ToString(); s =DataManager.SqlDecode(s); instManager.AllowSaveState = true; instManager.QueryCondition = s; } if (context.Request.QueryString["dcond"] != null) { s = context.Request.QueryString["dcond"].ToString(); s = DataManager.SqlDecode(s); instManager.DefaultCondition = s; } if (context.Request.QueryString["dcond2"] != null) { s = context.Request.QueryString["dcond2"].ToString(); s = DataManager.SqlDecode(s); instManager.DefaultCondition2 = s; } string pageTitle = pm.Properties["bt"].ToString(); if (instManager.FlowNode != "") { //pageTitle += "-" + instManager.Flow.GetNodeProperty(instManager.Flow.CurrentNodeID, "jdmc"); } if (context.Request.QueryString["var"] != null) { instManager.SetStateValue("vr", context.Request.QueryString["var"].ToString()); } if (context.Request.QueryString["cpara"] != null) { s = context.Request.QueryString["cpara"].ToString(); s = DataManager.UrlDecode(s); instManager.SetStateValue("vr",s ); } string gstat = "",gstatf=""; if (context.Request.QueryString["gstat"] != null) { gstat = DataManager.UrlDecode( context.Request.QueryString["gstat"].ToString()); gstatf = context.Request.QueryString["gstatf"].ToString(); instManager.SetStateValue("gs", gstat); instManager.SetStateValue("gsf", gstatf); } else { gstat = instManager.GetStateValue("gs"); gstatf = instManager.GetStateValue("gsf"); } string sessionVar = instManager.GetStateValue("vr"); if (buttonGroupId != "") { instManager.ButtonGroupID = buttonGroupId; } //if (context.Session["usercnname"].ToString() == "管理员") //{ // context.Response.Write(instManager.ListSqlWhere); // context.Response.End(); //} string programJson = pm.Properties["json"].ToString(); ProgramJson progJson =Newtonsoft.Json.JsonConvert.DeserializeObject("{"+programJson+"}"); StringBuilder sb = new StringBuilder(); s = instManager.SqlOrder; string sortColumn = ""; string sortOrder = ""; if (s != "") { //s = s.Replace(",", " "); //arr_temp = s.Split(' '); //sortColumn = arr_temp[0]; //sortOrder = arr_temp[1]; } //sb.Append(instManager.GetListSqlWhere()); /* if (context.Session["superman"].ToString() == "1") { context.Response.Write(instManager.DefaultCondition + "

"); context.Response.Write(instManager.ListSqlWhere); context.Response.End(); } */ sb.AppendLine(""); sb.AppendLine(""); string DZDYYM = pm.Properties["DZDYYM"].ToString(); sb.Append(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine("" + pageTitle + " - 列表"); sb.AppendLine(""); sb.AppendLine(""); sb.AppendLine(""); // string pageHeight = "0"; pageHeight = "30"; //sb.Append("
"+pageTitle+"
"); s = StringHelper.GetParamValue(sessionVar, "objlist"); if (s != "") { arr_temp = s.Split(','); BusinessObjectManager bom = new BusinessObjectManager(instManager.SystemDataManager); for (i = 0; i < arr_temp.Length; i++) { bom.MenuID = null; bom.ObjectID = arr_temp[i]; if(bom.MenuID!=menuId) sb.Append("  "); } } else { //sb.Append(" "); } //sb.Append(""); //sb.Append(pagec); if (buttonGroupId == "") buttonGroupId = instManager.ButtonGroupID; //context.Response.Write(buttonGroupId); //context.Response.End(); if (buttonGroupId != "") { //tempStr = ""; //tempStr += (mini==""?"":"")+"
"+pagec+"共" + instManager.RecordCount.ToString() + "条 " + instManager.CurrentPage + "/" + instManager.PageCount + "页转到
"; ToolBar2 toolbar = new ToolBar2(sysData); sb.Append("
"); s = progJson.rowEdit ? "134" : "112"; if(isMobile) sb.Append("
"); else sb.Append("
"); sb.Append(toolbar.GetHtml(buttonGroupId, "查询", "", wwwroot,instManager.MenuID,userId)); sb.Append("
"); //
sb.Append(""); if (!isMobile) { sb.Append("
"); sb.Append("
"); sb.Append("
"); sb.Append("
"); if(progJson.rowEdit) sb.Append("
"); sb.Append("
"); sb.Append("
"); } sb.Append("
"); sb.Append("
"); } // string html; //列表快捷查询 DataRow[] rows = listElements.Select("LBKJCX=1"); ValueTagManager tag = new ValueTagManager(instManager); ControlManager cm = new ControlManager(instManager); cm.PageType = 1; l = rows.Length; DataRow busRow = null; string controlIdList = ""; string list_ls_eles="[{}"; string cookieName; if (instManager.ParentID != "") cookieName = "ls_hidd2"; else cookieName = "ls_hidd"; cookie = context.Request.Cookies.Get(cookieName); string ls_hidd = cookie==null?"1":cookie.Value; sb.Append(""); sb.Append("
查询条件 
"); sb.Append("
"); s = StringHelper.ConvertToJson(instManager.GetStateValue("lqv")); list_ls_eles += "]"; sb.Append(""); sb.Append("
"); // sb.Append("
"); //div_content sb.Append("
"); if (isMobile) { sb.Append("
"); sb.Append("
"); sb.Append("
每页显示
"); sb.Append("
"); sb.Append("
"); sb.Append("
"); sb.Append("
"); sb.Append("
"); sb.Append("
"); } else { sb.Append("
每页显示
"); sb.Append("
"); sb.Append("
"); sb.Append("
"); sb.Append("
"); sb.Append("
"); } sb.Append("
"); // sb.Append(""); sb.Append(""); sb.Append(""); sb.Append(""); sysData.Operator.CloseConnection(); context.Response.Write(sb.ToString()); } public bool IsReusable { get { return false; } } }