Beispiel #1
0
        private List<SavingEvent> GenerateManagementFeeEvent(DateTime prevDate, DateTime nextDate)
        {
            List<SavingEvent> retval = new List<SavingEvent>();

            const string desc = "Management fee of {0:.00} for {1:dd.MM.yyyy} - {2:dd.MM.yyyy} : {3}";
            object[] items = new object[] { ManagementFees.GetFormatedValue(true), prevDate, nextDate, Code};

            SavingManagementFeeEvent smfe = new SavingManagementFeeEvent
            {
                Amount = 0m,
                Cancelable = true,
                Date = nextDate,
                Description = string.Format(desc, items),
                Fee = ManagementFees.HasValue ? ManagementFees : 0m,
                User = User,
                ProductType = Product.GetType(),
                Branch = Branch,
                Currency = Product.Currency,
                ContracId = Id
            };
            retval.Add(smfe);
            AddSavingEvent(smfe);

            OCurrency balance = GetBalance(nextDate);
            if (balance < 0)
            {
                if (!InOverdraft)
                {
                    SavingOverdraftFeeEvent overdraftFeeEvent = new SavingOverdraftFeeEvent
                    {
                        Amount = 0m,
                        Date = nextDate,
                        Description = "Overdraft fee event : " + Code,
                        User = User,
                        Cancelable = false,
                        Fee = OverdraftFees,
                        ProductType = typeof(SavingsBookProduct),
                        Branch = Branch,
                        Currency = Product.Currency,
                        ContracId = Id
                    };

                    AddSavingEvent(overdraftFeeEvent);
                    retval.Add(overdraftFeeEvent);
                    InOverdraft = true;
                }
            }

            return retval;
        }
Beispiel #2
0
        public virtual SavingOverdraftFeeEvent ChargeOverdraftFee(DateTime pDate, User pUser)
        {
            SavingOverdraftFeeEvent e = new SavingOverdraftFeeEvent
            {
                Amount = 0m,
                Date = pDate,
                Description = "Overdtaft fee event",
                User = pUser,
                Cancelable = true,
                ProductType = Product.GetType(),
                Fee = 0m,
                Target = this
            };
            Events.Add(e);

            return e;
        }
Beispiel #3
0
        public override SavingOverdraftFeeEvent ChargeOverdraftFee(DateTime pDate, User pUser)
        {
            SavingOverdraftFeeEvent e = new SavingOverdraftFeeEvent
            {
                Amount = 0m,
                Date = pDate,
                Description = "Overdraft fee event : " + Code,
                User = pUser,
                Cancelable = true,
                ProductType = typeof(SavingsBookProduct),
                Fee = 0m
            };
            Events.Add(e);

            if (Status != OSavingsStatus.Closed)
                e.Fee = OverdraftFees;

            return e;
        }
Beispiel #4
0
 private static SavingEvent GetSavingsEvent(string code)
 {
     SavingEvent e;
     switch (code)
     {
         case OSavingEvents.Deposit:
             e = new SavingDepositEvent();
             break;
         case OSavingEvents.Withdraw:
             e = new SavingWithdrawEvent();
             break;
         case OSavingEvents.Accrual:
             e = new SavingInterestsAccrualEvent();
             break;
         case OSavingEvents.Posting:
             e = new SavingInterestsPostingEvent();
             break;
         case OSavingEvents.InitialDeposit:
             e = new SavingInitialDepositEvent();
             break;
         case OSavingEvents.CreditTransfer:
             e = new SavingCreditTransferEvent();
             break;
         case OSavingEvents.DebitTransfer:
             e = new SavingDebitTransferEvent();
             break;
         case OSavingEvents.ManagementFee:
             e = new SavingManagementFeeEvent();
             break;
         case OSavingEvents.SavingClosure:
             e = new SavingClosureEvent();
             break;
         case OSavingEvents.Close:
             e = new SavingCloseEvent();
             break;
         case OSavingEvents.OverdraftFees:
             e = new SavingOverdraftFeeEvent();
             break;
         case OSavingEvents.Agio:
             e = new SavingAgioEvent();
             break;
         case OSavingEvents.PendingDeposit:
             e = new SavingPendingDepositEvent();
             break;
         case OSavingEvents.Reopen:
             e = new SavingReopenEvent();
             break;
         case OSavingEvents.PendingDepositRefused:
             e = new SavingPendingDepositRefusedEvent();
             break;
         case OSavingEvents.SpecialOperationCredit:
             e = new SavingCreditOperationEvent();
             break;
         case OSavingEvents.SpecialOperationDebit:
             e = new SavingDebitOperationEvent();
             break;
         case OSavingEvents.InterBranchCreditTransfer:
             e = new SavingCreditInterBranchTransferEvent();
             break;
         case OSavingEvents.InterBranchDebitTransfer:
             e = new SavingDebitInterBranchTransferEvent();
             break;
         case OSavingEvents.LoanDisbursement:
             e = new SavingLoanDisbursementEvent();
             break;
         case OSavingEvents.SavingLoanRepayment:
             e = new LoanRepaymentFromSavingEvent();
             break;
         case OSavingEvents.BlockCompulsarySavings:
             e = new SavingBlockCompulsarySavingsEvent();
             break;
         case OSavingEvents.UnblockCompulsorySavings:
             e = new SavingUnblockCompulsorySavingsEvent();
             break;
         default:
             Debug.Fail("Failed to create saving event object");
             throw new Exception();
     }
     return e;
 }