/// <summary> /// 建立卡口树 /// </summary> /// <param name="nodes"></param> /// <returns></returns> private Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = "Root"; nodes.Add(root); DataTable dt = tgsPproperty.GetStationInfo("b.istmsshow ='1'"); for (int i = 0; i < dt.Rows.Count; i++) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); node.Text = dt.Rows[i][2].ToString(); node.Icon = Icon.Camera; node.NodeID = dt.Rows[i][1].ToString(); node.Leaf = true; node.Checked = ThreeStateBool.False; root.Nodes.Add(node); } return(nodes); } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("PeccancyCount.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); return(null); } }
public string NodeLoad(string nodeID) { try { Ext.Net.TreeNodeCollection nodes = new Ext.Net.TreeNodeCollection(); List <DAL.DM_DONVI> list = new DM_DONVIController().GetByAll(txtSearch.Text, nodeID); foreach (var item in list) { AsyncTreeNode asyncNode = new AsyncTreeNode(); asyncNode.Text = item.TEN_DONVI; asyncNode.NodeID = item.MA_DONVI; asyncNode.Icon = Icon.House; asyncNode.CustomAttributes.Add(new ConfigItem("MA_DONVI", item.MA_DONVI, ParameterMode.Value)); asyncNode.CustomAttributes.Add(new ConfigItem("TEN_DONVI", item.TEN_DONVI, ParameterMode.Value)); asyncNode.CustomAttributes.Add(new ConfigItem("TEN_TAT", item.TEN_TAT, ParameterMode.Value)); asyncNode.CustomAttributes.Add(new ConfigItem("TEN_DONVI_EN", item.TEN_DONVI_EN, ParameterMode.Value)); asyncNode.CustomAttributes.Add(new ConfigItem("DIA_CHI", item.DIA_CHI, ParameterMode.Value)); asyncNode.Expanded = true; nodes.Add(asyncNode); } return(nodes.ToJson()); } catch (Exception ex) { Dialog.ShowError(ex.Message.ToString()); return(null); } }
/// <summary> ///将部门信息绑定至tree /// </summary> /// <param name="nodes"></param> private void BuildTree(Ext.Net.TreeNodeCollection nodes) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = "组织机构"; nodes.Add(root); root.Draggable = true; root.Expandable = ThreeStateBool.True; root.Expanded = true; DataTable dt = Bll.Common.ChangColName(ToDataTable(GetRedisData.GetData("t_cfg_department").Select("", "class asc,departid asc"))); // DataTable dt = settingManager.GetDepartmentByWhere("1=1 and systemid='00' and class<='3'"); if (dt != null) { if (dt.Rows.Count > 0) { Addree(dt, dt.Rows[0]["col2"].ToString(), root, null); } } } catch { } }
/// <summary> /// 将部门信息绑定至tree /// </summary> /// <param name="nodes"></param> /// <returns></returns> private void BuildTree(Ext.Net.TreeNodeCollection nodes) { try { TreeGrid1.RemoveAll(true); ClearInfoData(); if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = GetLangStr("KeyRoadManager53", "机构管理"); nodes.Add(root); root.Draggable = true; root.Expandable = ThreeStateBool.True; root.Expanded = true; DataTable dt = Bll.Common.ChangColName(GetRedisData.GetData("t_cfg_department")); settingManager.GetConfigDepartment("00"); if (dt != null && dt.Rows.Count > 0) { Addree(dt, dt.Rows[0]["col2"].ToString(), root, null); } } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("KeyRoadManager.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); } if (X.IsAjaxRequest) { TreeGrid1.Render(PanelNavigate, RenderMode.Auto); } }
private Ext.Net.TreeNodeCollection CreateAMTree(DataTable dt) { Ext.Net.TreeNodeCollection nodes = new Ext.Net.TreeNodeCollection(false); foreach (System.Data.DataRow dr in dt.Rows) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); //核心 if (dr["isleaf"].ToString().Trim() == "0") { node.Text = dr["name"].ToString().Trim(); node.NodeID = dr["structid"].ToString().Trim(); node.SingleClickExpand = true; node.Checked = ThreeStateBool.False; DataTable dtfather = GetTree(dr["structid"].ToString()); node.Nodes.AddRange(CreateAMTree(dtfather)); } else { node.Text = dr["name"].ToString().Trim(); node.NodeID = dr["structid"].ToString().Trim(); node.Leaf = true; node.Qtip = dr["parentid"].ToString().Trim() + "_" + dr["structid"].ToString().Trim() + "|" + dr["name"].ToString().Trim(); node.Checked = ThreeStateBool.False; node.Icon = Icon.ControlBlankBlue; } nodes.Add(node); } return(nodes); }
public string GetMenuById(int aid) { try { Ext.Net.TreeNodeCollection collect = new Ext.Net.TreeNodeCollection(); Ext.Net.TreeNode root = InitRoot(); List <SystemMenuWrapper> menus = SystemMenuWrapper.GetSystemMenusByApplication(aid); foreach (SystemMenuWrapper menu in menus) { SystemMenuWrapper pMenu = menu.ParentMenuID; if (pMenu == null) { LinqTree(menus, root, 0); break; } } collect.Add(root); ResourceManager.AjaxSuccess = true; return(collect.ToJson()); } catch (Exception ex) { ResourceManager.AjaxSuccess = false; ResourceManager.AjaxErrorMessage = string.Format(ex.Message); return(""); } }
private TreeNodeCollection BuildTree(List <NavMenu> menus, string rootName) { TreeNodeCollection nodes = new TreeNodeCollection(); TreeNode root = new TreeNode(); root.Text = rootName; root.Icon = Icon.Folder; nodes.Add(root); if (menus == null || menus.Count == 0) { return(nodes); } foreach (var menu in menus) { TreeNode mainNode = new TreeNode(); mainNode.Text = menu.Name; mainNode.NodeID = menu.Id; WebUIHelper.SetIcon(menu.Icon, menu.IsCategory, mainNode); mainNode.CustomAttributes.Add(new ConfigItem("IsGroup", "1", ParameterMode.Value)); mainNode.CustomAttributes.Add(new ConfigItem("MenuID", menu.Id, ParameterMode.Value)); GenerateSubTreeNode(mainNode, menu); root.Nodes.Add(mainNode); } return(nodes); }
/// <summary> /// 组件 报警类型树 /// </summary> /// <param name="nodes"></param> /// <returns></returns> private Ext.Net.TreeNodeCollection BuildTreeAlarm(Ext.Net.TreeNodeCollection nodes) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = "Root"; nodes.Add(root); root.Expanded = true; DataTable dt = Bll.Common.ChangColName(GetRedisData.GetData("t_sys_code:420700"));// tgsPproperty.GetAlarmTypeDict(); for (int i = 0; i < dt.Rows.Count; i++) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); node.Text = dt.Rows[i][1].ToString(); node.Icon = Icon.Note; node.NodeID = dt.Rows[i][0].ToString(); node.Checked = ThreeStateBool.False; node.Expanded = true; root.Nodes.Add(node); } return(nodes); } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("FlowMonitor.aspx-BuildTreeAlarm", ex.Message, "BuildTreeAlarm has an exception"); return(null); } }
public string NodeLoad(string nodeID) { Ext.Net.TreeNodeCollection nodes = new Ext.Net.TreeNodeCollection(); if (!string.IsNullOrEmpty(nodeID)) { int parentRoleID = 0; int.TryParse(nodeID, out parentRoleID); var customerRoles = base.CustomerService.GetCustomerRoleByParentCustomerRoleID(parentRoleID); foreach (var item in customerRoles) { AsyncTreeNode asyncNode = new AsyncTreeNode(); if (item.Active) { asyncNode.Text = item.Name; } else { asyncNode.Text = "<font color='red'>" + item.Name + "</font>"; } asyncNode.NodeID = item.CustomerRoleID.ToString(); asyncNode.Listeners.Click.Fn = "SelectNode"; asyncNode.Expanded = true; nodes.Add(asyncNode); } } return(nodes.ToJson()); }
private TreeNodeCollection BuildDirectorysTree(string rootNavPath) { TreeNodeCollection nodes = new TreeNodeCollection(); TreeNode root = new TreeNode(); root.Text = rootNavPath; root.Icon = Icon.TimeGo; nodes.Add(root); string dirNav = this.Server.MapPath(rootNavPath); if (!dirNav.EndsWith("\\")) { dirNav += "\\"; } string[] dirs = Directory.GetDirectories(dirNav); for (int i = 0; i < dirs.Length; i++) { DirectoryInfo directory = new DirectoryInfo(dirs[i]); TreeNode mainNode = new TreeNode(); mainNode.Text = directory.Name; //mainNode.Leaf = false; mainNode.NodeID = "Node" + (dirs[i]).GetHashCode().ToString(); mainNode.CustomAttributes.Add(new ConfigItem("Path", dirs[i] + "\\", ParameterMode.Value)); mainNode.Icon = Icon.Folder; GenerateSubTreeNode(mainNode, dirs[i], dirs[i] + "\\"); root.Nodes.Add(mainNode); } return(nodes); }
/// <summary> /// 创建部门列表树形菜单 /// </summary> /// <param name="nodes"></param> private void BuildTree(Ext.Net.TreeNodeCollection nodes) { try { TreePanel1.RemoveAll(true); if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); nodes.Add(root); root.Draggable = true; root.Expandable = ThreeStateBool.True; root.Expanded = true; DataTable dt = Bll.Common.ChangColName(GetRedisData.GetData("t_sys_code:240050"));//把字典从400200改成240050 2016-11-17 if (dt != null) { if (dt.Rows.Count > 0) { Addree(dt, "", root, null); } } } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("ImportantManager.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); } }
/// <summary> ///将部门信息绑定至tree /// </summary> /// <param name="nodes"></param> private void BuildTree(Ext.Net.TreeNodeCollection nodes) { try { TreePanel1.RemoveAll(true); if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = GetLangStr("policeOffcer54", "部门列表"); nodes.Add(root); root.Draggable = true; root.Expandable = ThreeStateBool.True; root.Expanded = true; DataTable dt = settingManager.GetConfigDepartment("0"); if (dt != null) { if (dt.Rows.Count > 0) { Addree(dt, dt.Rows[0]["col3"].ToString(), root, null); } } } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("PoliceOfficer.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); } }
/// <summary> /// 组件卡口列表树 /// </summary> /// <param name="nodes"></param> /// <returns></returns> private Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } nodes.Clear(); Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = GetLangStr("PasscarAllQuery27", "卡口列表"); nodes.Add(root); root.Draggable = true; root.Expandable = ThreeStateBool.True; root.Expanded = true; // 添加 自己机构节点 和卡口 UserInfo user = Session["userinfo"] as UserInfo; if (user == null) { user = new UserInfo(); user.DepartName = GetLangStr("PasscarAllQuery28", "滨州市交通警察支队"); user.DeptCode = "371600000000"; } Ext.Net.TreeNode nodeRoot = new Ext.Net.TreeNode(); nodeRoot.Text = user.DepartName; nodeRoot.Leaf = true; nodeRoot.NodeID = user.DeptCode; nodeRoot.Icon = Icon.House; nodeRoot.Qtip = "Bumen"; nodeRoot.Checked = ThreeStateBool.False;//加的部门选择框 DataTable dtStation = GetRedisData.GetData("Station:t_cfg_set_station"); DataRow[] rowsStation = dtStation.Select("departid='" + user.DeptCode + "'", "station_name asc"); AddStationTree(nodeRoot, rowsStation); //DataTable dtStation = tgsPproperty.GetStationInfo(" departid='" + user.DeptCode + "' "); //AddStationTree(nodeRoot, dtStation); nodeRoot.Expanded = false; nodeRoot.Draggable = true; nodeRoot.Expandable = ThreeStateBool.True; root.Nodes.Add(nodeRoot); //绑定下级部门及下级部门卡口 AddDepartTree(root, user.DeptCode); return(nodes); } catch (Exception ex) { ILog.WriteErrorLog(ex); return(null); } }
/// <summary> /// 组件卡口列表树 /// </summary> /// <param name="nodes"></param> /// <returns></returns> private Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = "卡口列表"; nodes.Add(root); root.Draggable = true; root.Expandable = ThreeStateBool.True; root.Expanded = true; // 添加 自己机构节点 和卡口 UserInfo user = Session["userinfo"] as UserInfo; if (user == null) { user = new UserInfo(); user.DepartName = "滨州市交通警察支队"; user.DeptCode = "371600000000"; } Ext.Net.TreeNode nodeRoot = new Ext.Net.TreeNode(); nodeRoot.Text = user.DepartName; nodeRoot.Leaf = true; nodeRoot.NodeID = user.DeptCode; nodeRoot.Icon = Icon.House; DataTable dtStation = GetRedisData.GetData("Station:t_cfg_set_station"); DataRow[] rowsStation = dtStation.Select("departid='" + user.DeptCode + "'", "station_name asc"); AddStationTree(nodeRoot, rowsStation); nodeRoot.Expanded = false; nodeRoot.Draggable = true; nodeRoot.Expandable = ThreeStateBool.True; root.Nodes.Add(nodeRoot); //绑定下级部门及下级部门卡口 AddDepartTree(root, user.DeptCode); return(nodes); } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("PassCarInfoCount.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); return(null); } }
/// <summary> /// 建立检测点类型列表 /// </summary> /// <param name="nodes"></param> /// <returns></returns> private Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Expanded = true; root.Text = GetLangStr("TGSLimitSpeed42", "监测点类型"); nodes.Add(root); DataTable dt = tgsPproperty.GetStationTypeInfo(" isuse='1' and limittype>0");; DataTable dt3 = GetRedisData.GetData("Station:t_cfg_set_station_type_istmsshow"); treekkmc = MyNet.Atmcs.Uscmcp.Bll.Common.ChangColName(dt3); for (int i = 0; i < dt.Rows.Count; i++) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); string code = dt.Rows[i]["col0"].ToString(); string limitType = dt.Rows[i]["col4"].ToString(); node.Text = dt.Rows[i]["col1"].ToString(); node.Icon = Icon.Monitor; node.NodeID = dt.Rows[i]["col0"].ToString(); node.Expanded = true; DataTable dt2 = tgsPproperty.GetStationInfo("a.station_type_id='" + code + "'"); if (dt2 != null && dt2.Rows.Count > 0) { DataTable dtLane = tgsPproperty.GetLaneInfo(" 1=1 "); for (int j = 0; j < dt2.Rows.Count; j++) { Addree(node, dt2.Rows[j], limitType, dtLane); } } else { node.Disabled = true; } root.Nodes.Add(node); } return(nodes); } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("TGSLimitSpeed.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); return(null); } }
public string CreateTreeNodes() { try { var nodes = new Ext.Net.TreeNodeCollection(); var root = new Ext.Net.TreeNode(); root.Text = "ColumnNames"; root.NodeID = "root_0"; root.Icon = Icon.House; root.Leaf = false; root.Expanded = true; root.SingleClickExpand = true; var reportSettingEntity = new BSetting(); var lscUsers = UserData.LscUsers; foreach (var lscUser in lscUsers) { if (lscUser.AlarmSoundFiterItem == null) { continue; } var node = new Ext.Net.TreeNode(); node.Text = lscUser.LscName; node.NodeID = lscUser.LscID.ToString(); node.Icon = Icon.House; node.CustomAttributes.Add(new ConfigItem("SpUID", lscUser.UID, ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("SpDisconnect", lscUser.AlarmSoundFiterItem.SpDisconnect.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("AL1Enabled", lscUser.AlarmSoundFiterItem.AL1Enabled.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("AL2Enabled", lscUser.AlarmSoundFiterItem.AL2Enabled.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("AL3Enabled", lscUser.AlarmSoundFiterItem.AL3Enabled.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("AL4Enabled", lscUser.AlarmSoundFiterItem.AL4Enabled.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("SpDevFilter", lscUser.AlarmSoundFiterItem.SpDevFilter, ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("SpNodeFilter", lscUser.AlarmSoundFiterItem.SpNodeFilter, ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("SpLoop", lscUser.AlarmSoundFiterItem.SpLoop.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("SpArea2", lscUser.AlarmSoundFiterItem.SpArea2.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("SpArea3", lscUser.AlarmSoundFiterItem.SpArea3.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("SpStation", lscUser.AlarmSoundFiterItem.SpStation.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("SpDevice", lscUser.AlarmSoundFiterItem.SpDevice.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("SpNode", lscUser.AlarmSoundFiterItem.SpNode.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("SpALDesc", lscUser.AlarmSoundFiterItem.SpALDesc.ToString(), ParameterMode.Value)); node.Leaf = true; root.Nodes.Add(node); } nodes.Add(root); return(nodes.ToJson()); } catch (Exception err) { WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name); WebUtility.ShowMessage(EnmErrType.Error, err.Message); } return(String.Empty); }
/// <summary> /// 组件卡口列表树 /// </summary> /// <param name="nodes"></param> /// <returns></returns> private Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = "卡口列表"; nodes.Add(root); root.Draggable = true; root.Expandable = ThreeStateBool.True; root.Expanded = true; // 添加 自己机构节点 和卡口 UserInfo user = Session["userinfo"] as UserInfo; if (user == null) { user = new UserInfo(); user.DepartName = "滨州市交通警察支队"; user.DeptCode = "371600000000"; } Ext.Net.TreeNode nodeRoot = new Ext.Net.TreeNode(); nodeRoot.Text = user.DepartName; nodeRoot.Leaf = true; nodeRoot.NodeID = user.DeptCode; nodeRoot.Icon = Icon.House; DataTable dtStation = tgsPproperty.GetStationInfo(" departid='" + user.DeptCode + "' "); AddStationTree(nodeRoot, dtStation); nodeRoot.Expanded = false; nodeRoot.Draggable = true; nodeRoot.Expandable = ThreeStateBool.True; root.Nodes.Add(nodeRoot); //绑定下级部门及下级部门卡口 AddDepartTree(root, user.DeptCode); return(nodes); } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("DropDownSetValueControl.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); return(null); } }
public string CreateTreeNodes() { try { var nodes = new Ext.Net.TreeNodeCollection(); var root = new Ext.Net.TreeNode(); root.Text = "ColumnNames"; root.NodeID = "old_root_0"; root.Icon = Icon.TextColumns; root.Leaf = false; root.Expanded = true; root.SingleClickExpand = true; if (LscsComboBox.SelectedItem != null) { var ids = WebUtility.ItemSplit(LscsComboBox.SelectedItem.Value); if (ids.Length == 2) { var lscId = Int32.Parse(ids[0]); var groupId = Int32.Parse(ids[1]); var userData = UserData; var lscUser = userData.LscUsers.Find(lui => { return(lui.LscID == lscId); }); if (lscUser != null) { for (int i = 0; i < lscUser.ActiveValuesFiterItem.Count; i++) { var node = new Ext.Net.TreeNode(); node.Text = lscUser.ActiveValuesFiterItem[i].ColName; node.NodeID = String.Format("old_node_{0}", i); node.Icon = Icon.TableColumn; node.CustomAttributes.Add(new ConfigItem("filterItem", lscUser.ActiveValuesFiterItem[i].FilterItem, ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("filterType", ((int)lscUser.ActiveValuesFiterItem[i].FilterType).ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("vNodeType", ((int)lscUser.ActiveValuesFiterItem[i].NodeType).ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("devName", lscUser.ActiveValuesFiterItem[i].DevName, ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("isNew", Boolean.FalseString, ParameterMode.Value)); node.Leaf = true; node.SingleClickExpand = true; root.Nodes.Add(node); } } } } nodes.Add(root); return(nodes.ToJson()); } catch (Exception err) { WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name); WebUtility.ShowMessage(EnmErrType.Error, err.Message); } return(String.Empty); }
private TreeNodeCollection BuildTree(List <NavMenu> menus, string rootName) { TreeNodeCollection nodes = new TreeNodeCollection(); TreeNode root = new TreeNode(); root.Text = rootName; root.Icon = Icon.Folder; nodes.Add(root); if (menus == null || menus.Count == 0) { return(nodes); } List <string> roleAssignedmenuIDs = SystemMenuWrapper.GetRoleAssignedMenuIDs(SystemRoleWrapper.FindById(RoleID)); foreach (var menu in menus) { TreeNode mainNode = new TreeNode(); mainNode.Text = menu.Name; mainNode.NodeID = menu.Id; WebUIHelper.SetIcon(menu.Icon, menu.IsCategory, mainNode); mainNode.CustomAttributes.Add(new ConfigItem("IsGroup", "1", ParameterMode.Value)); mainNode.CustomAttributes.Add(new ConfigItem("MenuID", menu.Id, ParameterMode.Value)); if (roleAssignedmenuIDs.Contains(menu.Id.ToString())) { mainNode.Checked = ThreeStateBool.True; } else { mainNode.Checked = ThreeStateBool.False; } GenerateSubTreeNode(mainNode, menu, roleAssignedmenuIDs); root.Nodes.Add(mainNode); } //foreach (TreeNodeBase treeNodeBase in nodes) //{ // treeNodeBase.Checked = ThreeStateBool.False; //} return(nodes); }
public string RefreshCustomerRoleTreeLoad() { Ext.Net.TreeNodeCollection nodes = new Ext.Net.TreeNodeCollection(); AsyncTreeNode rootNode = new AsyncTreeNode(); rootNode.Text = "角色"; rootNode.NodeID = "0"; rootNode.SingleClickExpand = true; rootNode.Expanded = true; nodes.Add(rootNode); return(nodes.ToJson()); }
/// <summary> /// 创建设备树 /// </summary> /// <param name="nodes"></param> /// <returns></returns> public Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Expanded = true; root.Text = GetLangStr("DeviceOperation74", "设备信息列表"); nodes.Add(root); DataTable dt = deviceManager.GetDeviceTypeAll(); for (int i = 0; i < dt.Rows.Count; i++) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); string code = dt.Rows[i]["col0"].ToString(); DataTable dt2 = deviceManager.GetDeviceByDeviceType(code); string countvalue = "0"; if (dt2 != null) { if (dt2.Rows.Count > 0) { countvalue = Convert.ToString(dt2.Rows.Count); } else { node.Disabled = true; } } node.Text = dt.Rows[i]["col1"].ToString() + "(" + countvalue + ")"; node.Listeners.Click.Handler = "DeviceOperation.SelectNode('" + code + "') ;"; node.Icon = Icon.DriveNetwork; node.NodeID = dt.Rows[i]["col0"].ToString(); node.Expanded = true; root.Nodes.Add(node); } return(nodes); } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("DeviceOperation.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); return(null); } }
/// <summary> /// 创建设备树 /// </summary> /// <param name="nodes"></param> /// <returns></returns> public Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Expanded = true; root.Text = GetLangStr("TGSStationManager80", "卡口接入服务器信息(使用/总计)"); nodes.Add(root); DataTable dt = deviceManager.GetServer(" server_type_id='1002' "); for (int i = 0; i < dt.Rows.Count; i++) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); string code = dt.Rows[i]["col0"].ToString(); DataTable dt2 = deviceManager.GetTGSSetting("IFNULL(COUNT(*),0)", "service_id='" + code + "'"); string countvalue = "0"; if (dt2 != null) { if (dt2.Rows.Count > 0) { countvalue = dt2.Rows[0][0].ToString(); } else { node.Disabled = true; } } node.Text = dt.Rows[i]["col1"].ToString() + "(" + countvalue + ")"; node.Listeners.Click.Handler = "TGSStationManager.SelectNode('" + code + "') ;"; node.Icon = Icon.Monitor; node.NodeID = dt.Rows[i]["col0"].ToString(); node.Expanded = true; root.Nodes.Add(node); } return(nodes); } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("TGSStationManager.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); return(null); } }
private Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes) { try { script = ddfGroupTree.ClientID + ".collapse();" + ddfGroupTree.ClientID + ".setValue('{0}',false);" + hdfGroupID.ClientID + ".setValue('{1}');" + btnDeleteGroup.ClientID + ".enable();" + btnSaveFormGroupInformation.ClientID + ".enable();"; if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = "Danh mục nhóm"; root.NodeID = "0"; nodes.Add(root); root.Expanded = true; if (_formInfo == null) { _formInfo = FormController.GetInstance().GetForm(_FormName); } List <FormGroupInfo> formGroupList = FormGroupController.GetInstance().GetFromGroups(_formInfo.ID, 0); foreach (FormGroupInfo item in formGroupList) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); node.Expanded = true; node.Text = item.Title; node.NodeID = item.ID.ToString(); root.Nodes.Add(node); if (item.IsTab) { node.Icon = Icon.Tab; } else { node.Icon = Icon.Folder; } node.Listeners.Click.Handler = string.Format(script, item.Title, item.ID); GetChildNode(node); LoadControl(node, item); } } catch (Exception ex) { Dialog.ShowError("Form/FormConfigLayout = " + ex.Message); } return(nodes); }
/// <summary> /// 组件人员列表树 /// </summary> /// <param name="nodes"></param> /// <returns></returns> private Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = "卡口列表"; nodes.Add(root); root.Draggable = true; root.Expandable = ThreeStateBool.True; root.Expanded = true; // 添加 自己机构节点 和卡口 UserInfo user = Session["userinfo"] as UserInfo; if (user == null) { user = new UserInfo(); user.DepartName = "滨州市交通警察支队"; user.DeptCode = "371600000000"; } Ext.Net.TreeNode nodeRoot = new Ext.Net.TreeNode(); nodeRoot.Text = user.DepartName; nodeRoot.Leaf = true; nodeRoot.NodeID = user.DeptCode; nodeRoot.Icon = Icon.House; DataTable dtStation = tgsPproperty.GetStationInfo(" departid='" + user.DeptCode + "' "); AddStationTree(nodeRoot, dtStation); nodeRoot.Expanded = false; nodeRoot.Draggable = true; nodeRoot.Expandable = ThreeStateBool.True; root.Nodes.Add(nodeRoot); //绑定下级部门及下级部门卡口 AddDepartTree(root, user.DeptCode); return(nodes); } catch { return(null); } }
private void BuildTree(Ext.Net.TreeNodeCollection nodes) { try { TreePanel1.RemoveAll(true); if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = "Root"; nodes.Add(root); root.Draggable = true; root.Expandable = ThreeStateBool.True; root.Expanded = true; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(HttpContext.Current.Server.MapPath("MapLayerConfig.xml")); foreach (XmlNode plantNode in xmlDoc.SelectNodes("layers/layer")) { Ext.Net.TreeNode Node = new Ext.Net.TreeNode(); Node.NodeID = plantNode.Attributes["id"].Value; Node.Text = plantNode.Attributes["name"].Value; Node.IconCls = plantNode.Attributes["icon"].Value; root.Nodes.Add(Node); foreach (XmlNode SubNode in plantNode.ChildNodes) { Ext.Net.TreeNode subNode = new Ext.Net.TreeNode(); subNode.Leaf = true; subNode.Checked = ThreeStateBool.False; subNode.NodeID = SubNode.Attributes["id"].Value; subNode.Text = SubNode.Attributes["name"].Value; subNode.IconCls = SubNode.Attributes["icon"].Value; ConfigItem ci0 = new ConfigItem("marktype", SubNode.Attributes["marktype"].Value, ParameterMode.Value); subNode.CustomAttributes.Add(ci0); ConfigItem ci1 = new ConfigItem("markicon", SubNode.Attributes["markicon"].Value, ParameterMode.Value); subNode.CustomAttributes.Add(ci1); Node.Nodes.Add(subNode); } } } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("BGisBrowse.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); } }
public string NodeLoad(string nodeID) { Ext.Net.TreeNodeCollection nodes = new Ext.Net.TreeNodeCollection(); if (!string.IsNullOrEmpty(nodeID)) { int moduleID = 0; int.TryParse(nodeID, out moduleID); var modules = base.ACLService.GetModulesByModuleID(moduleID); foreach (var item in modules) { if (item.childModules.Count() > 0) { AsyncTreeNode asyncNode = new AsyncTreeNode(); asyncNode.Text = item.ModuleName; asyncNode.NodeID = item.ModuleID.ToString(); asyncNode.Expanded = item.Expand; asyncNode.SingleClickExpand = true; nodes.Add(asyncNode); } else { Ext.Net.TreeNode treeNode = new Ext.Net.TreeNode(); treeNode.Text = item.ModuleName; treeNode.NodeID = item.ModuleID.ToString(); treeNode.Listeners.Click.Handler = "addTab(#{TabPanel1}, '" + item.ModuleID + "', '" + CommonHelper.ModifyQueryString(item.href, "WebModuleID=" + item.ModuleID, "") + "', '" + item.ModuleName + "', '" + item.iconCls + "');"; //treeNode.Href = item.href; //if (item.isTarget) //{ // treeNode.HrefTarget = "ContentPage"; //} //else //{ // treeNode.HrefTarget = "_blank"; //} treeNode.IconCls = item.iconCls; treeNode.Leaf = true; nodes.Add(treeNode); } } } return(nodes.ToJson()); }
/// <summary> /// /// </summary> /// <param name="nodes"></param> /// <param name="dtRole"></param> private void BuildTree(Ext.Net.TreeNodeCollection nodes, DataTable dtRole) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = "Root"; nodes.Add(root); root.Expanded = true; DataTable dt = tgsPproperty.GetCommonDict("240025"); for (int i = 0; i < dt.Rows.Count; i++) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); node.Text = dt.Rows[i][1].ToString(); node.Leaf = true; node.Icon = Icon.UserKey; node.Checked = ThreeStateBool.False; if (dtRole != null) { DataRow[] drs = dtRole.Select("col1='" + dt.Rows[i][1].ToString() + "'"); if (drs.Length > 0) { node.Checked = ThreeStateBool.True; } else { node.Checked = ThreeStateBool.False; } } else { node.Checked = ThreeStateBool.False; } node.NodeID = dt.Rows[i][0].ToString(); node.Expanded = true; root.Nodes.Add(node); } } catch (Exception ex) { ILog.WriteErrorLog(ex); } }
public Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Expanded = true; root.Text = GetLangStr("CCTVStationManager71", "视频接入网关服务器"); nodes.Add(root); Ext.Net.TreeNode node = new Ext.Net.TreeNode(); DataTable dt2 = deviceManager.GetCctvSetting("sum(isuse)||'/'|| count(*)", " 1=1 "); string countvalue = "0"; if (dt2 != null) { if (dt2.Rows.Count > 0) { countvalue = dt2.Rows[0][0].ToString(); } else { node.Disabled = true; } } node.Text = GetLangStr("CCTVStationManager72", "视频接入点") + "(" + countvalue + ")"; node.Listeners.Click.Handler = "CCTVStationManager.SelectNode() ;"; node.Icon = Icon.Monitor; node.NodeID = "100000001"; node.Expanded = true; root.Nodes.Add(node); return(nodes); } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("CCTVStationManager.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); return(null); } }
/// <summary> /// 获取权限列表 /// </summary> /// <param name="nodes"></param> /// <param name="dtprv"></param> /// <param name="formType"></param> /// <returns></returns> private Ext.Net.TreeNodeCollection BuildTree(Ext.Net.TreeNodeCollection nodes, DataTable dtprv, string formType) { try { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } Ext.Net.TreeNode root = new Ext.Net.TreeNode(); root.Text = "Root"; nodes.Add(root); root.Expanded = true; DataTable dt = settingManager.GetSettingContent(formType); for (int i = 0; i < dt.Rows.Count; i++) { if (formType == "0") { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); node.Text = dt.Rows[i][1].ToString(); node.Icon = Icon.House; node.NodeID = dt.Rows[i][0].ToString(); AddreeBuildTree(node, node.NodeID, dtprv, formType); node.Expanded = true; root.Nodes.Add(node); } else { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); node.Text = dt.Rows[i][1].ToString(); node.Icon = Icon.House; node.NodeID = dt.Rows[i][0].ToString(); Addree(node, node.NodeID, dtprv, formType); node.Expanded = true; root.Nodes.Add(node); } } return(nodes); } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("PrivManager.aspx-BuildTree", ex.Message + ";" + ex.StackTrace, "BuildTree has an exception"); return(null); } }
private Ext.Net.TreeNodeCollection getNodes(string pid) { Ext.Net.TreeNodeCollection nodes = new Ext.Net.TreeNodeCollection(); IEnumerable <sysprog> list2 = CurrentData.Where(prog => prog.ParentID == pid); foreach (sysprog item in list2) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(item.ProgName) { NodeID = item.id }; if (item.IsGroup != "1") { node.Leaf = true; } nodes.Add(node); } return(nodes); }
/// <summary> /// metodo que carrega as páginas pai no treeview /// </summary> private Ext.Net.TreeNodeCollection CarregarSetores(Ext.Net.TreeNodeCollection nodes, EmpresaVO empresa, EmpresaSetorVO sEdit) { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } List<EmpresaSetorVO> setores = new EmpresaSetorBO().BuscarSetoresPai(empresa); if (sEdit != null && sEdit.Removido && sEdit.SetorPai == null) { sEdit.SetoresFilhos = new List<EmpresaSetorVO>(); setores.Add(sEdit); } Ext.Net.TreeNode root = new Ext.Net.TreeNode("Setores"); root.AllowChildren = true; root.Expanded = true; nodes.Add(root); foreach (EmpresaSetorVO s in setores) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); node.NodeID = s.Id.ToString(); node.Icon = treeSetores.Icon; node.CustomAttributes.Add(new ConfigItem("Id", s.Id.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Nome", s.Nome, ParameterMode.Value)); node.Text = s.Nome; if (s.SetoresFilhos != null && s.SetoresFilhos.Count > 0) { node.Expanded = true; CarregarSetoresFilhos(s.SetoresFilhos, node, sEdit); } else node.Leaf = true; root.Nodes.Add(node); } Ext.Net.TreeNode node1 = new Ext.Net.TreeNode(); node1.Icon = treeSetores.Icon; node1.CustomAttributes.Add(new ConfigItem("Id", "", ParameterMode.Value)); node1.CustomAttributes.Add(new ConfigItem("Nome", "[Nenhum]", ParameterMode.Value)); node1.Text = "[Nenhum]"; root.Nodes.Insert(0, node1); return nodes; }
/// <summary> /// metodo que carrega as páginas pai no treeview /// </summary> private Ext.Net.TreeNodeCollection CarregarPaginas(Ext.Net.TreeNodeCollection nodes, Boolean isDrop, MenuPaginaVO pEdit) { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } List<MenuPaginaVO> paginas = new MenuPaginaBO().BuscarPaginasPai(); if (pEdit != null) paginas = paginas.Where(x => x.Id != pEdit.Id).ToList(); Ext.Net.TreeNode root = new Ext.Net.TreeNode("Página"); root.AllowChildren = true; root.Expanded = true; nodes.Add(root); foreach (MenuPaginaVO p in paginas.OrderBy(x => x.Ordem).ToList()) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); node.NodeID = p.Id.ToString(); node.Icon = p.Icone.IsNullOrEmpty() ? Icon.None : (Icon)Enum.Parse(typeof(Icon), p.Icone); node.CustomAttributes.Add(new ConfigItem("Id", p.Id.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Descricao", p.Descricao, ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Url", p.Url, ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("EmMenu", p.EmMenu ? "Sim" : "Não", ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Ordem", p.Ordem.ToString(), ParameterMode.Value)); node.Text = p.Descricao; if (p.MenuPaginas != null && p.MenuPaginas.Count > 0) { node.Expanded = true; CarregarPaginasFilhas(p.MenuPaginas, node, pEdit); } else node.Leaf = true; root.Nodes.Add(node); } if (isDrop) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); node.Icon = Icon.Folder; node.CustomAttributes.Add(new ConfigItem("Id", "", ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Descricao", "[Nenhuma]", ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Url", "", ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("EmMenu", "", ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Ordem", "", ParameterMode.Value)); node.Text = "[Nenhuma]"; root.Nodes.Insert(0, node); } return nodes; }
private Ext.Net.TreeNodeCollection CreateAMTree(DataTable dt) { Ext.Net.TreeNodeCollection nodes = new Ext.Net.TreeNodeCollection(false); foreach (System.Data.DataRow dr in dt.Rows) { Ext.Net.TreeNode node = new Ext.Net.TreeNode(); //核心 if (dr["isleaf"].ToString().Trim() == "0") { node.Text = dr["name"].ToString().Trim(); node.NodeID = dr["structid"].ToString().Trim(); node.SingleClickExpand = true; node.Checked = ThreeStateBool.False; DataTable dtfather = GetTree(dr["structid"].ToString()); node.Nodes.AddRange(CreateAMTree(dtfather)); } else { node.Text = dr["name"].ToString().Trim(); node.NodeID = dr["structid"].ToString().Trim(); node.Leaf = true; node.Qtip = dr["parentid"].ToString().Trim() + "_" + dr["structid"].ToString().Trim() + "|" + dr["name"].ToString().Trim(); node.Checked = ThreeStateBool.False; node.Icon = Icon.ControlBlankBlue; } nodes.Add(node); } return nodes; }
/// <summary> /// metodo que carrega os setores no treeview /// </summary> private Ext.Net.TreeNodeCollection CarregarSetores(Ext.Net.TreeNodeCollection nodes, EmpresaSetorVO sEdit) { if (nodes == null) { nodes = new Ext.Net.TreeNodeCollection(); } List<EmpresaSetorVO> setores = new EmpresaSetorBO().BuscarSetoresPai(null); //if (sEdit != null) // setores = setores.Where(x => x.Id != sEdit.Id).ToList(); Ext.Net.TreeNode root = new Ext.Net.TreeNode("Setores"); root.AllowChildren = true; root.Expanded = true; nodes.Add(root); List<EmpresaVO> empresas = setores.Select(x => x.Empresa).Distinct(new PropertyComparer<EmpresaVO>("Id")).ToList(); Boolean adicionouRemovido = false; Ext.Net.TreeNode node = new Ext.Net.TreeNode(); foreach (EmpresaVO e in empresas) { Ext.Net.TreeNode nodeE = new Ext.Net.TreeNode(); nodeE.Icon = Icon.Folder; nodeE.CustomAttributes.Add(new ConfigItem("Id", e.Id.ToString(), ParameterMode.Value)); nodeE.CustomAttributes.Add(new ConfigItem("Nome", e.Nome, ParameterMode.Value)); nodeE.CustomAttributes.Add(new ConfigItem("Empresa", "1", ParameterMode.Value)); nodeE.Text = e.Nome; // adiciona setor removido no treeview if (sEdit != null && e.Id == sEdit.Empresa.Id && sEdit.Removido) { adicionouRemovido = true; node = new Ext.Net.TreeNode(); node.NodeID = sEdit.Id.ToString(); node.Icon = Icon.ApplicationSideBoxes; node.CustomAttributes.Add(new ConfigItem("Id", sEdit.Id.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Nome", sEdit.Nome, ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Empresa", "0", ParameterMode.Value)); node.Text = sEdit.Nome; node.Leaf = true; nodeE.Nodes.Add(node); } foreach (EmpresaSetorVO s in setores.Where(x=> x.Empresa.Id == e.Id).ToList()) { node = new Ext.Net.TreeNode(); node.NodeID = s.Id.ToString(); node.Icon = Icon.ApplicationSideBoxes; node.CustomAttributes.Add(new ConfigItem("Id", s.Id.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Nome", s.Nome, ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Empresa", "0", ParameterMode.Value)); node.Text = s.Nome; if (s.SetoresFilhos != null && s.SetoresFilhos.Count > 0) { node.Expanded = true; CarregarSetoresFilhos(s.SetoresFilhos, node, sEdit); } else node.Leaf = true; nodeE.Nodes.Add(node); } root.Nodes.Add(nodeE); } // adiciona setor removido no treeview if (sEdit != null && !adicionouRemovido && sEdit.Removido) { Ext.Net.TreeNode nodeE = new Ext.Net.TreeNode(); nodeE.Icon = Icon.Folder; nodeE.CustomAttributes.Add(new ConfigItem("Id", sEdit.Empresa.Id.ToString(), ParameterMode.Value)); nodeE.CustomAttributes.Add(new ConfigItem("Nome", sEdit.Empresa.Nome, ParameterMode.Value)); nodeE.CustomAttributes.Add(new ConfigItem("Empresa", sEdit.Empresa.Id.ToString(), ParameterMode.Value)); nodeE.Text = sEdit.Empresa.Nome; node = new Ext.Net.TreeNode(); node.NodeID = sEdit.Id.ToString(); node.Icon = Icon.ApplicationSideBoxes; node.CustomAttributes.Add(new ConfigItem("Id", sEdit.Id.ToString(), ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Nome", sEdit.Nome, ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Empresa", "0", ParameterMode.Value)); node.Text = sEdit.Nome; node.Leaf = true; nodeE.Nodes.Add(node); root.Nodes.Add(nodeE); } node = new Ext.Net.TreeNode(); node.Icon = Icon.ApplicationSideBoxes; node.CustomAttributes.Add(new ConfigItem("Id", "", ParameterMode.Value)); node.CustomAttributes.Add(new ConfigItem("Nome", "[Nenhum]", ParameterMode.Value)); node.Text = "[Nenhum]"; root.Nodes.Insert(0, node); return nodes; }
public string GetTreeNodes(string searchfilters) { TreeNodeCollection nodes = new TreeNodeCollection(); TreeNode root = new TreeNode(); root.Text = "root"; root.Icon = Icon.Folder; nodes.Add(root); //if (menus == null || menus.Count == 0) // return nodes; List<SPCodeWrapper> allcodes = null; Dictionary<string, string> search = null; if (!string.IsNullOrEmpty(searchfilters)) { search = JSON.Deserialize<Dictionary<string, string>>(searchfilters); } int? channelID = null; int? clientID = null; string mo = string.Empty; string spnumber = string.Empty; if (search != null) { if (!string.IsNullOrEmpty(search["ChannelID"])) { channelID = Convert.ToInt32(search["ChannelID"]); } if (!string.IsNullOrEmpty(search["ClientID"])) { clientID = Convert.ToInt32(search["ClientID"]); } if (!string.IsNullOrEmpty(search["Mo"])) { mo = search["Mo"]; } if (!string.IsNullOrEmpty(search["SpNumber"])) { spnumber = search["SpNumber"]; } } if(ChannelID!=null) { allcodes = SPCodeWrapper.FindAllByChannelIDAndClientIDAndMoAndSpNumber(ChannelID.Id, null, mo, spnumber); } else { allcodes = SPCodeWrapper.FindAllByChannelIDAndClientIDAndMoAndSpNumber(channelID, clientID, mo, spnumber); } for (int i = 0; i < allcodes.Count; i++) { if (allcodes[i].GetParentCode(allcodes) == allcodes[i]) { TreeNode mainNode = new TreeNode(); mainNode.Text = allcodes[i].MoCode; mainNode.NodeID = "nod" + allcodes[i].Id.ToString(); mainNode.Icon = Icon.Script; mainNode.CustomAttributes.Add(new ConfigItem("MoCode", allcodes[i].MoCode, ParameterMode.Value)); mainNode.CustomAttributes.Add(new ConfigItem("ChannelName", allcodes[i].ChannelID_Name, ParameterMode.Value)); mainNode.CustomAttributes.Add(new ConfigItem("ChannelID", allcodes[i].ChannelID.Id.ToString(), ParameterMode.Value)); mainNode.CustomAttributes.Add(new ConfigItem("AssignedClientName", allcodes[i].AssignedClientName, ParameterMode.Value)); mainNode.CustomAttributes.Add(new ConfigItem("CodeID", allcodes[i].Id.ToString(), ParameterMode.Value)); mainNode.CustomAttributes.Add(new ConfigItem("Disable", allcodes[i].IsDiable.ToString(), ParameterMode.Value)); GenerateSubTreeNode(mainNode, allcodes[i], allcodes); root.Nodes.Add(mainNode); } } return nodes.ToJson(); }