public ActionResult LoanApproval(LoanApprovalModel lam)
        {
            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            UserInfo ui = CookieFacade.USERINFO;

            if (ui.Username != "mark")
            {
                ViewBag.Message = "Only manager is available to change the loan status..";
            }
            try
            {
                if (ModelState.IsValid && ui.Username == "mark")
                {
                    bool ret = ibank.LoanApproval(ui.CheckingAcccountNumber, ui.SavingAccountNumber, lam.Amount, lam.UserName);

                    if (ret == true)
                    {
                        ViewBag.Message = "Loan status changed successfully..";
                        ModelState.Clear();
                        // otherwise, textbox will display the old amount
                        lam.Status = "Approved";
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }
            //alm.Amount = ibank.GetAmountDue(ui.CheckingAcccountNumber);
            return(View(lam));
        }
Ejemplo n.º 2
0
        public ActionResult TransferSavingToChecking(TransferSToCModel tcs)
        {
            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            UserInfo ui = CookieFacade.USERINFO;

            try
            {
                if (ModelState.IsValid)
                {
                    bool ret = ibank.TransferSavingToChecking(ui.CheckingAcccountNumber, ui.SavingAccountNumber, tcs.Amount);
                    if (ret == true)
                    {
                        ViewBag.Message = "Transfer successful..";
                        ModelState.Clear();   // otherwise, textbox will display the old amount
                        tcs.Amount = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }
            tcs.CheckingBalance = ibank.GetCheckingBalance(ui.CheckingAcccountNumber);
            tcs.SavingBalance   = ibank.GetSavingBalance(ui.SavingAccountNumber);
            return(View(tcs));
        }
        public ActionResult PhoneBillPayment(PhoneBillModel pbm)
        {
            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            UserInfo ui = CookieFacade.USERINFO;

            try
            {
                if (ModelState.IsValid)
                {
                    bool ret = ibank.TransferBillFromChecking(ui.CheckingAcccountNumber, ui.SavingAccountNumber, pbm.Amount);
                    if (ret == true)
                    {
                        ViewBag.Message = "Transfer successful..";
                        ModelState.Clear();
                        // otherwise, textbox will display the old amount
                        pbm.Amount = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }
            pbm.CheckingBalance = ibank.GetCheckingBalance(ui.CheckingAcccountNumber);
            pbm.Amount          = ibank.GetAmountDue(ui.CheckingAcccountNumber);
            return(View(pbm));
        }
        public ActionResult TransferHistory()
        {
            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            UserInfo ui = CookieFacade.USERINFO;
            List <TransactionHistoryModel> THList = ibank.GetTransactionHistory(ui.CheckingAcccountNumber);

            return(View(THList));
        }
        // GET: Banking
        public ActionResult PhoneBillPayment()
        {
            PhoneBillModel   pbm   = new PhoneBillModel();
            UserInfo         ui    = CookieFacade.USERINFO;
            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            pbm.CheckingAccountNumber = ui.CheckingAcccountNumber;
            pbm.CheckingBalance       = ibank.GetCheckingBalance(ui.CheckingAcccountNumber);
            pbm.Amount      = ibank.GetAmountDue(ui.CheckingAcccountNumber);
            ViewBag.Message = "";
            return(View(pbm));
        }
        // GET: Banking
        public ActionResult ApplyLoan()
        {
            ApplyLoanModel   alm   = new ApplyLoanModel();
            UserInfo         ui    = CookieFacade.USERINFO;
            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            alm.UserName = ui.Username;
            alm.Amount   = ibank.GetAmountDue(ui.CheckingAcccountNumber);
            //alm.Status = ibank.GetAmountDue(ui.CheckingAcccountNumber);
            ViewBag.Message = "";
            return(View(alm));
        }
Ejemplo n.º 7
0
        public ActionResult TransferSavingToChecking()
        {
            TransferSToCModel tcs   = new TransferSToCModel();
            UserInfo          ui    = CookieFacade.USERINFO;
            IBusinessBanking  ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            tcs.CheckingBalance = ibank.GetCheckingBalance(ui.CheckingAcccountNumber);
            tcs.SavingBalance   = ibank.GetSavingBalance(ui.SavingAccountNumber);
            tcs.Amount          = 5;
            ViewBag.Message     = "There is a $5 fee to transfer from Saving Account To Checking Account";
            return(View(tcs));
        }
        public ActionResult LoanStatus()
        {
            LoanStatusModel  lsm   = new LoanStatusModel();
            UserInfo         ui    = CookieFacade.USERINFO;
            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            lsm.Username = ui.Username;
            string ret = ibank.ShowLoanStatus(ui.Username);

            lsm.Status = ret;

            ViewBag.Message = "";
            return(View(lsm));
        }
        // GET: Banking
        public ActionResult LoanApproval()
        {
            LoanApprovalModel lam   = new LoanApprovalModel();
            UserInfo          ui    = CookieFacade.USERINFO;
            IBusinessBanking  ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();


            lam.UserName = ibank.GetAllLoanUsers("pending");
            for (int i = 0; i < lam.UserName.Count; i++)
            {
                lam.Status = ibank.ShowLoanStatus(lam.UserName[i]);
            }
            ViewBag.Message = "";
            return(View(lam));
        }
Ejemplo n.º 10
0
        public ActionResult Login(LoginModel lm)
        {
            IBusinessAuthentication iba = GenericFactory <Business, IBusinessAuthentication> .GetInstance();

            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            IBusinessLoan iloan = GenericFactory <Business, IBusinessLoan> .GetInstance();

            if (ModelState.IsValid)
            {
                // check if valid user
                bool ret = iba.CheckIfValidUser(lm.Username, lm.Password);
                if (ret == true)
                {
                    string roles = iba.GetRolesForUser(lm.Username);
                    // send the pipedelimited roles as an authentication cookie back to the browser
                    FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, lm.Username, DateTime.Now, DateTime.Now.AddMinutes(15), false, roles);
                    string     encryptedTicket           = FormsAuthentication.Encrypt(authTicket);
                    HttpCookie ck = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                    Response.Cookies.Add(ck);
                    // ----obtaing checking account number and saving account number for user
                    long     checkingAccountNum  = ibank.GetCheckingAccountNumForUser(lm.Username);
                    long     savingAccountNumber = ibank.GetSavingAccountNumForUser(lm.Username);
                    UserInfo ui = new UserInfo();
                    ui.CheckingAcccountNumber = checkingAccountNum;
                    ui.SavingAccountNumber    = savingAccountNumber;
                    ui.Username = lm.Username;
                    //HttpCookie ckuser = new HttpCookie("UserInfo");
                    //ckuser["USERDATA"] = ui.LosSerialize();
                    //Response.Cookies.Add(ckuser);
                    CookieFacade.USERINFO = ui;
                    CacheAbstraction cabs = new CacheAbstraction();
                    cabs.Remove("TRHISTORY" + ":" + checkingAccountNum);
                    //----------------------------------------------------
                    string redirectURL = FormsAuthentication.GetRedirectUrl(lm.Username, false);
                    if (redirectURL == "/default.aspx")
                    {
                        redirectURL = "~/home/index";
                    }
                    //Response.Redirect(redirectURL);
                    // causes antiforgery token exception
                    return(Redirect(redirectURL));
                }
                ViewBag.Message = "Invalid login..";
            }
            return(View(lm));
        }
Ejemplo n.º 11
0
        public ActionResult BillPayment()
        {
            List <BillPayment> billPayments = new List <BillPayment>();

            try
            {
                IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

                UserInfo ui = CookieFacade.USERINFO;
                billPayments = ibank.GetBills(ui.Username);
                BillPayment bp = new BillPayment();
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }
            return(View(billPayments));
        }
Ejemplo n.º 12
0
        public ActionResult Pay(PayBills pay)
        {
            bool res = false;

            try
            {
                IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

                UserInfo ui         = CookieFacade.USERINFO;
                int      selectedID = pay.selectedBill;
                pay.billPayments = ibank.GetUnPaidBills(ui.Username);
                BillPayment Bill = null;
                foreach (BillPayment bill in pay.billPayments)
                {
                    if (bill.BillID == selectedID)
                    {
                        Bill = bill;
                        break;
                    }
                }
                if (Bill != null)
                {
                    res = ibank.payBill(ui.CheckingAcccountNumber, Bill.BillID, Bill.Amount);
                    if (res)
                    {
                        ViewBag.Message = "Bill Paid";
                        ModelState.Clear();
                        pay.selectedBill = 0;
                    }
                }
                else
                {
                    ViewBag.Message = "This bill is already paid";
                    ModelState.Clear();
                    pay.selectedBill = 0;
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }

            return(View(pay));
        }
Ejemplo n.º 13
0
        public ActionResult Pay()
        {
            PayBills pay = new PayBills();

            try
            {
                IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

                UserInfo           ui           = CookieFacade.USERINFO;
                List <BillPayment> billPayments = ibank.GetUnPaidBills(ui.Username);
                pay.billPayments = billPayments;
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }

            return(View(pay));
        }
        public ActionResult ApplyLoan(ApplyLoanModel alm)
        {
            int count = 0;
            IBusinessBanking ibank = GenericFactory <Business, IBusinessBanking> .GetInstance();

            UserInfo ui = CookieFacade.USERINFO;

            if (ui.Username == "mark")
            {
                ViewBag.Message = "Only customer is available to apply the loan ..";
            }
            try
            {
                if (ModelState.IsValid && ui.Username != "mark" && count == 0)
                {
                    if (count != 0)
                    {
                        ViewBag.Message = "You already applied the loan ..";
                    }
                    bool ret = ibank.ApplyLoan(ui.CheckingAcccountNumber, ui.SavingAccountNumber, alm.Amount, ui.Username);
                    if (ret == true)
                    {
                        ViewBag.Message = "Applied a loan successfully..";
                        ModelState.Clear();
                        // otherwise, textbox will display the old amount
                        alm.Amount = 0;
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }
            //alm.Amount = ibank.GetAmountDue(ui.CheckingAcccountNumber);
            return(View(alm));
        }
Ejemplo n.º 15
0
 public TransactionHistoryModel(IBusinessBanking businessBanking)
 {
     _IBusinessBanking = businessBanking;
 }
 public ShowBalancesModel(IBusinessBanking businessBanking)
 {
     _IBusinessBanking = businessBanking;
 }
Ejemplo n.º 17
0
 public XferStoCModel(IBusinessBanking ibusbank)
 {
     _ibusbank = ibusbank;
 }
Ejemplo n.º 18
0
 public ShowBalancesModel(IBusinessBanking ibusbank)
 {
     _ibusbank = ibusbank;
 }
 public BillPaymentModel(IBusinessBanking ibusbank)
 {
     _ibusbank = ibusbank;
 }
Ejemplo n.º 20
0
 public TransferMoneyFromSavingsToCheckingModel(IBusinessBanking businessBanking)
 {
     _IBusinessBanking = businessBanking;
 }
 public XferCToSModel(IBusinessBanking ibusbank)
 {
     _ibusbank = ibusbank;
 }
 public TransactionHistoryModel(IBusinessBanking ibusbank)
 {
     _ibusbank = ibusbank;
 }