public static SessionBO GetInstance() { if (Instance == null) { Instance = new SessionBO(); } return(Instance); }
private ICollection <ProcedureParameterTO> FetchParameters(ICollection <ProcedureParameterTO> parameters) { foreach (var item in parameters) { if (item.Direction == ProcedureParameterDirection.In) { var sessionTO = SessionBO.GetInstance().GetVariable(item.Name); if (sessionTO != null) { item.Value = sessionTO.Value; } else if (item.Name.Equals("DATA")) { item.Value = GetCurrent().Data.Value; } } } return(parameters); }
private ResultTO GoNextStep(ResultTO result) { var currentStep = StepBO.GetCurrent(); if (result.Result == Result.Pass) { var secondStep = GetSecondStep(currentStep); if (secondStep == null) { throw new ApplicationException("Second Step nao encontrado"); } StepBO.SetCurrent(secondStep); } else if (currentStep.Fork > 0) { var stepData = currentStep.Data.Value; var forkStep = GetForkStep(currentStep); if (forkStep == null) { throw new ApplicationException("Fork Step nao encontrado"); } StepBO.SetCurrent(forkStep); } else if (!string.IsNullOrEmpty(currentStep.Special) && currentStep.Special != "N/A" && result.Message.Contains("JUMP=")) { var jumpStep = GetJumpStep(currentStep, result.Message); if (jumpStep == null) { throw new ApplicationException("Jump Step nao encontrado"); } StepBO.SetCurrent(jumpStep); } if (result.Result == Result.Pass) { if (currentStep.Last) { SessionBO.GetInstance().ClearUntilLastInput(); } else if (currentStep.Rule == Rule.KeepInMemory || currentStep.Rule == Rule.UntilLastInput) { SessionBO.GetInstance().AddVariable(new SessionTO { Name = currentStep.Data.Name, Value = currentStep.Data.Value, Rule = currentStep.Rule }); } } return(new ResultTO { Result = Result.Pass, Message = StepBO.GetCurrent().Data.Prompt }); }