Example #1
0
        public ActionResult LoanEntry(Loan objLoan)
        {
            LoanBL objLoanBL = new LoanBL();

            try
            {
                if (ModelState.IsValid)
                {
                    int IsRowAffected = objLoanBL.CreateLoan(objLoan);
                    if (IsRowAffected > 0)
                    {
                        ViewBag.Message = "Save Succesfully";
                    }
                    else
                    {
                        ViewBag.Message = "Save Failed";
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.error = ("Error : " + ex.Message);
            }
            var model = new Loan
            {
                BankNameList = objLoanBL.GetBankNameforLoan()
            };

            return(View(model));
        }
Example #2
0
 private void btnProceed_Click(object sender, EventArgs e)
 {
     try
     {
         LoanBL bl = new LoanBL();
         MessageBox.Show(bl.CreateLoan(PopulateLoan()));
         Controller.CloseFrom(this);
     }
     catch (LoanCreateException ex)
     {
         MessageBox.Show("Loan did not pass validation: " + ex.Message);
     }
 }
Example #3
0
        private void NewLoan()
        {
            while (true)
            {
                Console.WriteLine("How much do you need!\n" +
                                  "PS: the interest will be 10% for the Loan(round up if it is decmial number).\n");
                double amount = validation.IsValidAmount(Console.ReadLine());

                if (amount > 0)
                {
                    BL.CreateLoan(amount);
                    break;
                }
            }
        }
Example #4
0
        private void btnConfirmSelection_Click(object sender, EventArgs e)
        {
            try
            {
                ResourceBL rebl    = new ResourceBL();
                LoanBL     loBL    = new LoanBL();
                int        counter = 0;
                foreach (Resource r in resourcestoborrow)
                {
                    if (loBL.CreateLoan(PopulateLoanObject(r, counter), r) && rebl.UpdateResource(r.ResourceId))
                    {
                        LoanBL      loBl     = new LoanBL();
                        List <Loan> loanList = new List <Loan>();
                        loanList = loBl.GetLoan(dtvStudentInfo.Rows[0].Cells["StudentId"].Value.ToString());
                        dtgStudentLoanInfo.DataSource = loanList;

                        if (resourcestoborrow.IndexOf(r) == resourcestoborrow.Count - 1)
                        {
                            MessageBox.Show("Resources were borrowed.");
                        }
                    }
                    else
                    {
                        string msg = string.Empty;
                        foreach (ValidationError error in loBL.Errors)
                        {
                            msg += error.Description + Environment.NewLine;
                        }
                        loBL.Errors.Clear();
                        MessageBox.Show(msg);
                    }
                }
                ClearData();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }