public static void SetRate(PaymentCalculationPeriod paymentCalculationPeriod, decimal rate) { foreach (CalculationPeriod calculationPeriod in XsdClassesFieldResolver.GetPaymentCalculationPeriodCalculationPeriodArray(paymentCalculationPeriod)) { if (XsdClassesFieldResolver.CalculationPeriodHasFixedRate(calculationPeriod)) { XsdClassesFieldResolver.SetCalculationPeriodFixedRate(calculationPeriod, rate); } else if (XsdClassesFieldResolver.CalculationPeriodHasFloatingRateDefinition(calculationPeriod)) { throw new NotImplementedException("Cannot modify floating rate, PaymentCalculationPeriodHelper.SetRate"); //XsdClassesFieldResolver.CalculationPeriod_GetFloatingRateDefinition(calculationPeriod).calculatedRate; } else { throw new NotImplementedException("PaymentCalculationPeriodHelper.SetRate"); } } }
public static void ReplaceFloatingRateWithFixedRate(PaymentCalculationPeriod paymentCalculationPeriod, decimal fixedRate) { foreach (CalculationPeriod calculationPeriod in XsdClassesFieldResolver.GetPaymentCalculationPeriodCalculationPeriodArray(paymentCalculationPeriod)) { if (XsdClassesFieldResolver.CalculationPeriodHasFixedRate(calculationPeriod)) { throw new System.Exception("calculation period already uses a fixed rate."); } if (XsdClassesFieldResolver.CalculationPeriodHasFloatingRateDefinition(calculationPeriod)) { // Replace FloatingRateDefinition with decimal (fixed rate) // XsdClassesFieldResolver.SetCalculationPeriodFixedRate(calculationPeriod, fixedRate); } else { throw new NotSupportedException("PaymentCalculationPeriodHelper.ReplaceFloatingRateWithFixedRate"); } } }