/// <summary> /// Loads <see cref="E10_City"/> items on the E09_CityObjects collection. /// </summary> /// <param name="collection">The grand parent <see cref="E07_RegionColl"/> collection.</param> internal void LoadItems(E07_RegionColl collection) { foreach (var item in this) { var obj = collection.FindE08_RegionByParentProperties(item.parent_Region_ID); obj.E09_CityObjects.IsReadOnly = false; var rlce = obj.E09_CityObjects.RaiseListChangedEvents; obj.E09_CityObjects.RaiseListChangedEvents = false; obj.E09_CityObjects.Add(item); obj.E09_CityObjects.RaiseListChangedEvents = rlce; obj.E09_CityObjects.IsReadOnly = true; } }
/// <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); }