コード例 #1
0
 public void ExpireServiceContract(ServiceContract sc)
 {
     if (sc.ProRateRefunded)
     {
         var proRateRefund = sc.PeriodPaymentAmount - CalcualteProRata(sc.StartDate, (DateTime)sc.ExpiryDate, sc.PeriodPaymentAmount,
                                                                       sc.PaymentPeriod.PeriodInMonths);
         var account =
             _customerAccountRepository.GetAll()
             .OfType <PurchaseAccount>()
             .Single(p => p.PurchasedUnits.Any(u => u.Contracts.Any(c => c.ContractId == sc.ContractId)));
         _accountTransactionService.AddAccountTransaction(account.CustomerAccountId, AccountTransactionType.Refund,
                                                          -proRateRefund, AccountTransactionInputType.Charge, 0, "Service Contract :" + sc.ContractType.Description);
     }
 }