private ShopInformation() { Customers = new List<Customer>(); Customers.Add(new Customer("test", "test")); Administrators = new List<Admin>(); Administrators.Add(new Admin("Root", "qwerty")); AvailableProducts = new ProductsList(); SoldProducts = new ProductsList(); CurrentPromotion = new Promotion(); }
public void MakePromotion(string file) { if (this.IsLogged) { Promotion promotion = new Promotion(); StreamReader reader = new StreamReader(file, Encoding.GetEncoding("UTF-8")); using (reader) { string line = reader.ReadLine(); while (line != null) { int productID = int.Parse(line); string productName = reader.ReadLine(); decimal productPrice = decimal.Parse(reader.ReadLine()); promotion.PromotionList.Add(new Product(productName, productPrice, productID)); line = reader.ReadLine(); } } ShopInformation.CurrentPromotion.PromotionList.Clear(); ShopInformation.CurrentPromotion.PromotionList = promotion.PromotionList; } else { Console.WriteLine("This operation is not permitted. You should log on."); } }