/// <summary> /// Main Method. /// </summary> public static void Main() { // Add CountryVatTax countries - id, vat, isDefault CountryVatTax bg = new CountryVatTax(1, 20, true); // Add countries to list List<CountryVatTax> countriesList = new List<CountryVatTax>() { bg }; // Initialise VatTaxCalculator with the countries list VatTaxCalculator calc = new VatTaxCalculator(countriesList); // Add products - id, name, quantity, price, country Product prod1 = new Product(0, "prod", 5, 10, bg); // Add products to list List<Product> productsList = new List<Product>() { prod1 }; // Initialise a new Inventory with the products list ShopInventory newInventory = new ShopInventory(productsList); // Add product id and quantity to orderdict Dictionary<int, int> orderdict = new Dictionary<int, int> { { 0, 2 } }; Order newOrder = new Order(orderdict); }
/// <summary> /// Initializes a new instance of the <see cref="Product"/> class. /// </summary> /// <param name="prodId">Sets the product ID.</param> /// <param name="prodName">Sets the product name.</param> /// <param name="prodQuantity">Sets the product available quantity.</param> /// <param name="price">Sets the product price.</param> /// <param name="countryAvai">Sets the product country where is is available.</param> public Product(int prodId, string prodName, int prodQuantity, double price, CountryVatTax countryAvai) { this.ProductId = prodId; this.Quantity = prodQuantity; this.NameOfProduct = prodName; this.PriceWithoutTax = price; this.PriceWithTax = new VatTaxCalculator(new List<CountryVatTax>() { countryAvai }).CalculateTax(price, countryAvai.CountryId); }
static void Main(string[] args) { CountryVatTax obj = new CountryVatTax(1, 20, false); CountryVatTax obj1 = new CountryVatTax(2, 10, true); List<CountryVatTax> countries = new List<CountryVatTax>() { obj, obj1 }; Calculator calcObj = new Calculator(countries); calcObj.Calc(5); calcObj.Calc(5, 1); Product product = new Product(5, 1, "Хак", 5, 1, countries); Product product2 = new Product(10, 1, "България", 5, 2, countries); ShopInventory newShopInvertory = new ShopInventory(product); Console.WriteLine("If all products of that type are sold out, the profil you will gain is = {0}", newShopInvertory.Audit()); Order firstOrder = new Order(1, 3); newShopInvertory.RequestOrder(firstOrder); }
static void Main(string[] args) { CountryVatTax obj = new CountryVatTax(1, 20, false); CountryVatTax obj1 = new CountryVatTax(2, 10, true); List <CountryVatTax> countries = new List <CountryVatTax>() { obj, obj1 }; Calculator calcObj = new Calculator(countries); calcObj.Calc(5); calcObj.Calc(5, 1); Product product = new Product(5, 1, "Хак", 5, 1, countries); Product product2 = new Product(10, 1, "България", 5, 2, countries); ShopInventory newShopInvertory = new ShopInventory(product); Console.WriteLine("If all products of that type are sold out, the profil you will gain is = {0}", newShopInvertory.Audit()); Order firstOrder = new Order(1, 3); newShopInvertory.RequestOrder(firstOrder); }
static void Main(string[] args) { CountryVatTax[] countries = new CountryVatTax[] { new CountryVatTax(1, 0.2, true), new CountryVatTax(2, 0.3, false), new CountryVatTax(3, 0.22, false), new CountryVatTax(4, 0.17, false), new CountryVatTax(5, 0.43, false), new CountryVatTax(6, 0.13, false) }; TaxCalculator calc = new TaxCalculator(countries.ToList()); Product[] products = new Product[] { new Product("Hlqb" , 1, 1, 7, 0.8, calc), new Product("Sirene", 2, 1, 3, 4.5, calc), new Product("Voda" , 3, 1, 5, 0.4, calc), new Product("Qica" , 4, 1, 10, 0.1, calc), new Product("Emeka" , 5, 1, 2, 2.5, calc), new Product("Sok" , 6, 1, 1, 2.2, calc) }; ShopInventory shop = new ShopInventory(products.ToList()); Dictionary<int, int> items1 = new Dictionary<int, int>(); items1.Add(2, 2); items1.Add(3, 3); items1.Add(1, 2); Order order1 = new Order(items1); Dictionary<int, int> items2 = new Dictionary<int, int>(); items2.Add(4, 8); items2.Add(5, 1); items2.Add(3, 1); Order order2 = new Order(items2); Dictionary<int, int> items3 = new Dictionary<int, int>(); items3.Add(2, 1); items3.Add(5, 1); items3.Add(3, 2); Order order3 = new Order(items3); try { Console.WriteLine("Audit: {0}", shop.Audit()); Console.WriteLine("Order 1 value: {0}", shop.RequestOrder(order1)); Console.WriteLine("Audit: {0}", shop.Audit()); Console.WriteLine("Order 2 value: {0}", shop.RequestOrder(order2)); Console.WriteLine("Audit: {0}", shop.Audit()); Console.WriteLine("Order 3 value: {0}", shop.RequestOrder(order3)); } catch (Exception ex) { Console.WriteLine("Error: {0}", ex.Message); } Console.WriteLine("Audit: {0}", shop.Audit()); Console.ReadKey(); }