Esempio n. 1
0
        public static IncomeTax GetIncomeTax(IncomeTaxRangeTypes incomeTaxRangeType)
        {
            string property_name = incomeTaxRangeType.ToString();

            //Get the property inside IncomeTaxRangeConstants by a string Name
            var property = (typeof(IncomeTaxRangeConstants)).GetProperty(property_name, BindingFlags.NonPublic | BindingFlags.Static);

            //Get values from property
            var values = (Dictionary <IncomeTaxRangeTypes, IncomeTax>)property.GetValue(null, null);

            values.TryGetValue(incomeTaxRangeType, out IncomeTax result);
            return(result);
        }
Esempio n. 2
0
        public IIncomeTaxDiscountCalculator GetIncomeTaxFactory(IncomeTaxRangeTypes incomeTaxRangeTypes)
        {
            switch (incomeTaxRangeTypes)
            {
            case IncomeTaxRangeTypes.EXEMPT_RANGE:
                return(new IncomeTaxExemptRange());

            case IncomeTaxRangeTypes.FIRST_RANGE:
                return(new IncomeTaxFirstRange());

            case IncomeTaxRangeTypes.SECOND_RANGE:
                return(new IncomeTaxSecondRange());

            case IncomeTaxRangeTypes.THIRD_RANGE:
                return(new IncomeTaxThirdRange());

            default:
                throw new KeyNotFoundException();
            }
        }
Esempio n. 3
0
 public IncomeTaxFactoryType(Type type, IncomeTaxRangeTypes incomeTaxType)
 {
     GetFactoryType = type;
     IncomeTaxType  = incomeTaxType;
 }
Esempio n. 4
0
 internal IncomeTax(IncomeTaxRangeTypes type, double max_value, double discount)
 {
     TYPE      = type;
     MAX_VALUE = max_value;
     DISCOUNT  = discount;
 }