Пример #1
0
        private static void MoveDictionary(ISession hb, DataClassesDataContext linq)
        {
            //DealVariant
            _idDictionaryMaps.Add(typeof(DealVariant), new List <IdMap>());
            foreach (var curEnitie in linq.Variants)
            {
                var hbEntity = new DealVariant(curEnitie.vcVariant);
                AddMapForDictionary(curEnitie.idVariant, hb, hbEntity);
            }
            Console.WriteLine("Сделки - готово");

            //District
            _idDictionaryMaps.Add(typeof(RealEstateDirectory.Domain.Entities.Dictionaries.District), new List <IdMap>());
            foreach (var curEnitie in linq.Districts)
            {
                var hbEntity = new RealEstateDirectory.Domain.Entities.Dictionaries.District(curEnitie.vcDistrict);
                AddMapForDictionary(curEnitie.idDistrict, hb, hbEntity);
            }
            Console.WriteLine("Районы - готово");

            //Layout
            _idDictionaryMaps.Add(typeof(Layout), new List <IdMap>());
            foreach (var curEnitie in linq.Planings)
            {
                var hbEntity = new Layout(curEnitie.vcPlaning);
                AddMapForDictionary(curEnitie.idPlaning, hb, hbEntity);
            }
            Console.WriteLine("Планировки - готово");

            //Material
            _idDictionaryMaps.Add(typeof(Material), new List <IdMap>());
            foreach (var curEnitie in linq.WallMatherials)
            {
                var hbEntity = new Material(curEnitie.vcWallMatherial);
                AddMapForDictionary(curEnitie.idWallMatherial, hb, hbEntity);
            }
            Console.WriteLine("Материалы - готово");

            //Realtor
            _idDictionaryMaps.Add(typeof(Realtor), new List <IdMap>());
            foreach (var curEnitie in linq.Rielters)
            {
                var hbEntity = new Realtor(curEnitie.vcName, curEnitie.vcContacts);
                AddMapForDictionary(curEnitie.idRielter, hb, hbEntity);
            }
            Console.WriteLine("Риэлторы - готово");

            //Street
            _idDictionaryMaps.Add(typeof(RealEstateDirectory.Domain.Entities.Dictionaries.Street), new List <IdMap>());
            using (var helper = new DataResolveHelper(hb))
            {
                helper.IdDictionaryMaps = _idDictionaryMaps;
                foreach (var curEnitie in linq.Streets)
                {
                    if (curEnitie.idDistrict.HasValue)
                    {
                        var hbEntity    = new RealEstateDirectory.Domain.Entities.Dictionaries.Street(curEnitie.vcStreet);
                        var hDistrictId =
                            helper.ResolveHbId <RealEstateDirectory.Domain.Entities.Dictionaries.District>(curEnitie.idDistrict.Value);

                        var distictH = hb.Get <RealEstateDirectory.Domain.Entities.Dictionaries.District>(hDistrictId);
                        hbEntity.District = distictH;
                        AddMapForDictionary(curEnitie.idStreet, hb, hbEntity);
                    }
                }
                Console.WriteLine("Улицы - готово");
            }

            //Terrace
            _idDictionaryMaps.Add(typeof(Terrace), new List <IdMap>());
            foreach (var curEnitie in linq.Balconies)
            {
                var hbEntity = new Terrace(curEnitie.vcBalcony);
                AddMapForDictionary(curEnitie.idBalcony, hb, hbEntity);
            }
            Console.WriteLine("Балконы - готово");

            //ToiletType
            _idDictionaryMaps.Add(typeof(ToiletType), new List <IdMap>());
            foreach (var curEnitie in linq.SanUsels)
            {
                var hbEntity = new ToiletType(curEnitie.vcSanUsel);
                AddMapForDictionary(curEnitie.idSanUsel, hb, hbEntity);
            }
            Console.WriteLine("Сан узел - готово");

            //Агентства
            _idDictionaryMaps.Add(typeof(RealtorAgency), new List <IdMap>());
            foreach (var curEnitie in linq.Agencies)
            {
                var hbEntity = new RealtorAgency(curEnitie.vcName)
                {
                    Address     = curEnitie.vcAddress,
                    Contacts    = curEnitie.vcContacts,
                    Description = curEnitie.vcComments,
                    Director    = curEnitie.vcDirectorName
                };

                AddMapForDictionary(curEnitie.idAgency, hb, hbEntity);
            }
            Console.WriteLine("Агентства - готово");
        }
Пример #2
0
 public virtual void AddStreet(Street street)
 {
     street.District = this;
     Streets.Add(street);
 }