private Receipt(ShopEnum shop, List <Item> items) : this() { ShopEnum = shop; Items = items; Total = Items.Sum(item => item.Prices[(int)ShopEnum]); // slower than foreach PurchaseTime = DateTime.Now; }
public bool IsAvailableForBuying(ShopEnum type, int id, int stock) { UpdateShopDict(); if (stock == -1) { return(true); } var data = shopDic[type]; return(GetBoughtCount(type, id) < stock); }
public static void Switch(ShopEnum shop) { foreach (ShopProfile sp in Shops) { if (sp.Shop == shop) { _current = sp; break; } } }
public void AddBought(ShopEnum type, int id) { UpdateShopDict(); var data = shopDic[type]; if (data.ContainsKey(id)) { data[id] += 1; } else { data.Add(id, 1); } }
public static IShop GetShop(ShopEnum shop) { switch (shop) { case ShopEnum.Maxima: return(new Maxima()); case ShopEnum.Norfa: return(new Norfa()); case ShopEnum.Rimi: return(new Rimi()); case ShopEnum.Iki: return(new Iki()); default: throw new ArgumentException(string.Format("No matching shop class ({0})", shop.ToString())); } }
public int GetBoughtCount(ShopEnum type, int id) { UpdateShopDict(); var data = shopDic[type]; if (data.ContainsKey(id)) { return(data[id]); } else { data.Add(id, 0); return(data[id]); } }
private ShopProfile( ShopEnum shop, string account, string sellerId, string displayName, string displayNameOnBill, string shortName, string senderName, string senderPhone, string ad, string ordersDbFilename, string fullOrdersDbFilename) { _shop = shop; _account = account; _sellerId = sellerId; _displayName = displayName; _displayNameOnBill = displayNameOnBill; _shortName = shortName; _senderName = senderName; _senderPhone = senderPhone; _ad = ad; _ordersDbFilename = ordersDbFilename; _fullOrdersDbFilename = fullOrdersDbFilename; }
public static Receipt Create(ShopEnum shop, List <Item> items, DateTime dateTime, int total) { return(new Receipt(shop, items, dateTime, total)); }
public static Receipt Create(ShopEnum shop, List <Item> items) { return(new Receipt(shop, items)); }
private Receipt(ShopEnum shop, List <Item> items, DateTime dateTime, int total) : this(shop, items, dateTime) { Total = total; }
private Receipt(ShopEnum shop, List <Item> items, DateTime dateTime) : this(shop, items) { PurchaseTime = dateTime; }
public Item(string name, int price, ShopEnum shop) : this() { Name = name; Prices[(int)shop] = price; }
public bool IsAvailableForBuying(ShopEnum type, int idPack, int stock) { return(dataShop.IsAvailableForBuying(type, idPack, stock)); }
public int GetBoughtCount(ShopEnum type, int idPack) { return(dataShop.GetBoughtCount(type, idPack)); ; }
public void AddBought(ShopEnum type, int idPack) { dataShop.AddBought(type, idPack); Save(); }