/// <summary> /// 加载节点,第一次使用 /// </summary> private void AddChild() { ChildItems.Clear(); var grp = (from t in Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.InfoGroups where t.Key.Item1 == AreaId orderby t.Value.Index select t.Value).ToList(); this.ChildItems.Add(new RtuGrpItem(AreaId, 0, 3)); foreach (var f in grp) { this.ChildItems.Add(new RtuGrpItem(AreaId, f.GroupId, 2)); } //this.ChildItems.Add(new RtuGrpItem(AreaId, 0, 4)); for (int i = ChildItems.Count - 1; i >= 0; i--) { if (ChildItems[i].ChildItems.Count == 0) { ChildItems.RemoveAt(i); } } }
/// <summary> /// Pres the save. /// </summary> /// <param name="dbContext">The database context.</param> /// <param name="state">The state.</param> public override void PreSaveChanges(DbContext dbContext, System.Data.Entity.EntityState state) { if (state == System.Data.Entity.EntityState.Deleted) { ChildItems.Clear(); ParentItems.Clear(); } }
public override void Clear() { if (_childItems == null) { return; } ChildItems.Clear(); }
/// <summary> /// Pres the save. /// </summary> /// <param name="dbContext">The database context.</param> /// <param name="state">The state.</param> public override void PreSaveChanges(Data.DbContext dbContext, System.Data.Entity.EntityState state) { var channel = this.ContentChannel; if (state == System.Data.Entity.EntityState.Deleted) { ChildItems.Clear(); ParentItems.Clear(); } base.PreSaveChanges(dbContext, state); }
public void OrderChildsByDataAndText(bool recursive) { var orderedChildItems = this.ChildItems.OrderBy(c => c.Text).OrderBy(c => c.Data != null).ToArray(); ChildItems.Clear(); foreach (var childItem in orderedChildItems) { this.ChildItems.Add(childItem); } if (recursive) { foreach (var child in ChildItems) { child.OrderChildsByDataAndText(recursive); } } }
/// <summary> /// Pres the save. /// </summary> /// <param name="dbContext">The database context.</param> /// <param name="state">The state.</param> public override void PreSaveChanges(Data.DbContext dbContext, EntityState state) { var channel = this.ContentChannel; if (state == EntityState.Deleted) { ChildItems.Clear(); ParentItems.Clear(); DeleteRelatedSlugs(dbContext); } else { AssignItemGlobalKey(dbContext); } base.PreSaveChanges(dbContext, state); }
private void SearchChild() { if (string.IsNullOrWhiteSpace(XPath.SelectItem) == false) { List <HtmlNode> nodes = null; ControlExtended.SafeInvoke( () => nodes = HtmlDoc.DocumentNode.SelectNodesPlus(XPath.SelectItem, SelectorFormat.XPath).ToList()); ChildItems.Clear(); if (nodes == null) { XLogSys.Print.Info(GlobalHelper.Get("key_665")); return; } nodes.Execute(d => ChildItems.Add(new CrawlItem { XPath = d.XPath, SampleData1 = d.InnerHtml })); } }
/// <summary> /// 加载节点,第一次使用 /// </summary> private void AddChild() { ChildItems.Clear(); if (NodeType == 2) //grp { var tmlLstOfArea = (from t in Wlst.Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.Info where t.Value.AreaId == AreaId orderby t.Value.PhyId select t.Key).ToList(); var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetGroupInfomation(AreaId, NodeId); if (grp == null) { return; } var gprs = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp.LstTml); foreach (var f in gprs) { if (tmlLstOfArea.Contains(f) == false) { continue; } this.ChildItems.Add(new FieldNodeItem(f)); } } if (NodeType == 3) //all { var grp = Wlst.Sr.EquipmentInfoHolding.Services.AreaInfoHold.MySlef.GetAreaInfo(AreaId); var tmlLstOfArea = (from t in Wlst.Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.Info where t.Value.AreaId == AreaId orderby t.Value.PhyId select t.Key).ToList(); if (grp == null) { return; } var allrtus = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp.LstTml, AreaId, true); foreach (var f in allrtus.Item1) { if (tmlLstOfArea.Contains(f) == false) { continue; } var para = Wlst.Sr.EquipmentInfoHolding.Services.EquipmentDataInfoHold.GetInfoById(f); this.ChildItems.Add(new FieldNodeItem(f)); tmlLstOfArea.Remove(f); } var sortLst = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(allrtus.Item2); foreach (var f in sortLst) { if (tmlLstOfArea.Contains(f) == false) { continue; } this.ChildItems.Add(new FieldNodeItem(f)); tmlLstOfArea.Remove(f); } foreach (var f in tmlLstOfArea) { this.ChildItems.Add(new FieldNodeItem(f)); //todo xxxxxxxxxxxxxxxxxx 此代码应删除 当前测试使用 } } if (NodeType == 4) //spe { var tmlLstOfArea = (from t in Wlst.Sr.SlusglInfoHold.Services.SluSglInfoHold.MySlef.Info where t.Value.AreaId == AreaId select t.Key).ToList(); var grp = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuNotInAnyGroup(AreaId); if (grp.Count == 0) { return; } var gprs = Wlst.Sr.EquipmentInfoHolding.Services.ServicesGrpSingleInfoHold.GetRtuOrGrpIndex(grp); foreach (var f in tmlLstOfArea) { if (gprs.Contains(f) == false) { gprs.Add(f); } } foreach (var f in gprs) { if (tmlLstOfArea.Contains(f) == false) { continue; } this.ChildItems.Add(new FieldNodeItem(f)); } } //for (int i = ChildItems.Count - 1; i >= 0; i--) //{ // if (ChildItems[i].ChildItems.Count == 0) ChildItems.RemoveAt(i); //} }