// method which checks for bad credit
        private bool CheckForBadCredit(int crn)
        {
            //DateTime DateEnd = DateTime.Now;
            //DateTime DateStart = DateEnd - new TimeSpan(365, 0, 0, 0);
            List<Loan> LoanList = null;
            Loan loan = null;
            bool result = false;
            //DateTime Past3Years = DateTime.Now.AddYears(-3);
            DateTime dateTimeNow = DateTime.Now;
            //DateTime Past3Years = dateTimeToday.AddYears(-3);
            DateTime ThreeYearsAgo = dateTimeNow - new TimeSpan(1095, 0, 0, 0);

            try
            {
                DALLoanManager DALMngr = new DALLoanManager();
                LoanList = DALMngr.CallGetLoanList();
                foreach (Loan l in LoanList)
                {

                    if (l.CRN == crn)
                    {
                        loan = l;
                        if ((loan.LoanStatus == "LPIA" || loan.LoanStatus == "CRBD" || loan.LoanStatus == "CRCCJ") && (loan.LoanCommencementDate > ThreeYearsAgo))
                        {
                            // not eligible
                            result = true;
                        }
                    }
                }


            }
            catch (Exception ex)
            {
                throw;
            }

            return result;
        }
        // method to return whether an applicant has an outstanding loan
        private bool GetOutstandingLoan(Loan loan)
        {
            List<Loan> LoanList = null;

            bool outLoans = false;

            try
            {
                DALLoanManager DALMngr = new DALLoanManager();
                LoanList = DALMngr.CallGetLoanList();
                foreach (Loan l in LoanList)
                {
                    if (l.CRN == loan.CRN)
                    {
                        if (l.OutstandingLoans == true)
                        {
                            outLoans = true;
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                throw;
            }

            return outLoans;
        }
        // method to return the value of an applicant's outstanding loan
        private decimal GetOutstandingLoanValue(Loan loan)
        {
            List<Loan> LoanList = null;

            decimal loansValue = 0;

            try
            {
                DALLoanManager DALMngr = new DALLoanManager();
                LoanList = DALMngr.CallGetLoanList();
                foreach (Loan l in LoanList)
                {
                    if (l.CRN == loan.CRN)
                    {
                        loansValue = l.OutstandingLoansValue;
                    }
                }


            }
            catch (Exception ex)
            {
                throw;
            }

            return loansValue;
        }
 //method for returning list of loans
 private List<Loan> GetListOfLoans()
 {
     List<Loan> LoanList = new List<Loan>();
     try
     {
         DALLoanManager DALMngr = new DALLoanManager();
         LoanList = DALMngr.CallGetLoanList();
     }
     catch (Exception ex)
     {
         throw;
     }
     return LoanList;
 }