Пример #1
0
        private static void SynchronizationCatalogShop()
        {
            if (stores == null)
            {
                throw new Exception("Ни одного склада не существует.");
            }
            catalogShop = new Store <Product>("Каталог магазина");

            foreach (KeyValuePair <int, object> store in stores)
            {
                if (store.Value is Store <FoodProduct> )
                {
                    Store <FoodProduct> tempStore = (Store <FoodProduct>)store.Value;
                    foreach (FoodProduct product in tempStore)
                    {
                        catalogShop.AddCatalog(product);
                    }
                }
                else
                {
                    Store <NonFoodProduct> tempStore = (Store <NonFoodProduct>)store.Value;
                    foreach (NonFoodProduct product in tempStore)
                    {
                        catalogShop.AddCatalog(product);
                    }
                }
            }
        }