/// <summary> /// Loads <see cref="E08_Region"/> items on the E07_RegionObjects collection. /// </summary> /// <param name="collection">The grand parent <see cref="E05_CountryColl"/> collection.</param> internal void LoadItems(E05_CountryColl collection) { foreach (var item in this) { var obj = collection.FindE06_CountryByParentProperties(item.parent_Country_ID); var rlce = obj.E07_RegionObjects.RaiseListChangedEvents; obj.E07_RegionObjects.RaiseListChangedEvents = false; obj.E07_RegionObjects.Add(item); obj.E07_RegionObjects.RaiseListChangedEvents = rlce; } }
/// <summary> /// Factory method. Loads a <see cref="E04_SubContinent"/> object from the given E04_SubContinentDto. /// </summary> /// <param name="data">The <see cref="E04_SubContinentDto"/>.</param> /// <returns>A reference to the fetched <see cref="E04_SubContinent"/> object.</returns> internal static E04_SubContinent GetE04_SubContinent(E04_SubContinentDto data) { E04_SubContinent obj = new E04_SubContinent(); // show the framework that this is a child object obj.MarkAsChild(); obj.Fetch(data); obj.LoadProperty(E05_CountryObjectsProperty, E05_CountryColl.NewE05_CountryColl()); obj.MarkOld(); return(obj); }
/// <summary> /// Loads child objects from the given SafeDataReader. /// </summary> /// <param name="dr">The SafeDataReader to use.</param> private void FetchChildren(SafeDataReader dr) { dr.NextResult(); if (dr.Read()) { LoadProperty(E03_Continent_SingleObjectProperty, E03_Continent_Child.GetE03_Continent_Child(dr)); } dr.NextResult(); if (dr.Read()) { LoadProperty(E03_Continent_ASingleObjectProperty, E03_Continent_ReChild.GetE03_Continent_ReChild(dr)); } dr.NextResult(); LoadProperty(E03_SubContinentObjectsProperty, E03_SubContinentColl.GetE03_SubContinentColl(dr)); dr.NextResult(); while (dr.Read()) { var child = E05_SubContinent_Child.GetE05_SubContinent_Child(dr); var obj = E03_SubContinentObjects.FindE04_SubContinentByParentProperties(child.subContinent_ID1); obj.LoadChild(child); } dr.NextResult(); while (dr.Read()) { var child = E05_SubContinent_ReChild.GetE05_SubContinent_ReChild(dr); var obj = E03_SubContinentObjects.FindE04_SubContinentByParentProperties(child.subContinent_ID2); obj.LoadChild(child); } dr.NextResult(); var e05_CountryColl = E05_CountryColl.GetE05_CountryColl(dr); e05_CountryColl.LoadItems(E03_SubContinentObjects); dr.NextResult(); while (dr.Read()) { var child = E07_Country_Child.GetE07_Country_Child(dr); var obj = e05_CountryColl.FindE06_CountryByParentProperties(child.country_ID1); obj.LoadChild(child); } dr.NextResult(); while (dr.Read()) { var child = E07_Country_ReChild.GetE07_Country_ReChild(dr); var obj = e05_CountryColl.FindE06_CountryByParentProperties(child.country_ID2); obj.LoadChild(child); } dr.NextResult(); var e07_RegionColl = E07_RegionColl.GetE07_RegionColl(dr); e07_RegionColl.LoadItems(e05_CountryColl); dr.NextResult(); while (dr.Read()) { var child = E09_Region_Child.GetE09_Region_Child(dr); var obj = e07_RegionColl.FindE08_RegionByParentProperties(child.region_ID1); obj.LoadChild(child); } dr.NextResult(); while (dr.Read()) { var child = E09_Region_ReChild.GetE09_Region_ReChild(dr); var obj = e07_RegionColl.FindE08_RegionByParentProperties(child.region_ID2); obj.LoadChild(child); } dr.NextResult(); var e09_CityColl = E09_CityColl.GetE09_CityColl(dr); e09_CityColl.LoadItems(e07_RegionColl); dr.NextResult(); while (dr.Read()) { var child = E11_City_Child.GetE11_City_Child(dr); var obj = e09_CityColl.FindE10_CityByParentProperties(child.city_ID1); obj.LoadChild(child); } dr.NextResult(); while (dr.Read()) { var child = E11_City_ReChild.GetE11_City_ReChild(dr); var obj = e09_CityColl.FindE10_CityByParentProperties(child.city_ID2); obj.LoadChild(child); } dr.NextResult(); var e11_CityRoadColl = E11_CityRoadColl.GetE11_CityRoadColl(dr); e11_CityRoadColl.LoadItems(e09_CityColl); }
/// <summary> /// Loads child objects from the given DAL provider. /// </summary> /// <param name="dal">The DAL provider to use.</param> private void FetchChildren(IE02_ContinentDal dal) { LoadProperty(E03_Continent_SingleObjectProperty, E03_Continent_Child.GetE03_Continent_Child(dal.E03_Continent_Child)); LoadProperty(E03_Continent_ASingleObjectProperty, E03_Continent_ReChild.GetE03_Continent_ReChild(dal.E03_Continent_ReChild)); LoadProperty(E03_SubContinentObjectsProperty, E03_SubContinentColl.GetE03_SubContinentColl(dal.E03_SubContinentColl)); foreach (var item in dal.E05_SubContinent_Child) { var child = E05_SubContinent_Child.GetE05_SubContinent_Child(item); var obj = E03_SubContinentObjects.FindE04_SubContinentByParentProperties(child.subContinent_ID1); obj.LoadChild(child); } foreach (var item in dal.E05_SubContinent_ReChild) { var child = E05_SubContinent_ReChild.GetE05_SubContinent_ReChild(item); var obj = E03_SubContinentObjects.FindE04_SubContinentByParentProperties(child.subContinent_ID2); obj.LoadChild(child); } var e05_CountryColl = E05_CountryColl.GetE05_CountryColl(dal.E05_CountryColl); e05_CountryColl.LoadItems(E03_SubContinentObjects); foreach (var item in dal.E07_Country_Child) { var child = E07_Country_Child.GetE07_Country_Child(item); var obj = e05_CountryColl.FindE06_CountryByParentProperties(child.country_ID1); obj.LoadChild(child); } foreach (var item in dal.E07_Country_ReChild) { var child = E07_Country_ReChild.GetE07_Country_ReChild(item); var obj = e05_CountryColl.FindE06_CountryByParentProperties(child.country_ID2); obj.LoadChild(child); } var e07_RegionColl = E07_RegionColl.GetE07_RegionColl(dal.E07_RegionColl); e07_RegionColl.LoadItems(e05_CountryColl); foreach (var item in dal.E09_Region_Child) { var child = E09_Region_Child.GetE09_Region_Child(item); var obj = e07_RegionColl.FindE08_RegionByParentProperties(child.region_ID1); obj.LoadChild(child); } foreach (var item in dal.E09_Region_ReChild) { var child = E09_Region_ReChild.GetE09_Region_ReChild(item); var obj = e07_RegionColl.FindE08_RegionByParentProperties(child.region_ID2); obj.LoadChild(child); } var e09_CityColl = E09_CityColl.GetE09_CityColl(dal.E09_CityColl); e09_CityColl.LoadItems(e07_RegionColl); foreach (var item in dal.E11_City_Child) { var child = E11_City_Child.GetE11_City_Child(item); var obj = e09_CityColl.FindE10_CityByParentProperties(child.city_ID1); obj.LoadChild(child); } foreach (var item in dal.E11_City_ReChild) { var child = E11_City_ReChild.GetE11_City_ReChild(item); var obj = e09_CityColl.FindE10_CityByParentProperties(child.city_ID2); obj.LoadChild(child); } var e11_CityRoadColl = E11_CityRoadColl.GetE11_CityRoadColl(dal.E11_CityRoadColl); e11_CityRoadColl.LoadItems(e09_CityColl); }