Esempio n. 1
0
        public double CalculateTax(int price, int countryId)
        {
            CountryVatTax correspondingVatTax = null;

            foreach (CountryVatTax item in this.list)
            {
                if (item.CountryId == countryId)
                {
                    correspondingVatTax = item;
                    break;
                }
            }

            if (correspondingVatTax == null)
            {
                throw new NotSupportedException("Country not supported.");
            }

            return(price * (correspondingVatTax.VatTax / 100.0));
        }
Esempio n. 2
0
 public VatTaxCalculator(List <CountryVatTax> list, CountryVatTax defaultTax)
 {
     this.list       = list;
     this.defaultTax = defaultTax;
 }
Esempio n. 3
0
 public VatTaxCalculator(List<CountryVatTax> list, CountryVatTax defaultTax)
 {
     this.list = list;
     this.defaultTax = defaultTax;
 }