/*This method is called when the user presses the Resume Button on the billpay record on the grid. * The associated row with the BillpayID is passed to the method which calls the billpay business * object to resume the billpay job */ public ActionResult GridResumeJob(string id) { Debug.WriteLine("Request to Resume Job " + id); Billpay bill = new Billpay(); bill.ResumeJob(id); return(RedirectToAction("StopScheduledPayments", this.GridRouteValues())); }
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())); }
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)); } }