public void CacheItemRemoved(string taskName, object v, CacheItemRemovedReason r) { // do stuff here if it matches our taskname, like WebRequest if (taskName.Equals("PatBatch") && !AppHelper.IsLocalWorkstation) { BatchJobs.DoJob(taskName, "AUTO"); } // re-add our task so it recurs AddTask(taskName, Convert.ToInt32(v)); }
public ActionResult ForceBatch(SystemViewModel vm) { try { if (BatchJobs.DoJob("PatBatch", string.Format("Forced by {0}", HttpContext.User.Identity.Name.RemoveDomain()))) { TempData[CommonConstants.FlashMessageTypeInfo] = "Batch processing complete"; } else { TempData[CommonConstants.FlashMessageTypeError] = "Batch processing detected Integrity Errors"; } return(RedirectToAction("RecentActivity", "Home")); } catch (Exception ex) { ErrorLog.GetDefault(null).Log(new Error(ex)); return(View("Error", new HandleErrorInfo(ex, "Home", "ForceBatch"))); } }