private List <TreeListNode> GetNodesByServiceIds(TreeListNodes nodes, List <Guid> serviceIds, bool invert) { List <TreeListNode> result = new List <TreeListNode>(); foreach (TreeListNode node in nodes) { if (node.Nodes.Count > 0) { result.AddRange(GetNodesByServiceIds(node.Nodes, serviceIds, invert)); } ServiceTree service = GetServiceByNode(node); if (service == null || service.ParentId == Guid.Empty) { continue; } if (invert) { if (!serviceIds.Contains(service.ServiceId)) { result.Add(node); } } else { if (serviceIds.Contains(service.ServiceId)) { result.Add(node); } } } return(result); }
private void SetPerfil(TreeListNodes nodes, int id_rotina, bool check) { treeList1.BeginUnboundLoad(); foreach (TreeListNode node in nodes) { if ((int)node.GetValue(treeListColumn2) == id_rotina) { if (!check) { node.Tag = null; node.Checked = false; } else { node.Tag = "PERFIL"; node.Checked = true; } break; } if (node.HasChildren) { SetPerfil(node.Nodes, id_rotina, check); } } if (!check) { foreach (TreeListNode node in nodes) { SetCheckedParentNodes(node, node.CheckState); } } treeList1.EndUnboundLoad(); }
private bool GetNodeVisible(TreeListNodes nodes, string filter) { bool isVisible = false; for (int i = 0; i < nodes.Count; i++) { TreeListNode node = nodes[i]; if (node.HasChildren) { bool isShow = GetNodeVisible(node.Nodes, filter); node.Visible = isShow; if (isShow) { isVisible = true; } } else { string NodeText = node["CountryName"].ToString(); if (NodeText == filter) { node.Visible = true; isVisible = true; } else { node.Visible = false; } } } return(isVisible); }
public static bool SetRowHandleForDataRow(TreeList list, TreeListNodes nodes, DataRow row, string pkColName) { if (nodes == null) { nodes = list.Nodes; } if (nodes == null) { return(false); } foreach (TreeListNode node in nodes) { var gridRow = list.GetDataRecordByNode(node) as DataRowView; if (gridRow != null && gridRow[pkColName].Equals(row[pkColName])) { list.FocusedNode = node; list.Focus(); return(true); } if (SetRowHandleForDataRow(list, node.Nodes, row, pkColName)) { return(true); } } return(false); }
private void FillCustomDataBindingsRecursive(TreeListNodes nodes) { if (nodes == null || nodes.Count == 0 || _CustomInputShortcut == null) { return; } for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Tag is CommandKeyFolder) { FillCustomDataBindingsRecursive(nodes[i].Nodes); } else { CommandKeyBinding binding = nodes[i].Tag as CommandKeyBinding; if (binding == null) { continue; } if (binding.Matches(_CustomInputShortcut) == MatchQuality.FullMatch) { _CustomInputBindings.Add(nodes[i]); } } } }
private void SetCheckedChildNodes(TreeListNodes nodes) { foreach (TreeListNode node in nodes) { node.Checked = node.ParentNode.Checked; } }
private void FillCommandsRecursive(TreeListNodes nodes) { if (nodes == null || nodes.Count == 0) { return; } for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Tag is CommandKeyFolder) { FillCommandsRecursive(nodes[i].Nodes); } else { CommandKeyBinding lBinding = nodes[i].Tag as CommandKeyBinding; if (lBinding == null) { continue; } if (lBinding.Command != null && lBinding.Command == CommandName) { _CommandBindings.Add(nodes[i]); } } } }
private void SaveInner(TreeListNode node) { try { TreeListNodes nodes = null; if (node != null) { nodes = node.Nodes; } else { nodes = treeListDiag.Nodes; } foreach (TreeListNode subNode in nodes) { SaveData(subNode); SaveInner(subNode); } } catch (Exception) { throw; } }
private List <ServiceType> GetServiceTypes(TreeListNodes nodes) { List <ServiceType> result = new List <ServiceType>(); foreach (TreeListNode listNode in nodes) { if (listNode.Nodes.Count > 0) { result.AddRange(GetServiceTypes(listNode.Nodes)); } ServiceTree service = GetServiceByNode(listNode); if (service == null || service.ParentId != Guid.Empty) { continue; } ServiceType s = new ServiceType(); s.ServiceTypeId = service.ServiceId; s.Name = service.Name; result.Add(s); } return(result); }
public void GetITEMSCHEKEADOS(TreeListNodes NODO) { try { foreach (TreeListNode item in NODO) { if (item.HasChildren) { if (item.CheckState == CheckState.Checked || item.CheckState == CheckState.Indeterminate) { DEP_CHEKEADOS.Add((ro_Departamento_Info)TreeListDepartamento.GetDataRecordByNode(item)); } GetITEMSCHEKEADOS(item.Nodes); } else { if (item.CheckState == CheckState.Checked || item.CheckState == CheckState.Indeterminate) { DEP_CHEKEADOS.Add((ro_Departamento_Info)TreeListDepartamento.GetDataRecordByNode(item)); } } } } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); } }
/// <summary> /// 获取页面所有病历节点Model /// 注:只针对病程记录 /// </summary> /// <returns></returns> public static List <EmrModel> GetAllEmrModels(TreeListNodes nodes, List <EmrModel> list) { try { if (null == nodes || nodes.Count == 0) { return(list); } if (null == list) { list = new List <EmrModel>(); } foreach (TreeListNode node in nodes) { if (null != node.Tag && node.Tag is EmrModel) { EmrModel modelevey = (EmrModel)node.Tag; if (modelevey.DailyEmrModel) { list.Add(modelevey); } } else if (null != node.Nodes && node.Nodes.Count > 0) { list = GetAllEmrModels(node.Nodes, list); } } return(list); } catch (Exception ex) { throw ex; } }
private void getNodes(TreeListNodes nodes) { foreach (TreeListNode item in nodes) { if (item.HasChildren) { getNodes(item.Nodes); } else { if (item.Checked) { DataRowView v = this.treeListEx1.GetDataRecordByNode(item) as DataRowView; if (v != null) { if (v["LB"].Equals("子目")) { //if(v) this.treeListEx1.CheckNodes.Add(v); } } } } } }
//删除注册连接 private void buttonDelConnecte_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { Boolean result = false; TreeListNodes selectNode = this.treeList1.Nodes; foreach (TreeListNode node in selectNode) { if (node.Checked) { if (this.treeList1.IsRootNode(node)) { DataRowView nodeData = this.treeList1.GetDataRecordByNode(node) as DataRowView; ConnectDB cd = new ConnectDB(); result = cd.Delete("DELETE from GISDATA_REGCONNECT WHERE ID = " + nodeData["ID"]); if (!result) { break; } } } } if (result) { MessageBox.Show("删除成功!", "提示"); refreshTreeViewReg(); } } }
private void btn_Save_Click(object sender, EventArgs e) { DataSet set; string str = this.method_1(this.treeList1); TreeListNodes nodes = this.treeList1.Nodes[0].Nodes; switch (Class11.string_1) { case "US": this.string_0 = string.Concat(new object[] { "UPDATE [tblUser]SET [rpright] ='", Class13.smethod_2(str), "' WHERE id = ", Class7.int_0 }); this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_0, this.oleDbConnection_0); using (set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_0.Close(); break; case "GRP": this.string_0 = "UPDATE [tblUserGrp]SET [rpright] ='" + Class13.smethod_2(str) + "' WHERE id = '" + Class7.string_0 + "' "; this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_0, this.oleDbConnection_0); using (set = new DataSet()) { this.oleDbDataAdapter_0.Fill(set); } this.oleDbConnection_0.Close(); break; } base.Close(); }
private void GetPersonalModelTreeNode(TreeListNodes nodes, DataTable data, int nodeID) { foreach (TreeListNode treeListNode in nodes) { DataRow dataRow = data.NewRow(); dataRow["NodeName"] = treeListNode.GetValue("ModelName"); dataRow["NodeID"] = this.m_NodeID++; if (treeListNode.ParentNode != null) { dataRow["ParentNodeID"] = nodeID; } else { dataRow["ParentNodeID"] = -1; } if (treeListNode.GetValue("TemplatePersonID").ToString() != "") { dataRow["TemplatePersonID"] = treeListNode.GetValue("TemplatePersonID"); } else { dataRow["TemplatePersonID"] = -1; } data.Rows.Add(dataRow); if (treeListNode.Nodes.Count > 0) { this.GetPersonalModelTreeNode(treeListNode.Nodes, data, Convert.ToInt32(dataRow["NodeID"])); } } }
/// <summary> /// 获取选中节点的所有最底级的cid /// </summary> /// <param name="nodes"></param> /// <returns></returns> private List <string> GetCheckedCids(TreeListNodes nodes) { List <string> cidlist = new List <string>(); foreach (TreeListNode node in nodes) { if (node.Checked && node.Tag != null) { if (!node.HasChildren)//有子类目 { TreeListNodeTag tag = node.Tag as TreeListNodeTag; cidlist.Add(tag.Cid); } else if (node.Nodes.Count == 0)//没有子类目但子节点个数为0 { TreeListNodeTag tag = node.Tag as TreeListNodeTag; /*查询cid下的所有最底级子类目*/ cidlist.AddRange(GetChildCids(tag.Cid)); } else//没有子类目但子节点个数不为0 { cidlist.AddRange(GetCheckedCids(node.Nodes)); } } } return(cidlist); }
void CalcRowFooterInfo(TreeListNode node, CalcRowGroupInfoArgs rowArgs) { FieldInfo fi = node.GetType().GetField("owner", BindingFlags.Instance | BindingFlags.NonPublic); TreeListNodes owner = fi.GetValue(node) as TreeListNodes; PropertyInfo pr = owner.GetType().GetProperty("LastNodeEx", BindingFlags.Instance | BindingFlags.NonPublic); TreeListNode lastNode = pr.GetValue(owner, null) as TreeListNode; if (node == lastNode) { if (!(TreeListFilterHelper.HasVisibleChildren(node) && node.Expanded)) { bool even = IsEven(rowArgs.Index); CalcRowFooterInfo(RowsInfo.Rows.Count - 1, node, rowArgs, even); TreeListNode parent = node.ParentNode; if (parent != null) { owner = fi.GetValue(parent) as TreeListNodes; lastNode = pr.GetValue(owner, null) as TreeListNode; } while (parent != null && parent == lastNode) { even = !even; CalcRowFooterInfo(RowsInfo.Rows.Count - 1, parent, rowArgs, even); node = parent; parent = parent.ParentNode; if (parent != null) { owner = fi.GetValue(parent) as TreeListNodes; lastNode = pr.GetValue(owner, null) as TreeListNode; } } } } }
public static void ForEach(this TreeListNodes nodes, Action <TreeListNode> action) { foreach (TreeListNode node in nodes) { action(node); } }
private void Save_Node(TreeListNodes MainNodes) { try { foreach (TreeListNode n in MainNodes) { if (string.IsNullOrWhiteSpace(n["ID"].ToString())) { throw (new Exception("ID 不能为空")); } if (Exist_Node(n)) { if (!Edit_Node(n)) { continue; } } else { if (!Add_Node(n)) { continue; } ; } if (n.Nodes.Count > 0) { //递归调用 Save_Node(n.Nodes); } } } catch (Exception ex) { throw (ex); } }
public static void GetFirstDailyEmrModelInner(TreeList treeList, TreeListNodes nodes) { try { if (nodes == null) { FirstDailyEmrModel = null; nodes = treeList.Nodes; } if (FirstDailyEmrModel != null) { return; } foreach (TreeListNode subNode in nodes) { EmrModel model = subNode.Tag as EmrModel; if (model != null && model.FirstDailyEmrModel) { FirstDailyEmrModel = model; } GetFirstDailyEmrModelInner(treeList, subNode.Nodes); } } catch (Exception) { throw; } }
private void pfeZyQnoF(int int_0) { this.string_0 = " Select * from tblUser where id = " + int_0; this.oleDbDataAdapter_0 = new OleDbDataAdapter(this.string_0, this.oleDbConnection_0); DataTable dataTable = new DataTable(); this.oleDbDataAdapter_0.Fill(dataTable); string[] strArray = Class13.smethod_2(dataTable.Rows[0]["rpright"].ToString()).Split(new char[] { ';' }); int index = 0; string str2 = null; TreeListNodes nodes = this.treeList1.Nodes[0].Nodes; string str3 = null; foreach (TreeListNode node in nodes) { str3 = node.GetValue(0).ToString(); for (index = 0; index <= (strArray.Length - 1); index++) { str2 = strArray[index].ToString(); if (str3 == str2) { node.Tag = 1; } } } this.treeList1.ExpandAll(); }
internal override void PerformAction() { TreeList treeList = _targetNode.TreeList; //-A- first move directly in treeview ... int targetIndex = treeList.GetNodeIndex(_targetNode); int selectionTopIndex = treeList.GetNodeIndex(_moveNodes.First()); int selectionBotIndex = treeList.GetNodeIndex(_moveNodes.Last()); //move up (accomplished by moving the selection above target node - or above target node's next node, if move below target) if (targetIndex < selectionTopIndex) { int index = _moveAboveTarget ? targetIndex : targetIndex + 1; foreach (TreeListNode node in _moveNodes) { treeList.SetNodeIndex(node, index++); } } //move down (accomplished by moving the nodes between selection and targetNode above selection - including target node itself, if move below target) else if (targetIndex > selectionBotIndex) { List <TreeListNode> shiftUpNodes = new List <TreeListNode>(); foreach (TreeListNode node in _targetNode.ParentNode == null ? treeList.Nodes : _targetNode.ParentNode.Nodes) { if (treeList.GetNodeIndex(node) > selectionBotIndex && (treeList.GetNodeIndex(node) < targetIndex || !_moveAboveTarget && treeList.GetNodeIndex(node) == targetIndex)) { shiftUpNodes.Add(node); } } foreach (TreeListNode node in shiftUpNodes) { treeList.SetNodeIndex(node, selectionTopIndex++); } } //else: target inside selection: should not happen unless programming error (thus do nothing) //-B- then reenact in data: avoids flickering and saves time, compared to reorder in data and update tree, though the latter may be cleaner TreeListNodes nodes = _targetNode.ParentNode == null ? treeList.Nodes : _targetNode.ParentNode.Nodes; //this takes care of the "hidden" uprating-policy (which is in fact not hidden in the narrow sense, but only exists in data but not in the tree) int allowForNotDisplayedPolicy = 0; if (_targetNode.ParentNode == null) //moved node is a policy-node { //re-order the policies starting with oder of hidden uprating-policy plus 1 CountryConfig.PolicyRow firstPol = CountryConfigFacade.GetFirstPolicyRow((_targetNode.Tag as BaseTreeListTag).GetDefaultPolicyRow().SystemRow); if (firstPol.Name.StartsWith(EM_UI.UpratingIndices.UpratingIndicesForm._policyUprateFactors_Name)) { CountryAdministration.CountryAdministrator.GetCountryConfigFacade(EM_AppContext.Instance.GetActiveCountryMainForm().GetCountryShortName()); } allowForNotDisplayedPolicy = EM_Helpers.SaveConvertToInt(firstPol.Order) + 1; } foreach (TreeListNode node in nodes) { (node.Tag as BaseTreeListTag).SetOrder(treeList.GetNodeIndex(node) + allowForNotDisplayedPolicy); } }
private void TranslateMenu(TreeListNodes parent) { foreach (TreeListNode item in parent) { switch (item.GetDisplayText(0)) { case "Setup": item.SetValue(0, Translations.TranslationGet("WNDCAPTION_SETUP", "DE", "Setup")); break; case "Players": item.SetValue(0, Translations.TranslationGet("STR_PLAYERS", "DE", "Players")); break; case "Dossier Monitor": item.SetValue(0, Translations.TranslationGet("STR_DOSMONITOR", "DE", "Dossier Monitor")); break; case "Display": item.SetValue(0, Translations.TranslationGet("STR_DISPLAY", "DE", "Display")); break; case "Dossier File Sharing": item.SetValue(0, Translations.TranslationGet("STR_DOSFILESHARING", "DE", "Dossier File Sharing")); break; case "Kill Counts": item.SetValue(0, Translations.TranslationGet("STR_KILLCOUNTS", "DE", "Kill Counts")); break; case "Recent Battles": item.SetValue(0, Translations.TranslationGet("STR_RECENTBATTLES", "DE", "Recent Battles")); break; case "Charts": item.SetValue(0, Translations.TranslationGet("STR_CHARTS", "DE", "Charts")); break; case "Reports": item.SetValue(0, Translations.TranslationGet("STR_REPORTS", "DE", "Reports")); break; case "Colors": item.SetValue(0, Translations.TranslationGet("STR_COLORS", "DE", "Colors")); break; case "vBAddict.net": item.SetValue(0, Translations.TranslationGet("STR_ONLINEANALYZER", "DE", "vBAddict.net Online Analyzer")); break; default: break; } if (item.HasChildren) { TranslateMenu(item.Nodes); } } }
/// <summary> /// 创建树节点 /// </summary> /// <param name="node">节点</param> /// <param name="obj">对象</param> public static void CreateTreeNode(TreeListNodes nodes, object obj) { var objNode = nodes.Add(GetObjectString(obj), obj); // 创建属性 CreateChildNodesByObject(objNode, obj, null); objNode.Expanded = true; }
protected override void InternalNodeChanged(TreeListNode node, TreeListNodes nodes, NodeChangeTypeEnum changeType) { if (changeType == NodeChangeTypeEnum.User1) { LayoutChanged(); } base.InternalNodeChanged(node, nodes, changeType); }
void CreateMessagesList(TreeListNodes nodes) { foreach (TreeListNode node in nodes) { CreateMessagesForNode(node); CreateMessagesList(node.Nodes); } }
/// <summary> /// 设置默认的值 /// </summary> /// <param name="nodes"></param> private void SetTreeListDefault(TreeListNodes nodes) { for (int i = 0; i < nodes.Count; i++) { nodes[i].Tag = GetCheckState(nodes[i].Tag); SetTreeListDefault(nodes[i].Nodes); } }
/// <summary> /// 遍历树节点 /// </summary> private Boolean RecursionNodes(TreeListNodes Nodes) { ConnectDB cd = new ConnectDB(); Boolean boolFlag = true; foreach (TreeListNode node in Nodes) { //// 如果当前节点下还包括子节点,就调用递归 if (node.Nodes.Count > 0) { RecursionNodes(node.Nodes); } else { if (node.Checked && !node.HasChildren) { DataRowView nodeData = this.treeList1.GetDataRecordByNode(node) as DataRowView; IWorkspaceFactory pWorkspaceFactory = new AccessWorkspaceFactoryClass(); IFeatureWorkspace pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(nodeData["PATH"].ToString(), 0) as IFeatureWorkspace; //打开数据文件中航路点这个表 IFeatureClass pFeatureClass = pFeatureWorkspace.OpenFeatureClass(nodeData["NAME"].ToString()); string FeatureType = pFeatureClass.ShapeType.ToString(); Boolean result = cd.Insert("insert into GISDATA_REGINFO (REG_NAME,REG_ALIASNAME,FEATURE_TYPE,PATH,DBTYPE) values ('" + nodeData["NAME"].ToString() + "','" + nodeData["NAME"].ToString() + "','" + FeatureType + "','" + nodeData["PATH"].ToString().Replace(@"\", @"\\") + "','" + nodeData["TYPE"].ToString() + "')"); CommonClass common = new CommonClass(); common.insertXmlNode(nodeData["NAME"].ToString(), nodeData["PATH"].ToString(), nodeData["TYPE"].ToString(), nodeData["NAME"].ToString()); if (result) { for (int i = 0; i < pFeatureClass.Fields.FieldCount; i++) { IField field = pFeatureClass.Fields.get_Field(i); if (field.Name != pFeatureClass.ShapeFieldName && field.Name != pFeatureClass.OIDFieldName) { string REG_NAME = nodeData["NAME"].ToString(); string FIELDID = i.ToString(); string FIELD_NAME = field.Name; string FIELD_ALSNAME = field.AliasName; string DATA_TYPE = field.Type.ToString(); string MAXLEN = field.Length.ToString(); string MINLEN = field.Length.ToString(); string CODE_PK = ""; string CODE_WHERE = ""; string IS_NULL = field.IsNullable.ToString(); string DEFAULT_VALUE = field.DefaultValue.ToString(); Boolean insertResult = cd.Insert("insert into GISDATA_MATEDATA (REG_NAME,FIELDID,FIELD_NAME,FIELD_ALSNAME,DATA_TYPE,MAXLEN,MINLEN,CODE_PK,CODE_WHERE,IS_NULL,DEFAULT_VALUE) values ('" + REG_NAME + "','" + FIELDID + "','" + FIELD_NAME + "','" + FIELD_ALSNAME + "','" + DATA_TYPE + "','" + MAXLEN + "','" + MINLEN + "','" + CODE_PK + "','" + CODE_WHERE + "','" + IS_NULL + "','" + DEFAULT_VALUE + "')"); if (!insertResult) { boolFlag = false; } } } } } } } return(boolFlag); }
/// <summary> /// 默认展开 /// </summary> /// <param name="nodes"></param> private void InitTreeExpand(TreeListNodes nodes) { foreach (TreeListNode node in nodes) { if (node.Nodes.Count > 0) { node.Expanded = true; } } }
/// <summary> /// 重置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barBtnReset_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TreeListNodes nodes = treeListPermission.Nodes; foreach (TreeListNode node in nodes) { setChildNodeCheckedState(node, false); node.Checked = false; } }
private void FlagChildren(TreeListNodes nodes, bool value) { foreach (TreeListNode node in nodes) { if (node.HasChildren) { this.FlagChildren(node.Nodes, value); } node[this.colVisible] = value; this.CheckNode(node, true); } }
string getcode(TreeListNode pnode, TreeListNodes nodes) { string code = ""; int levenum = 3; if (pnode!=null && pnode.Level == 0) levenum = 4; string linecode = "";// pnode["LineCode"].ToString(); if (pnode != null ) {//可能与低压线路重号 linecode = pnode["LineCode"].ToString(); string sql = string.Format("Select max(linecode) as LineCode from ps_xl where len(linecode)={2} and Left(linecode,{0})='{1}'", linecode.Length,linecode,linecode.Length+levenum); Hashtable ht = Client.ClientHelper.PlatformSqlMap.GetObject("Select", sql) as Hashtable; if (ht != null && ht["LineCode"]!=null) { string childcode = ht["LineCode"].ToString(); if (!string.IsNullOrEmpty(childcode)) { int maxcode = int.Parse(childcode.Substring(linecode.Length, levenum)); if (levenum == 4) { code = linecode + (maxcode + 10).ToString("0000"); } else { code = linecode + (maxcode + 1).ToString("000"); } } } } if(code==""){ if (nodes.Count > 0) { int maxcode = 0; foreach (TreeListNode node in nodes) { linecode = node["LineCode"].ToString(); maxcode = Math.Max(maxcode, int.Parse(linecode.Substring(linecode.Length - levenum, levenum))); } if (levenum == 4) { code = linecode.Substring(0, linecode.Length - levenum) + (maxcode + 10).ToString("0000"); } else { code = linecode.Substring(0, linecode.Length - levenum) + (maxcode + 1).ToString("000"); } } else { if (pnode != null) { if (pnode.Level == 0) code = pnode["LineCode"].ToString() + "0010"; else code = pnode["LineCode"].ToString() + "001"; } else { code = ParentObj.OrgCode + "001"; } } } return code; }
private void getCheckList(TreeListNodes nodes, IList<string> list) { foreach (TreeListNode node in nodes) { if (node.Checked && node["ParentID"].ToString() != "") { list.Add(node["ID"].ToString()); } if (node.HasChildren) { this.getCheckList(node.Nodes, list); } } }
private void setImages(TreeListNodes nodes) { treeList1.BeginInit(); foreach (TreeListNode node in nodes) { if (node.Nodes.Count > 0) { setImages(node.Nodes); node.ImageIndex = 0; } else { node.ImageIndex = 1; } } treeList1.EndInit(); }
private void AddDT(TreeListNodes Nodes) { foreach (TreeListNode Node in Nodes) { DataRow newrow = DT.NewRow(); newrow["Title"] = AddStr(Node.Level) + Node["Title"].ToString(); newrow["ID"] = Node["ID"].ToString(); newrow["ParentID"] = Node["ParentID"].ToString(); for (int i = firstyear; i <= endyear; i++) { newrow["y" + i] = Node["y" + i]; } DT.Rows.Add(newrow); if (Node.Nodes.Count>0) { AddDT(Node.Nodes); } } }
private async Task SavePermission(TreeListNodes nodes, bool is_user) { List<SYS_tblPermissionDTO> permissionList = new List<SYS_tblPermissionDTO>(); try { CommonEngine.ShowWaitForm(this); SYS_tblPermissionDRO result = new SYS_tblPermissionDRO(); permissionList = GetAllPermission(nodes); foreach (var item in oldPermissionList) { var _item = (from per in permissionList where per.ID == item.ID && per.FunctionID == item.FunctionID select per).FirstOrDefault(); if (_item != null) { if (_item.AllowInsert == item.AllowInsert && _item.AllowUpdate == item.AllowUpdate && _item.AllowDelete == item.AllowDelete && _item.AllowPrint == item.AllowPrint && _item.AllowImport == item.AllowImport && _item.AllowExport == item.AllowExport && _item.AllowAll == item.AllowAll && _item.AllowAccess == item.AllowAccess && _item.UserLevelID == item.UserLevelID && _item.Note == item.Note) permissionList.Remove(_item); } } string strMessage = LanguageEngine.GetMessageCaption("000024", ConfigEngine.Language).Replace("$Type$", is_user ? (ConfigEngine.Language.Equals("vi") ? "người dùng" : "user") : (ConfigEngine.Language.Equals("vi") ? "nhóm người dùng" : "group user")).Replace("$Name$", trlUser.FocusedNode.GetDisplayText(tlcName)); result = await SYS_tblPermissionBUS.UpdatePermission(CommonEngine.userInfo.UserID, ConfigEngine.Language, permissionList, is_user, new SYS_tblActionLogDTO { Activity = BaseConstant.COMMAND_INSERT_EN, UserID = CommonEngine.userInfo.UserID, LanguageID = ConfigEngine.Language, ActionEN = BaseConstant.COMMAND_UPDATE_EN, ActionVN = BaseConstant.COMMAND_UPDATE_VI, FunctionID = "24", DescriptionVN = strMessage.Replace("$IsError$", "thành công"), DescriptionEN = strMessage.Replace("$IsError$", "successfully") }); CommonEngine.CloseWaitForm(); if (CommonEngine.CheckValidResponseItem(result.ResponseItem)) { if (string.IsNullOrEmpty(result.ResponseItem.Message)) CommonEngine.ShowMessage(strMessage.Replace("$IsError$", ConfigEngine.Language.Equals("vi") ? "thành công" : "successfully").Trim(), MessageType.Success); else CommonEngine.ShowMessage(strMessage.Replace("$IsError$", ConfigEngine.Language.Equals("vi") ? "thất bại" : "failed").Trim(), MessageType.Error); await LoadPermission(trlUser.FocusedNode.GetDisplayText(tlcCode) + "", rootNode, trlUser.FocusedNode.Level == 0 ? false : true); } else return; } catch (Exception ex) { CommonEngine.ShowExceptionMessage(ex); } }
private void SetChecked(TreeListNodes nodes, Dictionary<string, rRoleModul> dic) { foreach (TreeListNode node in nodes) { if (dic.ContainsKey(node["Modu_ID"].ToString())) { node.Checked = true; } if (node.HasChildren) { this.SetChecked(node.Nodes, dic); } } }
private TreeListNode FindLastNode(TreeListNodes parentNodes, string name) { foreach (TreeListNode node in parentNodes) { if (node["NAME"].ToString() == name) { return node; } } return null; }
int GetExpandedRowCount(TreeListNodes nodes) { int count = 0; foreach(TreeListNode node in nodes) { count++; if(node.Expanded) count += GetExpandedRowCount(node.Nodes); } return count; }
string getcode(TreeListNode pnode, TreeListNodes nodes) { string code = ""; int levenum = 3; //if (pnode != null && pnode.Level == 0) levenum = 4; string linecode = "";// pnode["LineCode"].ToString(); if (pnode != null) { linecode = pnode["材料代码"].ToString(); string sql = string.Format("Select max(材料代码) as LineCode from JH_yearkst where len(材料代码)={2} and Left(材料代码,{0})='{1}'", linecode.Length, linecode, linecode.Length + levenum); Hashtable ht = Client.ClientHelper.TransportSqlMap.GetObject("Select", sql) as Hashtable; if (ht != null && ht["LineCode"] != null) { string childcode = ht["LineCode"].ToString(); if (!string.IsNullOrEmpty(childcode)) { int maxcode = int.Parse(childcode.Substring(linecode.Length, levenum)); code = linecode + (maxcode + 1).ToString("000"); } } } if (code == "") { if (nodes.Count > 0) { int maxcode = 0; foreach (TreeListNode node in nodes) { linecode = node["材料代码"].ToString(); maxcode = Math.Max(maxcode, int.Parse(linecode.Substring(linecode.Length - levenum, levenum))); } code = linecode.Substring(0, linecode.Length - levenum) + (maxcode + 1).ToString("000"); } else { if (pnode != null) { code = pnode["材料代码"].ToString() + "001"; } else { code = "001"; } } } return code; }
private void AddNode(TreeList tree, TreeListNodes nodeSource, TreeListNode nodeParent) { foreach (DevExpress.XtraTreeList.Nodes.TreeListNode nodeSub in nodeSource) { object[] objValues = new object[2]; objValues[0] = nodeSub.GetValue("RuleName"); objValues[1] = nodeSub.GetValue("rulesCount"); TreeListNode nodeCurrent = tree.AppendNode(objValues, nodeParent); if (nodeSub.HasChildren) { AddNode(tree, nodeSub.Nodes, nodeCurrent); } } }
private bool IsAllChecked(TreeListNodes node) { bool bol = true; foreach (TreeListNode subNode in node) { if (!subNode.Checked) { bol = false; return bol; } else { bol = IsAllChecked(subNode.Nodes); if (!bol) { return bol; } } } return bol; }
private TreeListNode NodeByName(TreeListNodes nodes, string name) { TreeListNode node = null; foreach (TreeListNode node2 in nodes) { if (node2.HasChildren && (node == null)) { node = this.NodeByName(node2.Nodes, name); } if (node2.GetValue(this.colFilterName).ToString() == name) { return node2; } } return node; }
private string GenerateSelectionFilterStringbyNodeNoLevel(TreeListNodes Nodes, DevExpress.XtraTreeList.TreeList treeList) { string Filter = ""; foreach (TreeListNode tn in Nodes) { DataRowView dr = (treeList.GetDataRecordByNode(tn) as DataRowView); if (tn.Checked) Filter = Filter + dr["Value"] + ","; else Filter = Filter + GenerateSelectionFilterStringbyNode(tn.Nodes, treeList); } return Filter; }
private string CaptureAllValuesOfSubNodes(TreeListNodes lstNodes, int iColId) { Logger.logBegin("CaptureAllValuesOfSubNodes"); string strResult = "",strCaption; foreach (TreeListNode objNode in lstNodes) { strCaption=objNode.GetValue(iColId).ToString() ; strResult = string.IsNullOrEmpty(strResult) ? strCaption : string.Format("{0}\r\n{1}", strResult, strCaption); if (objNode.HasChildren && objNode.Expanded) { strCaption = CaptureAllValuesOfSubNodes(objNode.Nodes, iColId); strResult = string.IsNullOrEmpty(strResult) ? strCaption : string.Format("{0}\r\n{1}", strResult, strCaption); } } Logger.logEnd("CaptureAllValuesOfSubNodes"); return strResult; }
private bool FindNodeBySettings(TreeListNodes treeListNodes, int iDepths, int iCurrentDep, string[] arrSearchItems, ref TreeListNode objFindNode, int iColumnId = 0) { Logger.logBegin(string.Format("FindNodeBySettings with level [{0}]", iCurrentDep)); try { IEnumerator en = treeListNodes.GetEnumerator(); en.Reset(); while (en.MoveNext()) { TreeListNode objOneItem = (TreeListNode)en.Current; if (objOneItem.GetValue(iColumnId) == null) continue; string strNodeCaption = objOneItem.GetValue(iColumnId).ToString(); Logger.Info("FindNodeBySettings", string.Format("tring to compare node value [{0}] against [{1}]", strNodeCaption, arrSearchItems[iCurrentDep])); if (TigerMarsUtil.RegularTest(arrSearchItems[iCurrentDep], strNodeCaption)) { if (iCurrentDep == iDepths - 1) { objFindNode = objOneItem; /** expand all **/ ExpandParents(objOneItem); return true; } if (objOneItem.HasChildren) { bool isFind = FindNodeBySettings(objOneItem.Nodes, iDepths, iCurrentDep + 1, arrSearchItems, ref objFindNode,iColumnId); if (isFind) { Logger.Info("FindNodeBySettings", "find node"); return true; } else { Logger.Info("FindNodeBySettings", string.Format("Not find for node:[{0}] and its Descendants", strNodeCaption)); continue; } } else { continue; } } else { continue; } } return false; } catch (Exception e) { Logger.Error("FindNodeBySettings",string.Format("Exceptions:[{0}]",e.Message),e); return false; } finally { Logger.logBegin(string.Format("FindNodeBySettings with level [{0}]", iCurrentDep)); } }
private void AcceptSelectedNode_GroupChild(TreeListNodes nodes) { foreach (TreeListNode n in nodes) { if (n.Checked && n[IsGroupField].ToString() == "N") { SelectedNames += n[DisplayField].ToString() + ","; SelectedIDs.Add(HelpNumber.ParseInt64(n[IDField])); } AcceptSelectedNode_GroupChild(n.Nodes); } }
CheckState GetParentNodeState(TreeListNodes nodes) { CheckState state = nodes[0].CheckState; foreach (TreeListNode node in nodes) if (node.CheckState != state) return CheckState.Indeterminate; return state; }
private void ProcessTreeValidity(TreeListNodes nodesToProcess) { foreach (TreeListNode node in nodesToProcess) { if (GetNodeCheckState(node) == CheckState.Unchecked && node.ImageIndex == GreenBulletValue) { continue; } ValidateNode(node); ProcessTreeValidity(node.Nodes); } }
//����ID�ҵ�����㲢��Ϊ��ǰ��� private void FindCurrentNodeById(TreeListNodes nodes, string ID) { foreach (TreeListNode node in nodes) { if (node["ID"].ToString() == ID) { treeList1.FocusedNode = node; break; } else { if (node.Nodes.Count != 0) { FindCurrentNodeById(node.Nodes, ID); } } } }
//�������ɺ�check��oldcheck��Ϊ���ֵ���Ա��´θ���ʱ��� private void EqueValueBynode(TreeListNodes nodes) { //if (nodes != null) //{ // foreach (TreeListNode node in nodes) // { // EqueVlaueDataTable(node.GetValue("ID").ToString(), (CheckState)node.GetValue("check"), (CheckState)node.GetValue("check")); // if (node.HasChildren) // { // EqueValueBynode(node.Nodes); // } // } //} if (nodes != null) { for (int i = 0; i < nodes.Count; i++) { TreeListNode node = nodes[i]; EqueVlaueDataTable(node.GetValue("ID").ToString(), (CheckState)node.GetValue("check"), (CheckState)node.GetValue("check")); if (node.HasChildren) { EqueValueBynode(node.Nodes); } } } }
private static void TreeListExpanded(TreeListNodes treeListNodes, ICollection<object> nodesPath) { if (treeListNodes == null) { return; } if (treeListNodes.Count > 0) { foreach (TreeListNode treeListNode in treeListNodes) { if (treeListNode.Expanded) { nodesPath.Add(treeListNode.GetValue(TreeListHelper._treeList.Columns[1].FieldName)); TreeListHelper.TreeListExpanded(treeListNode.Nodes, nodesPath); } } } }
//��ѡ�����ı��ֵ��ѡ���� private void AddorReduListBynode(TreeListNodes nodes, List<string> addlist,List<string> redulist) { if (nodes!= null) { foreach (TreeListNode node in nodes) { if (node.ParentNode!=null&&node.GetValue("check").ToString() != "0" && node.GetValue("oldcheck").ToString() == "0") { AddListID.Add(node.GetValue("ID").ToString()); if (node.GetValue("nowunits").ToString()!="") { addlist.Add(node.GetValue("TypeName").ToString() + "(" + node.GetValue("nowunits").ToString()+")"); } else { addlist.Add(node.GetValue("TypeName").ToString()); } } if (node.ParentNode != null && node.GetValue("check").ToString() == "0" && node.GetValue("oldcheck").ToString() != "0") { ReduceListID.Add(node.GetValue("ID").ToString()); if (node.GetValue("nowunits").ToString() != "") { redulist.Add(node.GetValue("TypeName").ToString() + "(" + node.GetValue("nowunits").ToString() + ")"); } else { redulist.Add(node.GetValue("TypeName").ToString()); } } bool val1 = node.ParentNode != null && node.GetValue("check").ToString() != "0" && node.GetValue("oldcheck").ToString() == "0"; bool val2 = node.ParentNode != null && node.GetValue("check").ToString() == "0" && node.GetValue("oldcheck").ToString() != "0"; if (!val1 && !val2 && node.ParentNode != null && node.GetValue("nowunits").ToString() != node.GetValue("oldunits").ToString() && node.GetValue("check").ToString() != "0") { changeUnitlistID.Add(node.GetValue("ID").ToString()); if (node.GetValue("nowunits").ToString() != "") { changeUnitlist.Add(node.GetValue("TypeName").ToString() + "(" + node.GetValue("nowunits").ToString() + ")"); } else { changeUnitlist.Add(node.GetValue("TypeName").ToString()); } } if (node.HasChildren) { AddorReduListBynode(node.Nodes, addlist, redulist); } } } }
private IEnumerable<int?> SaveNodeStates(TreeListNodes nodes) { foreach (TreeListNode treeListNode in nodes) { if (treeListNode.Expanded) { var data = (Drawing) tlDarwings.GetDataRecordByNode(treeListNode); yield return data.Id; foreach (var id in SaveNodeStates(treeListNode.Nodes)) { yield return id; } } } }
//private void SetChecked(TreeListNodes nodes, Dictionary<string, rUserRole> dic) { // foreach (TreeListNode node in nodes) { // if (dic.ContainsKey(node["UserID"].ToString())) // { // node.Checked = true; // if (node.ParentNode != null && !node.ParentNode.Checked) // node.ParentNode.Checked = true; // } // if (node.HasChildren) { // this.SetChecked(node.Nodes, dic); // } // } //} private void SetChecked(TreeListNodes nodes, Dictionary<string, string > dic) { foreach (TreeListNode node in nodes) { if (dic.ContainsKey(node["UserID"].ToString())) { node.Checked = true; if (node.ParentNode != null && !node.ParentNode.Checked) node.ParentNode.Checked = true; } if (node.HasChildren) { this.SetChecked(node.Nodes, dic); } } }
private void FoucsLocation(string id, TreeListNodes tlns) { foreach (TreeListNode tln in tlns) { if (tln["ID"].ToString() == id) { treeList1.FocusedNode = tln; return; } FoucsLocation(id, tln.Nodes); } }
private void getOrgCheckList(TreeListNodes nodes, IList<string> list) { foreach (TreeListNode node in nodes) { if (node.Checked && node["Type"].ToString() == "orgtemp") { list.Add(node["UserID"].ToString()); } if (node.HasChildren) { this.getOrgCheckList(node.Nodes, list); } } }
private void CheckNodes(TreeListNodes nodes, CheckState state) { foreach (TreeListNode node in nodes) { if (node.ImageIndex == FOLDERICON || node.ImageIndex == FOLDERICON_EXPAND) continue; node.CheckState = state; AfterCheckNode(node); } }
private List<SYS_tblPermissionDTO> GetAllPermission(TreeListNodes nodes) { List<SYS_tblPermissionDTO> permissionList = new List<SYS_tblPermissionDTO>(); try { this.Cursor = Cursors.WaitCursor; foreach (TreeListNode node in nodes) { permissionList.Add(new SYS_tblPermissionDTO { ID = node.GetValue(tlcID) + "", FunctionID = node.GetValue(tlcFunctionID) + "", AllowAll = Convert.ToBoolean(node.GetValue(tlcAllowAll)), AllowInsert = Convert.ToBoolean(node.GetValue(tlcAllowInsert)), AllowUpdate = Convert.ToBoolean(node.GetValue(tlcAllowUpdate)), AllowDelete = Convert.ToBoolean(node.GetValue(tlcAllowDelete)), AllowAccess = Convert.ToBoolean(node.GetValue(tlcAllowAccess)), AllowPrint = Convert.ToBoolean(node.GetValue(tlcAllowPrint)), AllowImport = Convert.ToBoolean(node.GetValue(tlcAllowImport)), AllowExport = Convert.ToBoolean(node.GetValue(tlcAllowExport)), UserLevelID = node.GetValue(tlcUserLevel) + "", Note = node.GetValue(tlcNote) + "" }); permissionList.AddRange(GetAllPermission(node.Nodes)); } } catch (Exception ex) { CommonEngine.ShowExceptionMessage(ex); } finally { this.Cursor = Cursors.Default; } return permissionList; }