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 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)); } }