protected void Page_Load(object sender, EventArgs e) { string key = Request.QueryString["key"]; StringBuilder strStr = new StringBuilder(); string D_Id = string.Empty; string D_Name = string.Empty; string D_Type = string.Empty; string strIsClick = string.Empty; string strTemp = string.Empty; int PageIndex = 0; int PageSize = 0; int rCount = 0; int pCount = 0; string strJson = string.Empty; string strIds = string.Empty; string strWhere = string.Empty; string DocColJson = string.Empty; strPageName = Request["strPageName"]; string IsPY = "1"; if (string.IsNullOrEmpty(key)) { key = Request["key"]; } switch (key) { #region 分页面获取通用字典项 case "AjaxAutoCompletePaged": strJson = string.Empty; string strCondition = string.Empty; if (!String.IsNullOrEmpty(Request["PageIndex"])) { int.TryParse(Request["PageIndex"].ToString(), out PageIndex); } if (!String.IsNullOrEmpty(Request["PageSize"])) { int.TryParse(Request["PageSize"].ToString(), out PageSize); } if (!String.IsNullOrEmpty(Request["D_Name"])) { D_Name = Request["D_Name"].ToString(); } if (!String.IsNullOrEmpty(Request["D_Type"])) { D_Type = Request["D_Type"].ToString(); } if (!String.IsNullOrEmpty(Request["IsPY"])) { IsPY = Request["IsPY"].ToString(); } if (!String.IsNullOrEmpty(Request["isClick"])) { strIsClick = Request["isClick"].ToString(); } if (!string.IsNullOrWhiteSpace(Request["ConditionIn"])) { string[] arr = Request["ConditionIn"].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); strWhere += " and " + arr[0] + " in(" + arr[1] + ")"; } if (!string.IsNullOrWhiteSpace(Request["ConditionNotIn"])) { string[] arr = Request["ConditionNotIn"].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); strWhere += " and " + arr[0] + " not in(" + arr[1] + ")"; } //TextColumn: TextColumn , ValueColumn: ValueColumn //查询字段 string Like = string.IsNullOrWhiteSpace(Request["Like"]) ? "0" : Request["Like"].ToString().Trim(); string IsJP = string.IsNullOrWhiteSpace(Request["IsJP"]) ? "1" : Request["IsJP"].ToString().Trim(); if (!string.IsNullOrWhiteSpace(Request["WhereColumn"])) { string[] arr = Request["WhereColumn"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (D_Name != "") { strWhere += " and ( 1<>1 "; for (int i = 0; i < arr.Length; i++) { strWhere += " or " + arr[i] + " like '" + getLikeStr(D_Name, Like) + "'"; if (IsJP == "1") { strWhere += " or dbo.f_GetPy(" + arr[i] + ") like '" + getLikeStr(D_Name, Like) + "'"; } } strWhere += ") "; } } else { strWhere += " and ("; strWhere += " D_Name like '" + getLikeStr(D_Name, Like) + "'"; if (IsJP == "1") { strWhere += " or dbo.f_GetPy(d_name) like '" + getLikeStr(D_Name, Like) + "'"; } strWhere += ")"; } //显示字段: 排序字段, 显示文本, 隐藏值。 string select = string.Empty; //排序字段 if (!string.IsNullOrWhiteSpace(Request["Order"])) { select = " row_number() over(order by " + Request["Order"] + ") AS r_n,"; } else { select = " row_number() over(order by D_Order,D_Name) AS r_n,"; } //显示文本 if (!string.IsNullOrWhiteSpace(Request["TextColumn"])) { select += "(" + getSelectRegex(Request["TextColumn"]) + ") as D_name,"; } else { select += "D_name,"; } //隐藏值 if (!string.IsNullOrWhiteSpace(Request["ValueColumn"])) { select += "(" + getSelectRegex(Request["ValueColumn"]) + ") as Common_Dict_ID,"; } else { select += "Common_Dict_ID, "; } //其他显示列 select += "D_Value,D_Code,D_Level,D_Order,D_Type,D_Remark,D_CreateUser,D_CreateTime,D_ModifyUser,D_ModifyTime "; #region 分页得到通用字典项 try { strStr = new StringBuilder(); var varData = new BLL_PublicClass().GetIntelligentAssociationList(D_Type, select, strWhere, PageIndex, PageSize, out rCount, out pCount); if (varData.Count == 0) { strJson = "2"; } else { System.Web.Script.Serialization.JavaScriptSerializer objJson = new System.Web.Script.Serialization.JavaScriptSerializer(); strJson = objJson.Serialize(varData); strJson = strJson + "~" + GetHtmlPage(rCount, PageIndex, PageSize, pCount, strIsClick); } } catch { //strJson = ex.Message.ToString(); strJson = "0"; } Response.Write(strJson.ToString()); Response.End(); break; #endregion #endregion } }
protected void Page_Load(object sender, EventArgs e) { string key = Request.QueryString["key"]; StringBuilder strStr = new StringBuilder(); //string HospitalID = string.Empty; string userControlID = string.Empty; string D_Id = string.Empty; string D_Name = string.Empty; string D_Type = string.Empty; string strTemp = string.Empty; int PageIndex = 0; int PageSize = 0; int rCount = 0; int pCount = 0; string IsPY = "0"; string strJson = string.Empty; string strIds = string.Empty; string strWhere = string.Empty; string DocColJson = string.Empty; strPageName = Request["strPageName"]; if (string.IsNullOrEmpty(key)) { key = Request["key"]; } switch (key) { #region 获取通用视图字典 NOW #region 获取已选取通用视图字典项 NOW case "CommonCtrlMultiple": strJson = "2"; try { if (!String.IsNullOrEmpty(Request["Ids"])) { strIds = Request["Ids"].ToString(); for (int i = 0; i < strIds.Split(',').Length; i++) { strTemp += "'" + strIds.Split(',')[i] + "',"; } strTemp = strTemp.TrimEnd(','); strWhere = String.Format(" Common_Dict_ID in({0})", strTemp); if (!String.IsNullOrWhiteSpace(Request["D_Type"])) { strWhere += String.Format(" AND D_Type ='{0}'", Request["D_Type"].ToString()); } strStr = new StringBuilder(); var varData = new BLL_PublicClass().GetCommon_Dict_List(strWhere, Request["D_Type"].Trim()); if (varData.Count == 0) { strJson = "2"; } else { System.Web.Script.Serialization.JavaScriptSerializer objJson = new System.Web.Script.Serialization.JavaScriptSerializer(); strJson = objJson.Serialize(varData); } } } catch { //strJson = ex.Message.ToString(); strJson = "0"; } Response.Write(strJson); Response.End(); break; #endregion #region 分页面获取通用字典项 case "CommonCtrlMultiplePaged": strJson = string.Empty; string strCondition = string.Empty; strWhere = string.Empty; if (!String.IsNullOrEmpty(Request["userControlID"])) { userControlID = Request["userControlID"].ToString(); } if (!String.IsNullOrEmpty(Request["PageIndex"])) { int.TryParse(Request["PageIndex"].ToString(), out PageIndex); } if (!String.IsNullOrEmpty(Request["PageSize"])) { int.TryParse(Request["PageSize"].ToString(), out PageSize); } if (!String.IsNullOrEmpty(Request["D_Name"])) { D_Name = Request["D_Name"].ToString(); } if (!String.IsNullOrEmpty(Request["D_Type"])) { D_Type = Request["D_Type"].ToString(); } if (!String.IsNullOrEmpty(Request["Condition"])) { //字段名1,字段名2|值1,值2 strCondition = Request["Condition"].ToString(); strTemp = string.Empty; strTemp = clsUtility.Decrypt(strCondition); string strT1 = strTemp.Split('|')[0]; string strT2 = strTemp.Split('|')[1]; if (strT1.Split(',').Count() == strT2.Split(',').Count()) { for (int i = 0; i < strT1.Split(',').Count(); i++) { strWhere += " and " + strT1.Split(',')[i] + " = '" + strT2.Split(',')[i] + "'"; } } else { strWhere = string.Empty; } } #region 分页得到通用字典项 try { strStr = new StringBuilder(); var varData = new BLL_PublicClass().GetCommonMultiselect(IsPY, D_Name, D_Type, strWhere, PageIndex, PageSize, out rCount, out pCount); if (varData.Count == 0) { strJson = "2"; } else { System.Web.Script.Serialization.JavaScriptSerializer objJson = new System.Web.Script.Serialization.JavaScriptSerializer(); strJson = objJson.Serialize(varData); strJson = strJson + "~" + GetHtmlPage(rCount, PageIndex, PageSize); } } catch { //strJson = ex.Message.ToString(); strJson = "0"; } Response.Write(strJson.ToString()); Response.End(); break; #endregion #endregion #endregion } }