<%@ WebHandler Language="C#" Class="DataShow" %> using System; using System.Collections.Generic; using System.Web; using System.Data; using System.Web.SessionState; using System.Text; using eMIS; public class DataShow : IHttpHandler , IRequiresSessionState { public void ProcessRequest (HttpContext context) { string menuId = context.Request.QueryString["pid"].ToString(); string userId = context.Session["userid"].ToString(); string wwwroot = context.Request.ApplicationPath; string ThemePath = wwwroot + "/Themes/" + context.Session["theme"].ToString(); DataManager sysData = new DataManager(); InstanceManager instManager = new InstanceManager(context,sysData,menuId); ProgramManager pm = instManager.Program; DataTable listElements = pm.ListElements; TagManager tagManger = new TagManager(); int elementsCount = listElements.Rows.Count; int subprogramCount = listElements.Rows.Count; int i,l,j,k; string s; string tjfs; string[] arr_temp; string[] arr_temp1; string url="", xml, str_bg, elementType; string primaryKeyValue; string primaryKey, foreignKey, relationDesc, relationCondition; DataTable table; string systemName = ""; string str1="",str, pagec; ; int colspan; if (context.Request.QueryString["strcondition"] !=null) instManager.DefaultCondition = context.Request.QueryString["strcondition"].ToString(); StringBuilder sb = new StringBuilder(); if (instManager.CurrentPage == 1) str = "disabled"; else str = "style='cursor:hand;'"; if (instManager.CurrentPage == instManager.PageCount) str1 = "disabled"; else str1 = "style='cursor:hand;'"; if (instManager.PageCount!=1) sb.Append("
首页|上一页|下一页|末页
"); sb.Append(""); bool bSetBgcolor = false; string[] arr_bgcolor = new string[1]; s = pm.Properties["JLYSSZ"].ToString(); if( s!= "") { bSetBgcolor = true; arr_bgcolor = s.Split(';'); } sb.Append(""); string[,] displayformat = new string[elementsCount,1]; for(i=0;i< elementsCount;i++) { s = listElements.Rows[i]["YS"].ToString(); sb.Append(""); setDisplayFormat(i,s); } sb.Append(""); j = 2; //fujianxianshi = aco.mt.FlowMemo string guanjianziduan = pm.Properties["gjzd"].ToString(); table = instManager.GetMulitRecordDataTable(); int rowIndex = 0; DataRow row = null; string fieldName; string val; l = table.Rows.Count; DataRow businessDataRow = null; for (int idx=0;idx"); for (i = 0; i < elementsCount; i++) { row = listElements.Rows[i]; elementType = row["kjlx"].ToString(); fieldName = StringHelper.GetRightString(row["dyzd"].ToString()); tjfs = row["TJFS"].ToString(); val = businessDataRow[fieldName].ToString(); if (row["qzzdlx"].ToString() == "2" && row["gxzd"].ToString() == "") sb.Append(""); } sb.Append(""); } sb.Append("
" + listElements.Rows[i]["kjms"].ToString() + "
"); //数字右对齐 else sb.Append(""); if (elementType == "140") { if (val != "") { arr_temp = val.Split('|'); for (j = 0; j < arr_temp.Length; j++) { s = arr_temp[j]; if (s != "") { s = s.Replace("\\", "/"); sb.Append("附件" + (j + 1).ToString() + ""); } sb.Append(" "); } } } else if (elementType == "141") { sb.Append("" + val + ""); } else if (elementType == "13") { sb.Append(getDisplay(i, val)); } else { if (row["gxzd"].ToString() == "") //' “更新字段”为空 { //超过25个字就截取 str = row["qzzd"].ToString(); sb.Append(getDisplay(i, val)); //sb.Appendreplace(str1,vbcrlf,"
") } else { sb.Append(val); } } sb.Append("
"); context.Response.Write(sb.ToString()); } public void setDisplayFormat(int idx, string s) { //dim s1,fn,ft,i,k //if s= "" then // fn = "" //else // i = instr(s,"displayformat") // if i <1 then // fn= "" // else // i = i + 14 // k = instr(i,s,"(") // fn = mid(s,i,k-i) // i = instr(k,s,")") - 1 // ft = mid(s,k+1,i-k) // end if //end if //displayFormat(idx,0) = fn //displayFormat(idx,1) = ft } private string getDisplay(int idx, string v) { string r = v; //if displayFormat(idx,0) = "" then // r = v //else // select case displayFormat(idx,0) // case "date" // r = emisformatdate(displayFormat(idx,1),v) // case "money" // r = emisformatmoney(displayFormat(idx,1),v) // end select //end if return r; } private string emisformatmoney(string ft, string v) { string r; r = v; if (v != "") { string f = ft + ",,,"; string[] a = f.Split(','); if (a[0] == "") a[0] = "¥"; if (a[1] == "") a[1] = "1"; if (a[2] == "") a[2] = "-1"; if (a[1] == "1") r = Math.Round(Convert.ToDecimal(r), Convert.ToInt16(a[1])).ToString(); r = a[0] + r; } return r; } private string GetItemValue(string itemsString, string itemName) { int i = itemsString.IndexOf("\"" + itemName + "\" : \"") + itemName.Length + 6; int j = itemsString.IndexOf("\"", i); return itemsString.Substring(i, j - i); } public bool IsReusable { get { return false; } } }