public static void QueueLGURefreshForArea(DbGeometry oldShape, DbGeometry newShape)
        {
            DbGeometry loadGeneratingUnitRefreshAreaGeometry;

            if (oldShape == null && newShape == null)
            {
                throw new InvalidOperationException("At least one input to QueueLGURefreshForArea must not be null.");
            }

            if (oldShape == null)
            {
                loadGeneratingUnitRefreshAreaGeometry = newShape;
            }
            else if (newShape == null)
            {
                loadGeneratingUnitRefreshAreaGeometry = oldShape;
            }
            else
            {
                loadGeneratingUnitRefreshAreaGeometry = oldShape.Union(newShape);
            }

            var loadGeneratingUnitRefreshArea = new LoadGeneratingUnitRefreshArea(loadGeneratingUnitRefreshAreaGeometry);

            HttpRequestStorage.DatabaseEntities.LoadGeneratingUnitRefreshAreas.Add(loadGeneratingUnitRefreshArea);
            HttpRequestStorage.DatabaseEntities.SaveChanges();

            BackgroundJob.Enqueue(() => ScheduledBackgroundJobLaunchHelper.RunLoadGeneratingUnitRefreshJob(loadGeneratingUnitRefreshArea.LoadGeneratingUnitRefreshAreaID));
        }
        public ActionResult RefreshHRUCharacteristics(ConfirmDialogFormViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(ViewRefreshHRUCharacteristics(viewModel));
            }

            BackgroundJob.Enqueue(() => ScheduledBackgroundJobLaunchHelper.RunLoadGeneratingUnitRefreshJob(null));
            BackgroundJob.Enqueue(() => ScheduledBackgroundJobLaunchHelper.RunHRURefreshJob());

            SetMessageForDisplay("HRU Characteristic refresh will run in the background.");
            return(new ModalDialogFormJsonResult());
        }
 public ContentResult TriggerLGURun()
 {
     BackgroundJob.Enqueue(() => ScheduledBackgroundJobLaunchHelper.RunLoadGeneratingUnitRefreshJob(null));
     return(Content("LGU refresh will run in the background"));
 }