/// <summary> Get a child page by code </summary> /// <param name="ChildCode"> Code for this child page </param> /// <returns> Either the matching page, or NULL </returns> public Item_Aggregation_Child_Page Child_Page_By_Code(string ChildCode) { if (Child_Pages == null) { return(null); } return(Child_Pages.FirstOrDefault(ChildPage => String.Compare(ChildCode, ChildPage.Code, StringComparison.InvariantCultureIgnoreCase) == 0)); }
/// <summary> Add a child page to this item aggregatiion </summary> /// <param name="ChildPage"> New child page to add </param> public void Add_Child_Page(Item_Aggregation_Child_Page ChildPage) { if (Child_Pages == null) { Child_Pages = new List <Item_Aggregation_Child_Page>(); } else { Item_Aggregation_Child_Page existingPage = Child_Page_By_Code(ChildPage.Code); if (existingPage != null) { Child_Pages.Remove(existingPage); } } Child_Pages.Add(ChildPage); }