コード例 #1
0
 static void Main(string[] args)
 {
     CountryVatTax obj = new CountryVatTax(1,20,false);
     CountryVatTax secondObj = new CountryVatTax(2, 15, true);
     List<CountryVatTax> countries = new List<CountryVatTax> { obj, secondObj};
     Calculator calculator = new Calculator(countries);
     calculator.CalculateTax(4);
     calculator.CalculateTax(4, 2);
     Product product = new Product(4,2,"Storm",4,2,countries);
     Product secondProduct = new Product(8, 1, "Wind", 5, 1, countries);
     ShopInventory shopInventory = new ShopInventory(product);
     Console.WriteLine("If all products of that type are sold out, the profil you will gain is = {0}", shopInventory.Audit());
     Order order = new Order(1, 3);
     shopInventory.RequestOrder(order);
 }
コード例 #2
0
 public void RequestOrder(Order order)
 {
     foreach (var item in products)
     {
         if (item.Key.Id==order.ProductId)
         {
             if (item.Key.Quantity >= order.Quantity)
             {
                 double result = 0;
                 result = item.Key.PrizeWithTax * order.Quantity;
                 Console.WriteLine("The order will cost you: {0}",result);
             }
             else
             {
                 Console.WriteLine("Not enough quantity.");
             }
         }
         else
         {
             Console.WriteLine("We dont have the product in our inventory.");
         }
     }
 }