/// <summary> /// Handles the response initialization to deletion of false and evokes any spawnelements. /// </summary> /// <param name="e">PlanElementEventArg</param> /// <param name="s">Step</param> public void SetCompletedStepResponses(PlanElementEventArg e, Step s) { try { s.Responses.ForEach(r => { r.Delete = false; if ((s.StepTypeId == 4) || (s.StepTypeId == 1)) { if (s.SelectedResponseId.Equals(r.Id)) { HandleResponseSpawnElements(s, r, e, e.UserId); } } else { HandleResponseSpawnElements(s, r, e, e.UserId); } }); } catch (Exception ex) { throw new Exception("AD:StepPlanProcessor:StepCompletedStepResponse()::" + ex.Message, ex.InnerException); } }
public override void PlanElementHandler(object sender, PlanElementEventArg e) { try { if (e.PlanElement.GetType() == typeof(Program)) { if (e.Program.Completed) { e.Program.Completed = true; e.Program.DateCompleted = System.DateTime.UtcNow; e.Program.CompletedBy = e.UserId; //e.Program.GraduatedFlag = true; OnProcessIdEvent(e.Program); } } else if (Successor != null) { Successor.PlanElementHandler(this, e); } } catch (Exception ex) { throw new Exception("AD:ProgramPlanProcessor:PlanElementHandler()::" + ex.Message, ex.InnerException); } }
public override void PlanElementHandler(object sender, PlanElementEventArg e) { try { if (e.PlanElement.GetType() == typeof(Step)) { ProgramAttributes.PlanElementId = e.Program.Id; var s = (Step)e.PlanElement; if (e.Action.Completed) { if (s.Completed) { // see if responses have spawn elements if (s.Responses != null) { SetCompletedStepResponses(e, s); } if (s.SpawnElement != null) { PEUtils.SpawnElementsInList(s.SpawnElement, e.Program, e.UserId, ProgramAttributes); s.SpawnElement.ForEach( rse => { if (rse.ElementType > 100) { HandlePlanElementActions(e, e.UserId, rse); } }); } } else { if (s.Responses != null) { s.Responses.ForEach(r => { r.Delete = true; }); } } // save program properties PEUtils.SaveReportingAttributes(ProgramAttributes, e.DomainRequest); // raise process event to register the id OnProcessIdEvent(e.Program); } } else if (Successor != null) { Successor.PlanElementHandler(this, e); } } catch (Exception ex) { throw new Exception("AD:StepPlanProcessor:PlanElementHandler()::" + ex.Message, ex.InnerException); } }
public virtual void OnPlanElement(PlanElementEventArg e) { try { if (PlanElement != null) { PlanElement(this, e); } } catch (Exception ex) { throw new Exception("AD:PlanProcessor:OnPlanElement()::" + ex.Message, ex.InnerException); } }
public override void PlanElementHandler(object sender, PlanElementEventArg e) { try { if (e.PlanElement.GetType() == typeof(Module)) { Module module = e.PlanElement as Module; //PlanElementUtil.SetProgramInformation(_programAttributes, e.Program); ProgramAttributes.PlanElementId = e.Program.Id; if (module.Actions != null) { module.Completed = PEUtils.GetCompletionStatus(module.Actions); if (module.Completed) { module.CompletedBy = e.UserId; module.StateUpdatedOn = DateTime.UtcNow; module.ElementState = (int)ElementState.Completed; module.DateCompleted = System.DateTime.UtcNow; // look at spawnelement and trigger enabled state. if (module.SpawnElement != null) { PEUtils.SpawnElementsInList(module.SpawnElement, e.Program, e.UserId, ProgramAttributes); module.SpawnElement.ForEach( rse => { if (rse.ElementType > 100) { HandlePlanElementActions(e, e.UserId, rse); } }); } // save any program attribute changes PEUtils.SaveReportingAttributes(ProgramAttributes, e.DomainRequest); OnProcessIdEvent(module); } } } else if (Successor != null) { Successor.PlanElementHandler(this, e); } } catch (Exception ex) { throw new Exception("AD:ModulePlanProcessor:PlanElementHandler()::" + ex.Message, ex.InnerException); } }
public void HandlePlanElementActivation(PlanElementEventArg e, SpawnElement rse) { try { PlanElement pe = PEUtils.ActivatePlanElement(rse.ElementId, e.Program); if (pe != null) { OnProcessIdEvent(pe); } } catch (Exception ex) { throw new Exception("AD:StepPlanProcessor:HandlePlanElementActivation()::" + ex.Message, ex.InnerException); } }
public void HandleResponseSpawnElements(Step s, Response r, PlanElementEventArg e, string userId) { try { if (r.SpawnElement != null) { if (PEUtils.ResponseSpawnAllowed(s, r)) { r.SpawnElement.ForEach(rse => HandlePlanElementActions(e, userId, rse)); } } } catch (Exception ex) { throw new Exception("AD:StepPlanProcessor:HandleResponseSpawnElements()::" + ex.Message, ex.InnerException); } }
public override void PlanElementHandler(object sender, PlanElementEventArg e) { try { if (e.PlanElement.GetType() == typeof(Actions)) { Actions action = e.PlanElement as Actions; //PlanElementUtil.SetProgramInformation(_programAttributes, e.Program); _programAttributes.PlanElementId = e.Program.Id; if (action != null && action.Completed) { action.CompletedBy = e.UserId; action.ElementState = (int)ElementState.Completed; action.DateCompleted = DateTime.UtcNow; action.StateUpdatedOn = DateTime.UtcNow; PeUtils.DisableCompleteButtonForAction(action.Steps); //2) look at spawnelement and trigger enabled state. if (action.SpawnElement != null) { PEUtils.SpawnElementsInList(action.SpawnElement, e.Program, e.UserId, _programAttributes); action.SpawnElement.ForEach( rse => { if (rse.ElementType > 100) { HandlePlanElementActions(e, e.UserId, rse); } }); } // save any program attribute changes PeUtils.SaveReportingAttributes(_programAttributes, e.DomainRequest); OnProcessIdEvent(action); } } else if (Successor != null) { Successor.PlanElementHandler(this, e); } } catch (Exception ex) { throw new Exception("AD:ActionPlanProcessor:PlanElementHandler()::" + ex.Message, ex.InnerException); } }
public void HandlePlanElementActions(PlanElementEventArg e, string userId, SpawnElement rse) { // handles the response spawnelements if (rse.ElementType < 10) { HandlePlanElementActivation(e, rse); } else if (rse.ElementType > 100) { //HandlePatientProblemRegistration(e, userId, rse); var type = ElementActivationStrategy.Run(e, rse, userId, ProgramAttributes); if (!string.IsNullOrEmpty(type.ToString())) { OnSpawnElementEvent(type); } } else { PEUtils.SetProgramAttributes(rse, e.Program, e.UserId, ProgramAttributes); } }
public abstract void PlanElementHandler(object sender, PlanElementEventArg e);