public virtual IEnumerable MarkAsCompleted(PXAdapter adapter) { WZTaskEntry graph = PXGraph.CreateInstance <WZTaskEntry>(); WZTask selectedTask = Tasks.Current; if (selectedTask != null && selectedTask.Status != WizardTaskStatusesAttribute._PENDING && selectedTask.Status != WizardTaskStatusesAttribute._DISABLED) { if (graph.CanTaskBeCompleted(selectedTask)) { selectedTask.Status = WizardTaskStatusesAttribute._COMPLETED; graph.TaskInfo.Update(selectedTask); graph.Save.Press(); if (graph.ScenarioTasksCompleted(selectedTask.ScenarioID)) { PXSiteMap.Provider.Clear(); PXSiteMapNode node = PXSiteMap.Provider.FindSiteMapNodeByScreenID("WZ201505"); throw new PXRedirectToUrlException(node.Url + "?ScenarioID=" + selectedTask.ScenarioID, PXBaseRedirectException.WindowMode.Same, "Refresh SiteMap"); } } else { throw new PXException(Messages.CannotBeCompletedWileOpenTasks); } } Tasks.Cache.ClearQueryCache(); Scenario.Cache.ClearQueryCache(); Scenario.Cache.Clear(); Scenario.View.RequestRefresh(); return(adapter.Get()); }
public virtual IEnumerable MarkAsComplete(PXAdapter adapter) { WZTaskEntry graph = PXGraph.CreateInstance <WZTaskEntry>(); WZTask selectedTask = Tasks.Current; if (selectedTask != null && selectedTask.Status != WizardTaskStatusesAttribute._PENDING && selectedTask.Status != WizardTaskStatusesAttribute._DISABLED) { if (graph.CanTaskBeCompleted(selectedTask)) { selectedTask.Status = WizardTaskStatusesAttribute._COMPLETED; graph.TaskInfo.Update(selectedTask); graph.Save.Press(); } else { throw new PXException(Messages.CannotBeCompletedWileOpenTasks); } } Tasks.Cache.ClearQueryCache(); return(adapter.Get()); }