예제 #1
0
        private void LoadFlatOwners(FloorDecoratorViewModel floorDecorator)
        {
            foreach (FlatDecoratorViewModel flatDecorator in floorDecorator.OriginaFloorViewModel.FlatsEnumerable)
            {
                AborigenDecoratorViewModel owner = RelationsProvider.GetFlatOwner(flatDecorator.Flat.Number);

                flatDecorator.SetOwner(owner);
            }
        }
예제 #2
0
        private static void SaveImpl(FlatDecoratorViewModel flatDecorator)
        {
            bool saved = flatDecorator.Save();

            if (saved)
            {
                RelationsProvider.SaveOrUpdateOwnRelation(flatDecorator.OwnerDecorator.AborigenEditable.GetId(), flatDecorator.Flat.Number);
                flatDecorator.OnSaved();
            }
        }
예제 #3
0
        public static FlatViewModel FindFlatOfAborigen(string aborigenId)
        {
            lock (Locker)
            {
                if (aborigenFlats.TryGetValue(aborigenId, out FlatViewModel cachedFlat))
                {
                    return(cachedFlat);
                }

                int flatNumber = RelationsProvider.GetOwnedFlatNumber(aborigenId);

                if (flatNumber == RelationsProvider.InvalidFlatNumber)
                {
                    return(null);
                }

                FlatViewModel flat = AllFloorsProvider.Instance.FindFlatByNumber(flatNumber);

                aborigenFlats.Add(aborigenId, flat);

                return(flat);
            }
        }