private void LoadChildren() { if (this.m_Parent.Source != null && this.m_Parent.Source.Count > 1) { foreach (Classify classifyParent in this.m_Parent.Source) { classifyParent.Children.m_Children = new ClassifyCollection(true); } //批量读取子分类 ClassifySearch ds = new ClassifySearch(this.m_Parent.Application); ds.Filters.Add(new ParentIdFilter(this.m_Parent.Source.GetIdForArray())); ds.OrderInfos.Add(false, new OrdinalNumberOrder()); ds.OrderInfos.Add(false, new IdOrder()); foreach (Classify classifyChildren in ds.Search(1, false, false, false)) { foreach (Classify classifyParent in this.m_Parent.Source) { if (classifyChildren.m_ParentId == classifyParent.ClassifyId) { classifyParent.m_Children.Add(classifyChildren); break; } } } foreach (Classify classifyParent in this.m_Parent.Source) { classifyParent.Children.m_Count = classifyParent.Children.m_Children.Count; } } else { ClassifySearch ds = new ClassifySearch(this.m_Parent.Application); ds.Filters.Add(new ParentIdFilter(this.m_Parent.ClassifyId)); ds.OrderInfos = new Searchs.SearchOrderInfoCollection <IClassifyOrder>(); ds.OrderInfos.Add(false, new OrdinalNumberOrder()); ds.OrderInfos.Add(false, new IdOrder()); this.m_Children = ds.Search(); this.m_Count = ds.RecordsetCount; foreach (Classify classify in this.m_Children) { classify.SetParent(this.m_Parent); } } }
/// <summary> /// 获取该集合中符合筛选条件的分类集合。 /// </summary> /// <param name="filters">分类筛选条件。</param> /// <returns></returns> public ClassifyCollection GetClassifys(ClassifyFilterCollection filters) { ClassifyCollection classifys = new ClassifyCollection(false); foreach (Classify classify in this) { if (filters.ClassifyFilterCheck(classify)) { classifys.Add(classify); } } return(classifys); }