Esempio n. 1
0
        /*PayBillsPost
         * Triggered when the user submits the form for processing once they have filled in the details
         * about the scheduled billpay job they want to schedule.
         */
        public ATMPayBills_ViewModel PayBillsPost(int sessionUserID, ATMPayBills_ViewModel models)
        {
            //Now adding the job to the schuduler to be fired off in 1minute
            Billpay BPayReference = new Billpay();

            BPayReference.manualCreateBPayJob(models.FromAccountNumber, models.Payee, models.Amount, models.Period, models.ScheduledDate);

            Customer customerQuery = Repo.GetCustomerSingle(sessionUserID);
            var      accountQuery  = Repo.GetCustomerAccountQueryable(sessionUserID);
            var      allPayeeQuery = Repo.GetAllPayeeQueryable();

            IEnumerable <SelectListItem> accounts = accountQuery.OrderBy(a => a.AccountNumber).ToList().Select(a => new SelectListItem
            {
                Value = Convert.ToString(a.AccountNumber),
                Text  = (a.AccountType.Equals("S")) ? "Savings - " + a.AccountNumber.ToString() + " - $" + a.Balance
                                                       : "Checkings - " + a.AccountNumber.ToString() + " - $" + a.Balance
            });

            IEnumerable <SelectListItem> allPayee = allPayeeQuery.OrderBy(p => p.PayeeID).ToList().Select(p => new SelectListItem
            {
                Value = Convert.ToString(p.PayeeID),
                Text  = (p.PayeeID + " - " + p.PayeeName)
            });

            models.CustomerName = customerQuery.CustomerName;
            models.AccountList  = accounts;
            models.AllPayeeList = allPayee;
            models.Message      = "Bill Pay Schedule Recorded/Scheduled SUCCESSFULLY";

            return(models);
        }
Esempio n. 2
0
        /*THis method is called when the user presses the Suspend button on a billpay record on the view they would like to suspend.
            * The Billpay ID of the associated BillPay record is passed to the method
            *
            */
        public ActionResult GridPauseJob(string id)
        {
            Debug.WriteLine("Request to suspend Job " + id);
            Billpay bill = new Billpay();
            bill.SuspendJob(id);

            return RedirectToAction("StopScheduledPayments", this.GridRouteValues());
        }
Esempio n. 3
0
 public ActionResult GridDelete(string id)
 {
     Billpay bill = new Billpay();
     if (bill.removeJob(id))
     {
         //returns a http 302 - redirect and passes the grid settings such as page, grouping set by user during session
         return RedirectToAction("StopScheduledPayments", this.GridRouteValues());
     }
     return RedirectToAction("StopScheduledPayments", this.GridRouteValues());
 }
Esempio n. 4
0
        /*PayBillUpdatePost
         * This method actually triggered when the user submit the changes they have made to the schdulked job
         * Method will modify the database and also modify the active billpay job in the schduler
         */
        public ATMPayBillsSchedule_ViewModel billUpdatePost(int sessionID, ATMPayBillsSchedule_ViewModel models, string id)
        {
            int billID = 0;

            if (id != null)
            {
                billID = int.Parse(id);
            }

            //Create a billPayObject instance with newly updated properties
            //and send it to repositry to handle the update to DB.
            BillPay  UpdatedBillPayObject = new BillPay();
            DateTime ScheduleDateFormat   = DateTime.ParseExact(models.ScheduleDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            UpdatedBillPayObject.BillPayID     = billID;
            UpdatedBillPayObject.AccountNumber = models.AccountNumber;
            UpdatedBillPayObject.PayeeID       = models.PayeeID;
            UpdatedBillPayObject.Amount        = models.Amount;
            UpdatedBillPayObject.ScheduleDate  = ScheduleDateFormat;
            UpdatedBillPayObject.Period        = models.Period;
            UpdatedBillPayObject.ModifyDate    = System.DateTime.Now;

            Repo.UpdateExistingBillPayRecord(UpdatedBillPayObject);

            //Tell the schduler to remove the job
            //and now manually create a new job with the newly updated information
            Billpay BillPayBusinessObj = new Billpay();

            BillPayBusinessObj.ModifyJob(UpdatedBillPayObject);

            //######### Repopulating the viewmodel Below ####

            var customerQuery    = Repo.GetCustomerSingle(sessionID);
            var AccountListQuery = Repo.GetCustomerAccountQueryable(sessionID);
            var allPayeeQuery    = Repo.GetAllPayeeQueryable();

            IEnumerable <SelectListItem> accounts = AccountListQuery.OrderBy(a => a.AccountNumber).ToList().Select(a => new SelectListItem
            {
                Value = Convert.ToString(a.AccountNumber),
                Text  = (a.AccountType.Equals("S")) ? "Savings - " + a.AccountNumber.ToString() + " - $" + a.Balance
                                                       : "Checkings - " + a.AccountNumber.ToString() + " - $" + a.Balance
            });

            IEnumerable <SelectListItem> allPayee = allPayeeQuery.OrderBy(p => p.PayeeID).ToList().Select(p => new SelectListItem
            {
                Value = Convert.ToString(p.PayeeID),
                Text  = (p.PayeeID + " - " + p.PayeeName)
            });

            models.CustomerName = customerQuery.CustomerName;
            models.accountList  = accounts;
            models.AllPayeeList = allPayee;

            return(models);
        }
Esempio n. 5
0
        /*PayBillsPost
         *Triggered when the user submits the form for processing once they have filled in the details
         * about the scheduled billpay job they want to schedule.
         */
        public ATMPayBills_ViewModel PayBillsPost(int sessionUserID, ATMPayBills_ViewModel models)
        {
            //Now adding the job to the schuduler to be fired off in 1minute
            Billpay BPayReference = new Billpay();
            BPayReference.manualCreateBPayJob(models.FromAccountNumber, models.Payee, models.Amount, models.Period, models.ScheduledDate);

            Customer customerQuery = Repo.GetCustomerSingle(sessionUserID);
            var accountQuery = Repo.GetCustomerAccountQueryable(sessionUserID);
            var allPayeeQuery = Repo.GetAllPayeeQueryable();

            IEnumerable<SelectListItem> accounts = accountQuery.OrderBy(a => a.AccountNumber).ToList().Select(a => new SelectListItem
            {
                Value = Convert.ToString(a.AccountNumber),
                Text = (a.AccountType.Equals("S")) ? "Savings - " + a.AccountNumber.ToString() + " - $" + a.Balance
                                                       : "Checkings - " + a.AccountNumber.ToString() + " - $" + a.Balance
            });

            IEnumerable<SelectListItem> allPayee = allPayeeQuery.OrderBy(p => p.PayeeID).ToList().Select(p => new SelectListItem
            {
                Value = Convert.ToString(p.PayeeID),
                Text = (p.PayeeID + " - " + p.PayeeName)
            });

            models.CustomerName = customerQuery.CustomerName;
            models.AccountList = accounts;
            models.AllPayeeList = allPayee;
            models.Message = "Bill Pay Schedule Recorded/Scheduled SUCCESSFULLY";

            return models;
        }
Esempio n. 6
0
        /*PayBillUpdatePost
         *This method actually triggered when the user submit the changes they have made to the schdulked job
         * Method will modify the database and also modify the active billpay job in the schduler
         */
        public ATMPayBillsSchedule_ViewModel billUpdatePost(int sessionID, ATMPayBillsSchedule_ViewModel models, string id)
        {
            int billID = 0;
            if (id != null)
            {
                billID = int.Parse(id);
            }

            //Create a billPayObject instance with newly updated properties
            //and send it to repositry to handle the update to DB.
            BillPay UpdatedBillPayObject = new BillPay();
            DateTime ScheduleDateFormat = DateTime.ParseExact(models.ScheduleDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            UpdatedBillPayObject.BillPayID = billID;
            UpdatedBillPayObject.AccountNumber = models.AccountNumber;
            UpdatedBillPayObject.PayeeID = models.PayeeID;
            UpdatedBillPayObject.Amount = models.Amount;
            UpdatedBillPayObject.ScheduleDate = ScheduleDateFormat;
            UpdatedBillPayObject.Period = models.Period;
            UpdatedBillPayObject.ModifyDate = System.DateTime.Now;

            Repo.UpdateExistingBillPayRecord(UpdatedBillPayObject);

            //Tell the schduler to remove the job
            //and now manually create a new job with the newly updated information
            Billpay BillPayBusinessObj = new Billpay();
            BillPayBusinessObj.ModifyJob(UpdatedBillPayObject);

            //######### Repopulating the viewmodel Below ####

            var customerQuery = Repo.GetCustomerSingle(sessionID);
            var AccountListQuery = Repo.GetCustomerAccountQueryable(sessionID);
            var allPayeeQuery = Repo.GetAllPayeeQueryable();

            IEnumerable<SelectListItem> accounts = AccountListQuery.OrderBy(a => a.AccountNumber).ToList().Select(a => new SelectListItem
            {
                Value = Convert.ToString(a.AccountNumber),
                Text = (a.AccountType.Equals("S")) ? "Savings - " + a.AccountNumber.ToString() + " - $" + a.Balance
                                                       : "Checkings - " + a.AccountNumber.ToString() + " - $" + a.Balance
            });

            IEnumerable<SelectListItem> allPayee = allPayeeQuery.OrderBy(p => p.PayeeID).ToList().Select(p => new SelectListItem
            {
                Value = Convert.ToString(p.PayeeID),
                Text = (p.PayeeID + " - " + p.PayeeName)
            });

            models.CustomerName = customerQuery.CustomerName;
            models.accountList = accounts;
            models.AllPayeeList = allPayee;

            return models;
        }
Esempio n. 7
0
        public ActionResult StopScheduledPayments()
        {
            Debug.WriteLine("Inside Stop Schduled payment View Model in Admin Controller");

            //This model will contains 2 lists which are needed to populate the 2 grids for this view
            var models = new BillPayList_ViewModel();

            //Request a list of current active scheduled jobs(BillPayID's) from the scheduler
            Billpay billPayObject = new Billpay();
            List<int> currentActiveBillPayJobs = billPayObject.GetAllActiveJobs();

            //LINQ statement to return billPayee_view objects inside an iquerable
            //This linq will return only billpays for current jobs that have been scheduled because of the passed in currentBillPayJobs
            //Each record will create a CustomerAccount object with information from both tables
            //The query will return a IEnurable collection of CustomerAccount_View objects/types
            //The CustomerAccount_View is a POCO with properties from 2 db tables
            using (NWBAEntities db = new NWBAEntities())
            {
                var query = (from x in db.BillPays
                             join y in db.Payees on x.PayeeID equals y.PayeeID
                             where currentActiveBillPayJobs.Contains(x.BillPayID)
                             select new BillPayPayee_View()
                             {
                                 MyBillPayID = x.BillPayID,
                                 MyAccountNumber = x.AccountNumber,
                                 MyPayeeID = x.PayeeID,
                                 MyAmount = x.Amount,
                                 MyScheduleDate = x.ScheduleDate,
                                 MyPeriod = x.Period,
                                 MyModifyDate = x.ModifyDate,
                                 MyPayeeName = y.PayeeName
                             });

                //Adding each account record to the viewmodel list which will passed to the view
                //Cheap and nasty way instead of using .toList
                foreach (var i in query)
                {
                    models.ActiveBPayJobsGrid.Add(i);
                }

                //Request a list of current Paused scheduled jobs(BillPayID's) from the scheduler
                List<int> currentPausedBillPayJobs = billPayObject.GetAllPausedJobs();

                var query2 = (from x in db.BillPays
                             join y in db.Payees on x.PayeeID equals y.PayeeID
                              where currentPausedBillPayJobs.Contains(x.BillPayID)
                             select new BillPayPayee_View()
                             {
                                 MyBillPayID = x.BillPayID,
                                 MyAccountNumber = x.AccountNumber,
                                 MyPayeeID = x.PayeeID,
                                 MyAmount = x.Amount,
                                 MyScheduleDate = x.ScheduleDate,
                                 MyPeriod = x.Period,
                                 MyModifyDate = x.ModifyDate,
                                 MyPayeeName = y.PayeeName
                             });

                //Adding each account record to the viewmodel list which will passed to the view
                //Cheap and nasty way instead of using .toList
                foreach (var i in query2)
                {
                    models.PausedBPayJobsGrid.Add(i);
                }
                return View(models);
            }
        }