using System; using System.Collections; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Text; using DSWeb.Models; using DSWeb.EntityDA; using DSWeb.Filter; namespace DSWeb.SeanInfo { public partial class SeanEdit : System.Web.UI.Page { StringBuilder leftNav = new StringBuilder(); StringBuilder leftTree = new StringBuilder(); StringBuilder tmpLeftTree = new StringBuilder(); private string strHandleType; private string strGID; private string strEnabled; protected void Page_Load(object sender, EventArgs e) { HttpRequest request = Page.Request; LeftTreeCssFilter myFilter = new LeftTreeCssFilter(request); if (Request.QueryString["handle"] != null) { strHandleType = Request.QueryString["handle"].Trim().ToString().ToLower(); if (Request.QueryString["id"] != null) { strGID = Request.QueryString["id"].ToString().Trim(); } if (Request.QueryString["isenabled"] != null) { strEnabled = Request.QueryString["isenabled"].ToString().Trim(); } } DoGet(); } /// /// 只显示用户设置 /// /// /// private List ActionFilter(List moduleEntites) { List ActionFilter = new List(); foreach (ModuleEntity moduleEntity in moduleEntites) { if (moduleEntity.Gid == "75F43880-26D5-48CC-BCD1-3FCF76A6754D") { ActionFilter.Add(moduleEntity); } } return ActionFilter; } public void DoGet() { ModuleDA moduleDA = new ModuleDA(); List moduleEntites = ActionFilter(moduleDA.GetModuleByType(ModuleDA.ModuleType.SEAIMPORT)); StringBuilder htmlBuilder = new StringBuilder(); LeftTreeCssFilter cssFilter = new LeftTreeCssFilter(Page.Request); string strBVersion = cssFilter.Version.Trim(); string strBName = cssFilter.BrowserName.ToLower().Trim(); htmlBuilder.Append(""); htmlBuilder.Append("Manager"); //根据不同的浏览器加载不同的css样式 if (strBVersion.Equals("6.0") && strBName.Equals("ie")) { htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append(""); } else { htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append(""); } htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append(""); //htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append(""); //begin top框架 htmlBuilder.Append(""); //End htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append("
"); htmlBuilder.Append("");// //htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append("
");// align=\"center\" //htmlBuilder.Append("
"); //htmlBuilder.Append("
");//
添加费用更改单
htmlBuilder.Append("
"); htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append(""); htmlBuilder.Append("
"); htmlBuilder.Append(""); htmlBuilder.Append("
 "); htmlBuilder.Append("
"); htmlBuilder.Append("[退出]    
    "); htmlBuilder.Append("
      "); htmlBuilder.Append("
    • "); htmlBuilder.Append("
    "); htmlBuilder.Append("
      "); string strValue = GetTreeView(moduleEntites); htmlBuilder.Append(leftNav.ToString()); htmlBuilder.Append("
    "); htmlBuilder.Append(strValue); if (strHandleType != null) { if (strHandleType.Equals("edit") && !strGID.Equals("")) { T_ALL_DA T_ALL_DA = new T_ALL_DA(); if (strEnabled != "True") { strEnabled = T_ALL_DA.GetStrSQL("bsstatus", "select bsstatus from op_sean where bsno='" + strGID + "'"); } if (strEnabled.Trim() == "True") { htmlBuilder.Append(""); } else { htmlBuilder.Append(""); } } else if (strHandleType.Equals("addfull") && !strGID.Equals("")) { htmlBuilder.Append(""); } else { htmlBuilder.Append(""); } } else { Response.End(); } Response.Clear(); Response.Write(htmlBuilder.ToString()); } /// /// 获取左侧展开树内容 /// /// 实体类ModuleEntity /// public String GetTreeView(List tempEntities) { //StringBuilder leftNav = new StringBuilder(); StringBuilder leftTree = new StringBuilder(); StringBuilder tmpLeftTree = new StringBuilder(); //树型菜单第一级菜单 StringBuilder leftTreeData = new StringBuilder(); StringBuilder treesJS = new StringBuilder(); foreach (ModuleEntity mdel in tempEntities) { leftNav.Append("
  • "); leftNav.Append(" "); leftNav.Append(mdel.ModuleDescription); leftNav.Append("
  • "); tmpLeftTree = new StringBuilder();// class=\"TreeMenu\" tmpLeftTree.Append("
    "); tmpLeftTree.Append("
    "); leftTreeData.Append(LeftTreeNodeData(mdel)); leftTree.Append(tmpLeftTree.ToString()); } return leftTreeData.ToString(); } public String ConvertToJS(JSTreeNodeEntity tempJSTreeEntity) { StringBuilder nodeJS = new StringBuilder(); nodeJS.Append("{"); nodeJS.Append("\"id\":\"root" + tempJSTreeEntity.Gid + "\""); nodeJS.Append(","); nodeJS.Append("\"text\":\"" + tempJSTreeEntity.Text + "\""); nodeJS.Append(","); nodeJS.Append("\"value\":\"" + tempJSTreeEntity.Value + "\""); nodeJS.Append(","); nodeJS.Append("\"showcheck\":" + (tempJSTreeEntity.SetShowCheck ? 1 : 0).ToString() + ""); nodeJS.Append(","); nodeJS.Append("\"complete\":1"); nodeJS.Append(","); nodeJS.Append("\"isexpand\":1");//+ (tempJSTreeEntity.IsExpand ? 1 : 0).ToString() + nodeJS.Append(","); nodeJS.Append("\"checkstate\":" + tempJSTreeEntity.CheckState + ""); nodeJS.Append(","); nodeJS.Append("\"hasChildren\":" + (tempJSTreeEntity.SetHasChild ? 1 : 0).ToString() + ""); //nodeJS.Append("\"hasChildren\":\"1\""); nodeJS.Append(","); string classes = tempJSTreeEntity.SetClasses; if (classes != null && !classes.Equals("")) { int ilen = classes.IndexOf('.'); classes = classes.Substring(0, ilen); if (classes.Length > 1) { nodeJS.Append("\"classes\":\"" + classes + "\""); nodeJS.Append(","); } } //nodeJS.Append("\"ChildNodes\":\"null\"");//root13D3C23DA46E49E5B0C4FB446534244909= //string strTemp = "[{\"id\":\"root13D3C23DA46E49E5B0C4FB446534244777\",\"text\":\"系统流程\",\"value\":\"CreateTab('系统流程','H','../users/userinfo.aspx');\"," // + "\"showcheck\":0,\"complete\":1,\"isexpand\":0,\"checkstate\":0,\"hasChildren\":0,\"classes\":\"fax\",\"ChildNodes\":\"null\"}]"; //nodeJS.Append("\"ChildNodes\":" + strTemp); nodeJS.Append("\"ChildNodes\":\"null\""); //nodeJS.Append("\"ChildNodes\":\"[root399E191892584C938D5D7582027FA391]\""); nodeJS.Append("}"); return nodeJS.ToString(); } /// /// 遍历模块查看此模块是否为父模块 /// /// /// /// public bool IsParent(List tempEntities, string strGID) { bool IsExist = false; foreach (ModuleEntity mdle in tempEntities) { if (mdle.ParentID.Trim().Equals(strGID)) { IsExist = true; } } return IsExist; } public String LeftTreeNodeData(ModuleEntity tempEntity) { StringBuilder appTreeData = new StringBuilder(); StringBuilder childerData = new StringBuilder(); ModuleDA moduleDA = new ModuleDA(); //List subModule = moduleDA.GetSubModule(tempEntity.Gid); //List tempEntities = moduleDA.GetAllUserBaseSubModules(); List subModule = moduleDA.GetSubModule(tempEntity.Gid); List tempEntities = moduleDA.GetAllSubModules(); appTreeData.Append(""); return appTreeData.ToString(); } /// /// 返回 /// /// /// /// public String GetSubJs(string parentGid, List tempEntities, string tempJSON) { StringBuilder valBuilder = new StringBuilder(); StringBuilder childBuilder = new StringBuilder(); foreach (ModuleEntity mdle in tempEntities) { if (parentGid.Trim().Equals(mdle.ParentID)) { bool isParentNode = IsParent(tempEntities, mdle.Gid); string strTempNode = GetNodeJs(mdle, isParentNode); string strTempValue = ""; if (isParentNode) { strTempValue = GetSubJs(mdle.Gid, tempEntities, strTempNode); childBuilder.Append(strTempValue); } if (strTempValue.Trim().Equals("")) { childBuilder.Append(strTempNode); } } } if (childBuilder.Length > 1) { string strChilds = childBuilder.ToString(); strChilds = strChilds.Substring(0, strChilds.Length - 1);//去除末尾逗号 if (!tempJSON.Equals("")) { tempJSON = tempJSON.Replace("\"null\"", "[" + strChilds + "]"); valBuilder.Append(tempJSON); } else { valBuilder.Append(strChilds); } } return valBuilder.ToString(); } #region 获取节点JSON值 /// /// 获取节点JSON值 /// /// /// /// public String GetNodeJs(ModuleEntity tempEntity, bool hasChild) { StringBuilder tempNodeBuilder = new StringBuilder(); JSTreeNodeEntity modelData = new JSTreeNodeEntity(); modelData.Gid = tempEntity.Gid.Replace("-", ""); modelData.Text = tempEntity.ModuleDescription; modelData.SetShowCheck = false; modelData.CheckState = 0; modelData.IsExpand = true; modelData.SetClasses = tempEntity.ModuleIcon; String tmpUrl = tempEntity.ModuleUrl.Trim(); //如果数据库模板表Module字段Url设置为"#"则不提供链接 if (!tmpUrl.Equals("#")) { tmpUrl = "../" + tmpUrl; T_ALL_DA T_ALL_DA = new T_ALL_DA(); string strEnabled = T_ALL_DA.GetStrSQL("bsstatus", "select bsstatus from op_sean where bsno='" + strGID + "'"); if (strEnabled.Trim() == "True") { modelData.Value = "CreateTab('" + tempEntity.ModuleDescription + "','H','" + tmpUrl + "?handle=edit&id=" + strGID + "&hdenabled=false');"; } else { modelData.Value = "CreateTab('" + tempEntity.ModuleDescription + "','H','" + tmpUrl + "?handle=edit&id=" + strGID + "');"; } } else { modelData.Value = "javascript:void(0);"; } //设置是否有子菜单 if (hasChild) { modelData.SetChildNode = 0; modelData.SetHasChild = true; } else { modelData.SetChildNode = 0; modelData.SetHasChild = false; } //recording++; // Response.Write(ConvertToJS(modelData) + ","); return (ConvertToJS(modelData) + ","); } #endregion } }