예제 #1
0
 public Reloan(Database database, Loan loan)
 {
     this.database = database;
     this.originalLoan = loan;
     LoanFactory factory = new LoanFactory(DatabaseFactory.Default);
     reloan = factory.Clone(loan);
     reloan.IsReloan = true;
 }
예제 #2
0
        public Reloan(Database database, Loan loan)
        {
            this.database     = database;
            this.originalLoan = loan;
            LoanFactory factory = new LoanFactory(DatabaseFactory.Default);

            reloan          = factory.Clone(loan);
            reloan.IsReloan = true;
        }
예제 #3
0
        private decimal longTermReloanReleaseAmount()
        {
            LoanFactory factory = new LoanFactory(DatabaseFactory.Default);
            Loan newLoan = factory.Clone(originalLoan);
            newLoan.InterestRate = originalLoan.InterestRate + 1;

            decimal newInterest = LoanCalculator.InterestPaymentPart(originalLoan.MonthlyDue, originalLoan.Principal, originalLoan.InterestRate+1, originalLoan.MonthlyDue);
            decimal newPrincipal = originalLoan.MonthlyDue - newInterest;

            return (newPrincipal * originalLoan.MonthsPaid) - originalLoan.ProcessingFee;
        }
예제 #4
0
        private decimal longTermReloanReleaseAmount()
        {
            LoanFactory factory = new LoanFactory(DatabaseFactory.Default);
            Loan        newLoan = factory.Clone(originalLoan);

            newLoan.InterestRate = originalLoan.InterestRate + 1;

            decimal newInterest  = LoanCalculator.InterestPaymentPart(originalLoan.MonthlyDue, originalLoan.Principal, originalLoan.InterestRate + 1, originalLoan.MonthlyDue);
            decimal newPrincipal = originalLoan.MonthlyDue - newInterest;

            return((newPrincipal * originalLoan.MonthsPaid) - originalLoan.ProcessingFee);
        }
예제 #5
0
 private void longTermReloanSave()
 {
     LoanFactory factory = new LoanFactory(DatabaseFactory.Default);
     Loan newLoan = factory.Clone(originalLoan);
     newLoan.Id = 0;
     newLoan.IsReloan = true;
     try
     {
         database.BeginTransaction();
         originalLoan.MarkClosed();
         newLoan.Save();
         database.Commit();
     }
     catch (DatabaseException exception)
     {
         database.Rollback();
     }
 }
예제 #6
0
        private void longTermReloanSave()
        {
            LoanFactory factory = new LoanFactory(DatabaseFactory.Default);
            Loan        newLoan = factory.Clone(originalLoan);

            newLoan.Id       = 0;
            newLoan.IsReloan = true;
            try
            {
                database.BeginTransaction();
                originalLoan.MarkClosed();
                newLoan.Save();
                database.Commit();
            }
            catch (DatabaseException exception)
            {
                database.Rollback();
            }
        }
예제 #7
0
        private void toggleLoanType(Loan.LoanType type)
        {
            LoanFactory factory = new LoanFactory(DatabaseFactory.Default);

            if (type == Loan.LoanType.AmortizedPayment)
            {
                int  term;
                bool parseResult = int.TryParse(termInput.Text, out term);
                term = parseResult ? term : 0;
                loan = factory.ConvertToAmortizedLoan(this.loan as PerpetualInterestLoan, term);
            }
            else if (type == Loan.LoanType.InterestOnlyPayment)
            {
                loan = factory.ConvertToPerpetualInterestLoan(this.loan as AmortizedLoan);
            }
            else
            {
                throw new ArgumentException("Unsupported loan type");
            }
        }
예제 #8
0
 private Loan cloneOriginalLoan(Loan originalLoan)
 {
     LoanFactory factory = new LoanFactory(DatabaseFactory.Default);
     return factory.Clone(originalLoan);
 }
예제 #9
0
        private void toggleLoanType(Loan.LoanType type)
        {
            LoanFactory factory = new LoanFactory(DatabaseFactory.Default);

            if (type == Loan.LoanType.AmortizedPayment)
            {
                int term;
                bool parseResult = int.TryParse(termInput.Text, out term);
                term = parseResult ? term : 0;
                loan = factory.ConvertToAmortizedLoan(this.loan as PerpetualInterestLoan, term);
            }
            else if (type == Loan.LoanType.InterestOnlyPayment)
            {
                loan = factory.ConvertToPerpetualInterestLoan(this.loan as AmortizedLoan);
            }
            else
            {
                throw new ArgumentException("Unsupported loan type");
            }
        }
예제 #10
0
        private Loan cloneOriginalLoan(Loan originalLoan)
        {
            LoanFactory factory = new LoanFactory(DatabaseFactory.Default);

            return(factory.Clone(originalLoan));
        }