예제 #1
0
        public RepaymentEvent CopyAsRepaymentEvent()
        {
            RepaymentEvent rPe;

            if (Code == "PRLR")
                rPe = new RescheduledLoanRepaymentEvent();
            else if (Code == "PBLR")
                rPe = new BadLoanRepaymentEvent();
            else if (Code == "PRWO")
                rPe = new RepaymentOverWriteOffEvent();
            else
                rPe = new RepaymentEvent();

            rPe.AccruedInterest = this.AccruedInterest;
            rPe.Cancelable = this.Cancelable;
            rPe.ClientType = this.ClientType;
            rPe.Commissions = this.Commissions;
            rPe.Date = this.Date;
            rPe.InstallmentNumber = this.InstallmentNumber;
            rPe.InterestPrepayment = this.InterestPrepayment;
            rPe.Interests = this.Interests;
            rPe.PastDueDays = this.PastDueDays;
            rPe.Penalties = this.Penalties;
            rPe.Principal = this.Principal;
            rPe.RepaymentType = this.RepaymentType;

            return rPe;
        }
        public void TestCopyBadLoanRepaymentEvent()
        {
            BadLoanRepaymentEvent BLDE = new BadLoanRepaymentEvent {
                InstallmentNumber = 1, Principal = 100.34m, Interests = 100, Commissions = 200.34m, Penalties = 0, AccruedProvision = 294.34m, ClientType = OClientTypes.Group
            };
            BadLoanRepaymentEvent BLDECopy = BLDE.Copy() as BadLoanRepaymentEvent;

            Assert.AreEqual(BLDE.AccruedProvision.Value, BLDECopy.AccruedProvision.Value);
            Assert.AreEqual(BLDE.Code, BLDECopy.Code);
            Assert.AreEqual(BLDE.Fees.Value, BLDECopy.Fees.Value);
            Assert.AreEqual(BLDE.Id, BLDECopy.Id);
            Assert.AreEqual(BLDE.InstallmentNumber, BLDECopy.InstallmentNumber);
            Assert.AreEqual(BLDE.Interests.Value, BLDECopy.Interests.Value);
            if (BLDE.OLB.HasValue)
            {
                Assert.AreEqual(BLDE.OLB.Value, BLDECopy.OLB.Value);
            }
            if (BLDE.Principal.HasValue)
            {
                Assert.AreEqual(BLDE.Principal.Value, BLDECopy.Principal.Value);
            }
        }
        public void TestCodeCorrectlyGetAndRetrieved()
        {
            BadLoanRepaymentEvent BLDE = new BadLoanRepaymentEvent();

            Assert.AreEqual("RBLE", BLDE.Code);
        }
예제 #4
0
        public void TestRepaymentEventCodeCorrectlyGeneratedWhenBadLoanAndRescheduled()
        {
            BadLoanRepaymentEvent bRE = new BadLoanRepaymentEvent();

            Assert.AreEqual("RBLE", bRE.Code);
        }
예제 #5
0
 private static void _AssertBadLoanRepaymentEvent(BadLoanRepaymentEvent pEvent, DateTime pDate, int pPastDueDays, OCurrency pPrincipal,
                                                  OCurrency pInterest, OCurrency pFees, int pInstallmentNumber)
 {
     _AssertRepaymentEvent(pEvent, "RBLE", pDate, pPastDueDays, pPrincipal, pInterest, pFees, pInstallmentNumber);
 }
예제 #6
0
파일: Loan.cs 프로젝트: Ramazanov/FomsNet
        private RepaymentEvent CreateRepaymentEvent(int installmentNumber, 
                                                    DateTime pDate, 
                                                    OCurrency penaltiesEvent, 
                                                    OCurrency commissionsEvent,
                                                    OCurrency interestEvent, 
                                                    OCurrency interestPrepayment, 
                                                    OCurrency pincipalEvent, 
                                                    int overDueDays,
                                                    bool isGroup, 
                                                    OPaymentType repaymentType, 
                                                    bool pending)
        {
            //We need to generate specific RepaymentEvent in case of bad loan or rescheduled loan
            RepaymentEvent rPe = !_badLoan && Rescheduled && !_writtenOff
                                     ? new RescheduledLoanRepaymentEvent()
                                     : (_badLoan && !_writtenOff
                                        ? new BadLoanRepaymentEvent()
                                            : (_writtenOff ?
                                                new RepaymentOverWriteOffEvent()
                                                : new RepaymentEvent()));

            if ((overDueDays > 0 || penaltiesEvent > 0) && !_writtenOff)
                rPe = new BadLoanRepaymentEvent();
            //identification of pending event must be the last action
            if (pending)
                rPe = new PendingRepaymentEvent(rPe);

            rPe.PastDueDays = overDueDays;
            rPe.InstallmentNumber = installmentNumber;
            rPe.Date = pDate;
            rPe.Penalties = penaltiesEvent;
            rPe.Commissions = commissionsEvent;
            rPe.Interests = interestEvent;
            rPe.RepaymentType = repaymentType;

            if(EscapedMember != null)
            {
                rPe.RepaymentType = OPaymentType.PersonTotalPayment;
            }

            rPe.InterestPrepayment = interestPrepayment;

            rPe.Principal = pincipalEvent;
            rPe.Cancelable = true;
            rPe.ClientType = isGroup ? OClientTypes.Group : OClientTypes.Person;

            // Test if the client has repaid the total principal, interests and penalties owed at date D
            //	In this case, the loan will be regraded to good loan and provision will be cancelled.
            if (_badLoan && !pending)
                _badLoan = _IsBadLoan(rPe, pDate);

            return rPe;
        }
예제 #7
0
        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 RescheduledLoanRepaymentEvent)
            {
                RescheduledLoanRepaymentEvent evt = _event as RescheduledLoanRepaymentEvent;
                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 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);
        }