private void SetAwardPhase(ArpsAward arpsAward, string button) { arpsAward.Phase = button == "Approve" ? GetAwardPhaseForApproval(arpsAward, button) : button == "Return" ? AwardPhase.Initiator : AwardPhase.End; }
public ActionResult Post(ArpsAward arpsAward) { // GetName getname = new GetName(); var arpsAwardFromSession = SessionHelper.ArpsAward; arpsAward.Phase = arpsAwardFromSession.Phase; var viewName = WorkflowHelper.GetViewName(arpsAward); return(View(viewName, arpsAward)); }
public static string GetViewName(ArpsAward arpsAward) { var viewName = string.Empty; var dictionary = new Dictionary <string, Object>(); dictionary.Add("ArpsAward", arpsAward); var wfApplication = new WorkflowApplication(new ArpsWF(), dictionary); var idleEvent = new AutoResetEvent(false); wfApplication.Idle += eventArgs => idleEvent.Set(); var syncEvent = new AutoResetEvent(false); wfApplication.Completed += delegate(WorkflowApplicationCompletedEventArgs args) { if (args.CompletionState == ActivityInstanceState.Closed) { try { // Accessing the output arguments dictionary // might throw a KeyNotFoundException or // InvalidCastException viewName = arpsAward.ViewName; } catch (Exception ex) { throw; } finally { // Must be sure to unblock the main thread syncEvent.Set(); } } }; try { wfApplication.Run(); } catch (Exception) { throw; } syncEvent.WaitOne(); SessionHelper.ArpsAward = arpsAward; return(viewName); }
public ActionResult Post(ArpsAward arpsAward, string button) { var arpsAwardFromSession = SessionHelper.ArpsAward; if (!IsDivisionDirectorPhase(arpsAwardFromSession)) { return(new HttpUnauthorizedResult()); } SetAwardPhase(arpsAward, button); SessionHelper.ArpsAward = arpsAward; return(RedirectToAction("Done", arpsAward)); }
public ActionResult Post(ArpsAward arpsAward) { var arpsAwardFromSession = SessionHelper.ArpsAward; if (arpsAwardFromSession.Phase != AwardPhase.Initiator) { return(new HttpUnauthorizedResult()); } arpsAward = arpsAward.RunRuleSet <ArpsAward>(new InitiatorRuleSet()); SessionHelper.ArpsAward = arpsAward; return(RedirectToAction(arpsAward.ViewName, arpsAward)); }
public ActionResult Post(ArpsAward arpsAward, string button) { var arpsAwardFromSession = SessionHelper.ArpsAward; if (arpsAwardFromSession == null || arpsAwardFromSession.Phase != DemoArps_Common.AwardPhase.ServicingAo) { throw new Exception(); } arpsAward.Phase = arpsAwardFromSession.Phase; arpsAward.UserSelection = button; var viewName = WorkflowHelper.GetViewName(arpsAward); return(View(viewName, arpsAward)); }
public ActionResult Post(ArpsAward arpsAward, string button) { arpsAward.Phase = SessionHelper.ArpsAward.Phase; if (arpsAward.Phase != AwardPhase.DivisionDirector) { return(new HttpUnauthorizedResult()); } arpsAward.UserSelection = button; arpsAward = arpsAward.RunRuleSet <ArpsAward>(new DivisionDirectorRuleSet()); SessionHelper.ArpsAward = arpsAward; return(RedirectToAction(arpsAward.ViewName, arpsAward)); }
public ActionResult Post(ArpsAward arpsAward) { var arpsAwardFromSession = SessionHelper.ArpsAward; if (arpsAwardFromSession.Phase != AwardPhase.Initiator) { return(new HttpUnauthorizedResult()); } arpsAward.Phase = (arpsAward.InitiatorSso == arpsAward.NominatorSso) ? AwardPhase.ServicingAo : AwardPhase.Nominator; SessionHelper.ArpsAward = arpsAward; return(RedirectToAction("Done", arpsAward)); }
public ActionResult Post(ArpsAward arpsAward, string button) { arpsAward.Phase = SessionHelper.ArpsAward.Phase; if (arpsAward.Phase != AwardPhase.ServicingAo) { return(new HttpUnauthorizedResult()); } arpsAward.UserSelection = button; arpsAward.ApplyRule <ArpsAward>(new ServicingAoSelectionRule()); SessionHelper.ArpsAward = arpsAward; return(RedirectToAction(arpsAward.ViewName, arpsAward)); }
public ActionResult Post(ArpsAward arpsAward, string button) { var arpsAwardFromSession = SessionHelper.ArpsAward; if (!IsServicingAoPhase(arpsAwardFromSession)) { return(new HttpUnauthorizedResult()); } arpsAward.Phase = button == "Approve" ? AwardPhase.DivisionDirector : button == "Return" ? AwardPhase.Initiator : AwardPhase.End; SessionHelper.ArpsAward = arpsAward; return(RedirectToAction("Done", arpsAward)); }
private static bool IsServicingAoPhase(ArpsAward arpsAward) { return(arpsAward != null && arpsAward.Phase == AwardPhase.ServicingAo); }
private static bool IsNominatorPhase(ArpsAward arpsAward) { return(arpsAward != null && arpsAward.Phase == AwardPhase.Nominator); }
private static bool IsDdsmPhase(ArpsAward arpsAward) { return(arpsAward != null && arpsAward.Phase == AwardPhase.Ddsm); }
private static bool IsDivisionDirectorPhase(ArpsAward arpsAward) { return(arpsAward != null && arpsAward.Phase == AwardPhase.DivisionDirector); }
private string GetAwardPhaseForApproval(ArpsAward arpsAward, string button) { return(arpsAward.CashAmount > 5000.0m ? AwardPhase.Ddsm : AwardPhase.Ohr); }
public ActionResult Done(ArpsAward arpsAward) { return(View(@"~\Views\Shared\Done.cshtml", arpsAward)); }
private static bool IsInitiatorPhase(ArpsAward arpsAward) { return(string.IsNullOrWhiteSpace(arpsAward.Phase) || arpsAward.Phase == AwardPhase.Initiator); }