Exemplo n.º 1
0
        // method to filter loans between dates
        private void FilterListByDateRange(DateTime startDate, DateTime endDate)
        {
            try
            {
                BLLLoanManager BLLMngr = new BLLLoanManager();
                List<Loan> LoanList = BLLMngr.CallGetListOfLoans();

                LoanList = LoanList.Where((loan) => loan.LoanApplicationDate >= startDate && loan.LoanApplicationDate <= endDate).ToList();

                dgvMainFormApplicant.Visible = false;
                dgvMainFormLoans.Visible = true;
                dgvMainFormLoans.DataSource = LoanList;
                LoansInDGV = LoanList;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw;
            }
        }
Exemplo n.º 2
0
        // method to filter loans based on loan status
        private void FilterListByStatus(string status)
        {
            try
            {
                BLLLoanManager BLLMngr = new BLLLoanManager();
                List<Loan> LoanList = BLLMngr.CallGetListOfLoans();

                LoanList = LoanList.Where((loan) => loan.LoanStatus == status).ToList();

                dgvMainFormApplicant.Visible = false;
                dgvMainFormLoans.Visible = true;
                dgvMainFormLoans.DataSource = LoanList;
                LoansInDGV = LoanList;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw;
            }

        }
Exemplo n.º 3
0
 // method to sort loans by atb descending
 private void SortLoansByATBDesc()
 {
     try
     {
         BLLLoanManager BLLMngr = new BLLLoanManager();
         List<Loan> LoanList = BLLMngr.CallGetListOfLoans();
         LoanList = LoanList.OrderByDescending((loan) => loan.ATB).ToList();
         dgvMainFormApplicant.Visible = false;
         dgvMainFormLoans.Visible = true;
         dgvMainFormLoans.DataSource = LoanList;
         LoansInDGV = LoanList;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         throw;
     }
 }
Exemplo n.º 4
0
        // sort loans by date ascending
        private void SortLoansByDateAsc()
        {
            try
            {
                BLLLoanManager BLLMngr = new BLLLoanManager();
                List<Loan> LoanList = BLLMngr.CallGetListOfLoans();
                LoanList.Sort((loan1, loan2) => loan1.LoanApplicationDate.CompareTo(loan2.LoanApplicationDate));


                dgvMainFormApplicant.Visible = false;
                dgvMainFormLoans.Visible = true;
                dgvMainFormLoans.DataSource = LoanList;
                LoansInDGV = LoanList;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw;
            }
        }
Exemplo n.º 5
0
        // method to find applicant by lrn
        private void SearchLRNNumber(int lrn)
        {
            try
            {
                BLLApplicantManager BLLMngrApp = new BLLApplicantManager();                
                List<Applicant> ApplicantList = BLLMngrApp.CallGetListOfApplicants();

                BLLLoanManager BLLMngrLoan = new BLLLoanManager();
                List<Loan> LoanList = BLLMngrLoan.CallGetListOfLoans();
                Loan getLoan = null;

                foreach (Loan loan in LoanList)
                {
                    if (loan.LRN == lrn)
                    {
                        getLoan = loan;
                    }
                }
                int crn = getLoan.CRN;
                ApplicantList = ApplicantList.Where((applicant) => applicant.CRN == crn).ToList();
                dgvMainFormLoans.Visible = false;
                dgvMainFormApplicant.Visible = true;
                dgvMainFormApplicant.DataSource = ApplicantList;
                ApplicantsInDGV = ApplicantList;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                throw;
            }
            
        }
Exemplo n.º 6
0
        // returns selected loan object on datagridview
        private Loan GetSelectedLoan()
        {
            Loan SelectLoan = null;
            int lrn = 0;
            int ColumnIndex = 0;
            int RowIndex = 0;

            try
            {
                BLLLoanManager BLLMngr = new BLLLoanManager();
                List<Loan> LoanList = BLLMngr.CallGetListOfLoans();
                if (dgvMainFormLoans.SelectedRows.Count > 0)
                {
                    RowIndex = dgvMainFormLoans.SelectedRows[0].Index;
                    lrn = (int)dgvMainFormLoans.Rows[RowIndex].Cells[ColumnIndex].Value;

                    for (int i = 0; i < LoanList.Count; i++)
                    {
                        if (LoanList[i].LRN == lrn)
                        {
                            SelectLoan = LoanList[i];
                            break;
                        }
                    }
                }
                
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return SelectLoan;
            
        }
Exemplo n.º 7
0
 // method which gets list of loans from database and populates a datagridview with them
 private void PrimeLoanListDGV()
 {
                
     try
     {
         BLLLoanManager BLLMngr = new BLLLoanManager();
         List<Loan> LoanList = BLLMngr.CallGetListOfLoans();
         dgvMainFormApplicant.Visible = false;
         dgvMainFormLoans.Visible = true;
         dgvMainFormLoans.DataSource = LoanList;
         LoansInDGV = LoanList;
     
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }