Example #1
0
        public void TestReschedulingOfALoanEventAmount()
        {
            RescheduleLoanEvent rSLE = new RescheduleLoanEvent();

            rSLE.Amount = 32.45m;
            Assert.AreEqual(32.45m, rSLE.Amount.Value);
        }
Example #2
0
 private static void _AssertReschedulingLoanEvent(RescheduleLoanEvent pEvent, DateTime pDate, OCurrency pAmount, int pNbOfMaturity, int dateOffset)
 {
     Assert.AreEqual("ROLE", pEvent.Code);
     Assert.AreEqual(pDate, pEvent.Date);
     Assert.AreEqual(pAmount.Value, pEvent.Amount.Value);
     Assert.AreEqual(pNbOfMaturity, pEvent.NbOfMaturity);
 }
        public void Select_Added_ReschedulingLoanEvent()
        {
            EventManager eventManager = (EventManager)container["EventManager"];

            RescheduleLoanEvent rescheduleLoanEvent = new RescheduleLoanEvent
            {
                Id   = 14,
                User = new User {
                    Id = 1
                },
                Date         = new DateTime(2006, 7, 21),
                Amount       = 2345,
                NbOfMaturity = 4,
                DateOffset   = 0,
                Interest     = 100
            };

            eventManager.AddLoanEvent(rescheduleLoanEvent, 1);

            EventStock eventStock = eventManager.SelectEvents(2);

            foreach (Event e in eventStock.GetEvents())
            {
                if (e is RescheduleLoanEvent)
                {
                    _AssertReschedulingLoanEvent(e as RescheduleLoanEvent, new DateTime(2006, 7, 21), 2345, 3, 4);
                }
            }
        }
        private void DisplayEvent()
        {
            listViewEvents.Items.Clear();

            ListViewItem listViewItem = new ListViewItem(_event.Date.ToShortDateString());

            listViewItem.SubItems.Add(_event.Code);
            listViewItem.Tag = _event;

            if (_event is LoanDisbursmentEvent)
            {
                LoanDisbursmentEvent evt = _event as LoanDisbursmentEvent;
                listViewItem.SubItems.Add(evt.Amount.GetFormatedValue(true));
                listViewItem.SubItems.Add("-");
                listViewItem.SubItems.Add("-");
            }
            else if (_event is RepaymentEvent)
            {
                RepaymentEvent evt = _event as RepaymentEvent;
                listViewItem.SubItems.Add(evt.Principal.GetFormatedValue(true));
                listViewItem.SubItems.Add(evt.Interests.GetFormatedValue(true));
                listViewItem.SubItems.Add(evt.Fees.GetFormatedValue(true));
            }
            else if (_event is BadLoanRepaymentEvent)
            {
                BadLoanRepaymentEvent evt = _event as BadLoanRepaymentEvent;
                listViewItem.SubItems.Add(evt.Principal.GetFormatedValue(true));
                listViewItem.SubItems.Add(evt.Interests.GetFormatedValue(true));
                listViewItem.SubItems.Add(evt.Fees.GetFormatedValue(true));
            }
            else if (_event is TrancheEvent)
            {
                TrancheEvent evt = _event as TrancheEvent;
                listViewItem.SubItems.Add(evt.Amount.GetFormatedValue(true));
                listViewItem.SubItems.Add(evt.InterestRate.GetFormatedValue(true));
                listViewItem.SubItems.Add("-");
            }
            else if (_event is RegEvent || _event is WriteOffEvent || _event is LoanValidationEvent)
            {
                listViewItem.SubItems.Add("-");
                listViewItem.SubItems.Add("-");
                listViewItem.SubItems.Add("-");
            }
            else if (_event is RescheduleLoanEvent)
            {
                RescheduleLoanEvent evt = _event as RescheduleLoanEvent;
                listViewItem.SubItems.Add(evt.Amount.GetFormatedValue(true));
                listViewItem.SubItems.Add("-");
                listViewItem.SubItems.Add("-");
            }
            listViewItem.SubItems.Add(_event.Cancelable.ToString());

            if (_event.Deleted)
            {
                listViewItem.BackColor = Color.FromArgb(188, 209, 199);
                listViewItem.ForeColor = Color.White;
            }
            listViewEvents.Items.Add(listViewItem);
        }
Example #5
0
        public void TestReschedulingOfALoanEventBadLoanBoolean()
        {
            RescheduleLoanEvent rSE = new RescheduleLoanEvent {
                BadLoan = true
            };

            Assert.IsTrue(rSE.BadLoan);
        }
Example #6
0
        private static OCurrency GetValue(RescheduleLoanEvent eventItem, ContractAccountingRule rule)
        {
            OCurrency amount = 0;

            if (rule.EventAttribute.Name.ToLower() == "amount")
            {
                amount = eventItem.Amount;
            }

            if (rule.EventAttribute.Name.ToLower() == "interest")
            {
                amount = eventItem.Interest;
            }
            return(amount);
        }
Example #7
0
        public void Add_ReschedulingLoanEvent()
        {
            EventManager eventManager = (EventManager)container["EventManager"];

            RescheduleLoanEvent rescheduleLoanEvent = new RescheduleLoanEvent
                                               {
                                                   Id = 14,
                                                   User = new User { Id = 1 },
                                                   Date = new DateTime(2006, 7, 21),
                                                   PreferredFirstInstallmentDate = new DateTime(2006, 8, 21),
                                                   Amount = 2345,
                                                   NbOfMaturity = 4,
                                                   Interest = 100
                                               };
            eventManager.AddLoanEvent(rescheduleLoanEvent, 1);
            Assert.AreNotEqual(0, rescheduleLoanEvent.Id);
        }
Example #8
0
        public RescheduleLoanEvent Reschedule(ReschedulingOptions ro, Loan contract, NonWorkingDateSingleton nwdS, ApplicationSettings applicationSettings)
        {
            _contract        = contract;
            _nwdS            = nwdS;
            _generalSettings = applicationSettings;

            switch (contract.Product.LoanType)
            {
            case OLoanTypes.Flat:
                _Reschedule_Flat(ro);
                break;

            case OLoanTypes.DecliningFixedPrincipal:
                _Reschedule_FixedPrincipal(ro);
                break;

            case OLoanTypes.DecliningFixedInstallments:
                _Reschedule_DecliningFixedInstallments(ro);
                break;
            }

            _Reschedule_AdjustOverpaid();

            RescheduleLoanEvent rSe = new RescheduleLoanEvent
            {
                Date         = ro.ReschedulingDate,
                Amount       = contract.CalculateActualOlb(),
                Interest     = contract.GetTotalInterestDue(),
                ClientType   = contract.ClientType,
                BadLoan      = contract.BadLoan,
                NbOfMaturity = ro.NewInstallments,
                DateOffset   = ro.RepaymentDateOffset,
                GracePeriod  = ro.GracePeriod,
                ChargeInterestDuringShift       = ro.ChargeInterestDuringShift,
                ChargeInterestDuringGracePeriod = ro.ChargeInterestDuringGracePeriod,
                InstallmentNumber =
                    contract.GetLastFullyRepaidInstallment() == null
                                                      ? 1
                                                      : contract.GetLastFullyRepaidInstallment().Number + 1
            };

            _contract.CalculateStartDates();
            return(rSe);
        }
Example #9
0
 private void ReschedulingOfALoanOrigination(RescheduleLoanEvent rescheduleLoanEvent, Loan pContract, SqlTransaction sqlTransac)
 {
     _eventManagement.AddLoanEvent(rescheduleLoanEvent, pContract.Id, sqlTransac);
 }
Example #10
0
        public void TestIfReschedulingOfALoanCodeCorrectlySetAndRetrieved()
        {
            RescheduleLoanEvent rOLE = new RescheduleLoanEvent();

            Assert.AreEqual("ROLE", rOLE.Code);
        }