Exemplo n.º 1
0
        public PerpetualInterestLoan ConvertToPerpetualInterestLoan(AmortizedLoan loan)
        {
            PerpetualInterestLoan outputLoan = PerpetualInterestLoan();

            copyCommonProperties(loan, outputLoan);
            return(outputLoan);
        }
Exemplo n.º 2
0
        public AmortizedLoan ConvertToAmortizedLoan(PerpetualInterestLoan loan, int term)
        {
            AmortizedLoan outputLoan = AmortizedLoan();

            copyCommonProperties(loan, outputLoan);
            outputLoan.Term = term;
            return(outputLoan);
        }
Exemplo n.º 3
0
 private Loan defaultLoan()
 {
     Loan loan = new AmortizedLoan(DatabaseFactory.Default);
     loan.TakenDate = DateTime.Now;
     loan.StartDate = DateTime.Now.AddMonths(1);
     loan.ProcessingFeePercentage = 2;
     return loan;
 }
Exemplo n.º 4
0
        private Loan defaultLoan()
        {
            Loan loan = new AmortizedLoan(DatabaseFactory.Default);

            loan.TakenDate = DateTime.Now;
            loan.StartDate = DateTime.Now.AddMonths(1);
            loan.ProcessingFeePercentage = 2;
            return(loan);
        }
Exemplo n.º 5
0
        private void initializeListFromDatabase()
        {
            if (loanList != null)
            {
                return;
            }
            loanList = new Dictionary <long, Loan>();
            string condition;
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            constructCondition(out condition, parameters);
            string sql = string.Format("SELECT * FROM loans WHERE {0} ORDER BY start_date", condition);

            DataTable results = this.database.Query(sql, parameters);

            foreach (DataRow row in results.Rows)
            {
                Loan.LoanType type = (Loan.LoanType) int.Parse(row["type"].ToString());
                Loan          loan;
                if (type == Loan.LoanType.AmortizedPayment)
                {
                    loan      = new AmortizedLoan(DatabaseFactory.Default);
                    loan.Term = int.Parse(row["term"].ToString());
                }
                else if (type == Loan.LoanType.InterestOnlyPayment)
                {
                    loan = new PerpetualInterestLoan(DatabaseFactory.Default);
                }
                else
                {
                    throw new ApplicationException("Invalid loan type found in database");
                }

                loan.Account      = account;
                loan.Id           = long.Parse(row["id"].ToString());
                loan.InterestRate = decimal.Parse(row["interest"].ToString());
                loan.Principal    = decimal.Parse(row["principal"].ToString());
                loan.Remarks      = row["remarks"].ToString();
                loan.StartDate    = DateTime.Parse(row["start_date"].ToString());
                loan.TakenDate    = DateTime.Parse(row["taken_date"].ToString());

                loanList.Add(loan.Id, loan);
            }
        }
Exemplo n.º 6
0
 public PerpetualInterestLoan ConvertToPerpetualInterestLoan(AmortizedLoan loan)
 {
     PerpetualInterestLoan outputLoan = PerpetualInterestLoan();
     copyCommonProperties(loan, outputLoan);
     return outputLoan;
 }