/// <summary>
 /// Loads <see cref="B10_City"/> items on the B09_CityObjects collection.
 /// </summary>
 /// <param name="collection">The grand parent <see cref="B07_RegionColl"/> collection.</param>
 internal void LoadItems(B07_RegionColl collection)
 {
     foreach (var item in this)
     {
         var obj  = collection.FindB08_RegionByParentProperties(item.parent_Region_ID);
         var rlce = obj.B09_CityObjects.RaiseListChangedEvents;
         obj.B09_CityObjects.RaiseListChangedEvents = false;
         obj.B09_CityObjects.Add(item);
         obj.B09_CityObjects.RaiseListChangedEvents = rlce;
     }
 }
Пример #2
0
        /// <summary>
        /// Factory method. Loads a <see cref="B06_Country"/> object from the given B06_CountryDto.
        /// </summary>
        /// <param name="data">The <see cref="B06_CountryDto"/>.</param>
        /// <returns>A reference to the fetched <see cref="B06_Country"/> object.</returns>
        internal static B06_Country GetB06_Country(B06_CountryDto data)
        {
            B06_Country obj = new B06_Country();

            // show the framework that this is a child object
            obj.MarkAsChild();
            obj.Fetch(data);
            obj.LoadProperty(B07_RegionObjectsProperty, B07_RegionColl.NewB07_RegionColl());
            obj.MarkOld();
            return(obj);
        }
        /// <summary>
        /// Loads child objects from the given SafeDataReader.
        /// </summary>
        /// <param name="dr">The SafeDataReader to use.</param>
        internal void FetchChildren(SafeDataReader dr)
        {
            dr.NextResult();
            while (dr.Read())
            {
                var child = B03_Continent_Child.GetB03_Continent_Child(dr);
                var obj   = ((B01_ContinentColl)Parent).FindB02_ContinentByParentProperties(child.continent_ID1);
                obj.LoadProperty(B03_Continent_SingleObjectProperty, child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = B03_Continent_ReChild.GetB03_Continent_ReChild(dr);
                var obj   = ((B01_ContinentColl)Parent).FindB02_ContinentByParentProperties(child.continent_ID2);
                obj.LoadProperty(B03_Continent_ASingleObjectProperty, child);
            }
            dr.NextResult();
            var b03_SubContinentColl = B03_SubContinentColl.GetB03_SubContinentColl(dr);

            b03_SubContinentColl.LoadItems((B01_ContinentColl)Parent);
            dr.NextResult();
            while (dr.Read())
            {
                var child = B05_SubContinent_Child.GetB05_SubContinent_Child(dr);
                var obj   = b03_SubContinentColl.FindB04_SubContinentByParentProperties(child.subContinent_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = B05_SubContinent_ReChild.GetB05_SubContinent_ReChild(dr);
                var obj   = b03_SubContinentColl.FindB04_SubContinentByParentProperties(child.subContinent_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var b05_CountryColl = B05_CountryColl.GetB05_CountryColl(dr);

            b05_CountryColl.LoadItems(b03_SubContinentColl);
            dr.NextResult();
            while (dr.Read())
            {
                var child = B07_Country_Child.GetB07_Country_Child(dr);
                var obj   = b05_CountryColl.FindB06_CountryByParentProperties(child.country_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = B07_Country_ReChild.GetB07_Country_ReChild(dr);
                var obj   = b05_CountryColl.FindB06_CountryByParentProperties(child.country_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var b07_RegionColl = B07_RegionColl.GetB07_RegionColl(dr);

            b07_RegionColl.LoadItems(b05_CountryColl);
            dr.NextResult();
            while (dr.Read())
            {
                var child = B09_Region_Child.GetB09_Region_Child(dr);
                var obj   = b07_RegionColl.FindB08_RegionByParentProperties(child.region_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = B09_Region_ReChild.GetB09_Region_ReChild(dr);
                var obj   = b07_RegionColl.FindB08_RegionByParentProperties(child.region_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var b09_CityColl = B09_CityColl.GetB09_CityColl(dr);

            b09_CityColl.LoadItems(b07_RegionColl);
            dr.NextResult();
            while (dr.Read())
            {
                var child = B11_City_Child.GetB11_City_Child(dr);
                var obj   = b09_CityColl.FindB10_CityByParentProperties(child.city_ID1);
                obj.LoadChild(child);
            }
            dr.NextResult();
            while (dr.Read())
            {
                var child = B11_City_ReChild.GetB11_City_ReChild(dr);
                var obj   = b09_CityColl.FindB10_CityByParentProperties(child.city_ID2);
                obj.LoadChild(child);
            }
            dr.NextResult();
            var b11_CityRoadColl = B11_CityRoadColl.GetB11_CityRoadColl(dr);

            b11_CityRoadColl.LoadItems(b09_CityColl);
        }
Пример #4
0
        /// <summary>
        /// Loads child objects from the given DAL provider.
        /// </summary>
        /// <param name="dal">The DAL provider to use.</param>
        internal void FetchChildren(IB01_ContinentCollDal dal)
        {
            foreach (var item in dal.B03_Continent_Child)
            {
                var child = B03_Continent_Child.GetB03_Continent_Child(item);
                var obj   = ((B01_ContinentColl)Parent).FindB02_ContinentByParentProperties(child.continent_ID1);
                obj.LoadProperty(B03_Continent_SingleObjectProperty, child);
            }
            foreach (var item in dal.B03_Continent_ReChild)
            {
                var child = B03_Continent_ReChild.GetB03_Continent_ReChild(item);
                var obj   = ((B01_ContinentColl)Parent).FindB02_ContinentByParentProperties(child.continent_ID2);
                obj.LoadProperty(B03_Continent_ASingleObjectProperty, child);
            }
            var b03_SubContinentColl = B03_SubContinentColl.GetB03_SubContinentColl(dal.B03_SubContinentColl);

            b03_SubContinentColl.LoadItems((B01_ContinentColl)Parent);
            foreach (var item in dal.B05_SubContinent_Child)
            {
                var child = B05_SubContinent_Child.GetB05_SubContinent_Child(item);
                var obj   = b03_SubContinentColl.FindB04_SubContinentByParentProperties(child.subContinent_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.B05_SubContinent_ReChild)
            {
                var child = B05_SubContinent_ReChild.GetB05_SubContinent_ReChild(item);
                var obj   = b03_SubContinentColl.FindB04_SubContinentByParentProperties(child.subContinent_ID2);
                obj.LoadChild(child);
            }
            var b05_CountryColl = B05_CountryColl.GetB05_CountryColl(dal.B05_CountryColl);

            b05_CountryColl.LoadItems(b03_SubContinentColl);
            foreach (var item in dal.B07_Country_Child)
            {
                var child = B07_Country_Child.GetB07_Country_Child(item);
                var obj   = b05_CountryColl.FindB06_CountryByParentProperties(child.country_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.B07_Country_ReChild)
            {
                var child = B07_Country_ReChild.GetB07_Country_ReChild(item);
                var obj   = b05_CountryColl.FindB06_CountryByParentProperties(child.country_ID2);
                obj.LoadChild(child);
            }
            var b07_RegionColl = B07_RegionColl.GetB07_RegionColl(dal.B07_RegionColl);

            b07_RegionColl.LoadItems(b05_CountryColl);
            foreach (var item in dal.B09_Region_Child)
            {
                var child = B09_Region_Child.GetB09_Region_Child(item);
                var obj   = b07_RegionColl.FindB08_RegionByParentProperties(child.region_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.B09_Region_ReChild)
            {
                var child = B09_Region_ReChild.GetB09_Region_ReChild(item);
                var obj   = b07_RegionColl.FindB08_RegionByParentProperties(child.region_ID2);
                obj.LoadChild(child);
            }
            var b09_CityColl = B09_CityColl.GetB09_CityColl(dal.B09_CityColl);

            b09_CityColl.LoadItems(b07_RegionColl);
            foreach (var item in dal.B11_City_Child)
            {
                var child = B11_City_Child.GetB11_City_Child(item);
                var obj   = b09_CityColl.FindB10_CityByParentProperties(child.city_ID1);
                obj.LoadChild(child);
            }
            foreach (var item in dal.B11_City_ReChild)
            {
                var child = B11_City_ReChild.GetB11_City_ReChild(item);
                var obj   = b09_CityColl.FindB10_CityByParentProperties(child.city_ID2);
                obj.LoadChild(child);
            }
            var b11_CityRoadColl = B11_CityRoadColl.GetB11_CityRoadColl(dal.B11_CityRoadColl);

            b11_CityRoadColl.LoadItems(b09_CityColl);
        }