Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
        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
            });
        }