public ActionResult BillSchedule()
        {
            int sessionUserID = WebSecurity.GetUserId(User.Identity.Name);
            Bank bank = new Bank();

            return View(bank.billSchedule(sessionUserID));
        }
        public ActionResult StatementView()
        {
            int SessionUserID = WebSecurity.GetUserId(User.Identity.Name);

            Bank bank = new Bank();

            return View(bank.getStatement(SessionUserID));
        }
 public ActionResult BillScheduleUpdate(string id)
 {
     int sessionUserID = WebSecurity.GetUserId(User.Identity.Name);
     Bank bank = new Bank();
     if (id == null)
     {
         return View(bank.billUpdateGet(sessionUserID, null));
     }
     else
     {
         return View(bank.billUpdateGet(sessionUserID, id));
     }
 }
        public ActionResult BillSchedule(ATMBillSchedule_ViewModel models)
        {
            int sessionUserID = WebSecurity.GetUserId(User.Identity.Name);
            Bank bank = new Bank();

            if (ModelState.IsValid)
            {
                HttpContext.Session["accountNumber"] = null;
                return View(bank.billSchedulePost(sessionUserID, models));
            }
            else
            {
                return BillSchedule();
            }
        }
        public ActionResult StatementView(Statement_ViewModel models)
        {
            int SessionUserID = WebSecurity.GetUserId(User.Identity.Name);

            Bank bank = new Bank();

            if (ModelState.IsValid)
            {
                HttpContext.Session["accountNumber"] = models.AccountNumber;
                return View(bank.postStatement(SessionUserID, models));
            }
            else
            {
                HttpContext.Session["accountNumber"] = null;
                return StatementView();
            }
        }
        public ActionResult BillScheduleUpdate(ATMPayBillsSchedule_ViewModel models, string id)
        {
            int sessionUserID = WebSecurity.GetUserId(User.Identity.Name);
            Bank bank = new Bank();

            HttpContext.Session["accountNumber"] = models.AccountNumber;

            if (ModelState.IsValid)
            {
                if (id == null)
                {
                  return View(bank.billUpdatePost(sessionUserID, models, null));
                }
                else
                {
                models.message = "Schedule Bill Had Been Updated";
                return View(bank.billUpdatePost(sessionUserID, models, id));
                }
            }
            else
            {
                return BillScheduleUpdate(id);
            }
        }
 public ActionResult Deposit()
 {
     int sessionUserID = WebSecurity.GetUserId(User.Identity.Name);
     Bank bank = new Bank();
     return View(bank.Deposit(sessionUserID));
 }
        public ActionResult Withdrawal(ATMWithdraw_ViewModel models)
        {
            int sessionUserID = WebSecurity.GetUserId(User.Identity.Name);
            Bank bank = new Bank();

            ATMWithdraw_ViewModel withdrawalView;

            if (ModelState.IsValid)
            {
                withdrawalView = bank.WithdrawalPost(sessionUserID, models);
            }
            else
            {
                return Withdrawal();
            }

            return View(withdrawalView);
        }
 public ActionResult Withdrawal()
 {
     int sessionUserID = WebSecurity.GetUserId(User.Identity.Name);
     Bank bank = new Bank();
     return View(bank.Withdrawal(sessionUserID));
 }
        public ActionResult Transfer(ATMTransfer_ViewModel models)
        {
            int sessionUserID = WebSecurity.GetUserId(User.Identity.Name);
            Bank bank = new Bank();

            ATMTransfer_ViewModel transferView;

            if (ModelState.IsValid)
            {
                transferView = bank.TransferPost(sessionUserID, models);
                HttpContext.Session["fromAccountNumber"] = null;
            }
            else
            {
                HttpContext.Session["fromAccountNumber"] = models.FromAccountNumber;
                return Transfer();
            }

            return View(models);
        }
        public ActionResult PayBills(ATMPayBills_ViewModel models)
        {
            int sessionUserID = WebSecurity.GetUserId(User.Identity.Name);
            Bank bank = new Bank();

            ATMPayBills_ViewModel payBillView;

            if (ModelState.IsValid)
            {
                payBillView = bank.PayBillsPost(sessionUserID, models);
            }
            else
            {
                return PayBills();
            }

            return View(payBillView);
        }
        public ActionResult Deposit(ATMDeposit_ViewModel models)
        {
            int sessionUserID = WebSecurity.GetUserId(User.Identity.Name);
            Bank bank = new Bank();

            ATMDeposit_ViewModel depositView;

            if (ModelState.IsValid)
            {
                depositView = bank.DepositPost(sessionUserID, models);
            }
            else
            {
                return Deposit();
            }

            return View(depositView);
        }
Exemple #13
0
        public void Execute(IJobExecutionContext context)
        {
            //creating a reference to the map that contains the data for the job
            //JobDataMap datamap = context.JobDetail.JobDataMap;

            //Creates a reference to the map that is shared by the same job
            JobDataMap datamap = context.MergedJobDataMap; //<-- creates a shared datamap for this job, need for date persitance
            //Assign values from the job
            accountNumber = datamap.GetInt("Account_Number");
            payeeID = datamap.GetInt("Payee_ID");
            amount = datamap.GetDouble("Amount");

            date = datamap.GetString("Date");
            period = datamap.GetChar("Period");

            Debug.WriteLine("\n\n*** Job Fired Off for Account: " + accountNumber + " " + DateTime.Now.ToString());

            //Debug.WriteLine("###### The  Current datamap is ##### " + date);
            //NEED to convert the date string format to an actual date object inorder to perform operations on it

            convertedDate = DateTime.ParseExact(date, DateFormat, CultureInfo.InvariantCulture);

            //This should call the billpay function to basically withdraw (B) from the bank account
            //Billpay b1 = new Billpay(accountNumber,payeeID,amount,convertedDate);

            //      Debug.WriteLine("Converted datetime object is " + convertedDate.ToString(DateFormat, CultureInfo.InvariantCulture));
            // Debug.WriteLine("current amount " + amount);

            //Debug.WriteLine("Incrementing date and storing it in shared datamap: ");

            switch (period)
            {
                case Billpay.ONCEOFF_PERIOD:
                    Debug.WriteLine("No need to increment month for once off billpay");
                    newDate = convertedDate;
                    break;

                case Billpay.MONTHLY_PERIOD:
                    Debug.WriteLine("#### Adding 1 Month ####");
                    newDate = convertedDate.AddMonths(1);
                    //Debug.WriteLine("Result of calling addMonths()" + newDate.ToString(DateFormat, CultureInfo.InvariantCulture));
                    //newDate = convertedDate.;
                    break;

                case Billpay.QUATER_PERIOD:
                    Debug.WriteLine("#### Adding 3 months #### ");
                    newDate = convertedDate.AddMonths(3);
                    break;

                case Billpay.ANNUAL_PERIOD:
                    Debug.WriteLine("#### Adding 1 Year #####");
                    newDate = convertedDate.AddYears(1);
                    break;
            }

            /* The DATA TYPES CURRENTLY:
             * int accountNumber
             * int payeeID
             * double amount  <--You will need cast to decimal inside billpaytransaction method
             * string date     <--You will need cast to datetime object inside billpaytransaction method
             * char period

            */
            //Call a method in the bank business object to perform a billpay debt on the account
            Bank b1 = new Bank();
            b1.processBillPay(accountNumber, payeeID, amount, date, period);

            //Call another method to update update the BillPay table of the current Date

            Debug.WriteLine("===== SAVING New Date For Next Iteration: " + newDate.ToString(DateFormat, CultureInfo.InvariantCulture));
            //string s = newDate.ToString(DateFormat, CultureInfo.InvariantCulture);
            //Debug.WriteLine("Adding new amount to Map: " + amount);

            //Need to convert the date back to a string so it can be placed back into the job datamap
            //Increments the date for the next job so it can be saved in the db
            //Changing the shared job datamap so date can value can persist with each iteration
            context.JobDetail.JobDataMap.Put("Date", newDate.ToString(DateFormat, CultureInfo.InvariantCulture));
            //context.JobDetail.JobDataMap.Put("Amount", amount);

            testJob();
            Debug.WriteLine("########## Finished running Job ##############");
        }