Пример #1
0
        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.

        protected override void Execute(NativeActivityContext context)
        {
            ActivityResult result = (ActivityResult)context.GetValue <Object>(stepInfo);

            var step = (JQ.QA.Model.WF_StepInfo)result.Data;

            step.State       = 1;
            step.IsProcessed = true;
            IWF_StepInfoService stepInfoService = new WF_StepInfoService();

            stepInfoService.EditEntity(step);

            //Create next step
            JQ.QA.Model.WF_StepInfo nextStep = new JQ.QA.Model.WF_StepInfo()
            {
                Comment = string.Empty,
                FlowTo  = -1,

                State         = (short)WFEnum.WFStateEnum.IsComplete,
                InstanceId    = Guid.Empty,
                IsStartStep   = false,
                ParentStepID  = step.ID,
                ProcessBy     = (int)step.FlowTo,
                ProcessTime   = DateTime.Now,
                WF_InstanceID = step.WF_InstanceID,
                SubTime       = DateTime.Now,
                StepResult    = (short)WFEnum.WFEnum.IsPass
            };

            if (result.Result == (short)WFEnum.WFEnum.IsPass)
            {
                nextStep.StepName       = "To Finance Dep, end of workflow.";
                nextStep.IsEndStep      = true;
                nextStep.IsProcessed    = true;
                step.WF_Instance.Status = (short)WFEnum.WFStateEnum.IsComplete;
                stepInfoService.AddEntity(nextStep);
                stepInfoService.EditEntity(step);

                result.Result = (short)WFEnum.WFEnum.IsPass;
                result.NextStepBookMarkName = nextStep.StepName;
            }
            else
            {
                step.IsProcessed            = true;
                result.Data                 = step;
                result.Result               = (short)WFEnum.WFEnum.IsReject;
                result.NextStepBookMarkName = "";
            }

            context.SetValue(NextStepName, result.NextStepBookMarkName);
            context.SetValue(StepNodeResult, result);
        }
Пример #2
0
        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void Execute(NativeActivityContext context)
        {
            //Get the result of the last step and update its state.
            ActivityResult result = (ActivityResult)context.GetValue <object>(StepInfo);
            var            step   = (JQ.QA.Model.WF_StepInfo)result.Data;

            step.State       = 1; //Set the state as an active workflow.
            step.IsProcessed = true;
            step.SubTime     = DateTime.Now;
            IWF_StepInfoService stepService = new WF_StepInfoService();

            stepService.EditEntity(step);

            //Create next step
            JQ.QA.Model.WF_StepInfo nextStep = new JQ.QA.Model.WF_StepInfo()
            {
                Comment       = string.Empty,
                FlowTo        = 0,
                InstanceId    = Guid.Empty,
                IsStartStep   = false,
                ParentStepID  = step.ID,
                ProcessBy     = (int)step.FlowTo,
                State         = 0,
                SubTime       = DateTime.Now,
                IsEndStep     = false,
                ProcessTime   = DateTime.Now,
                WF_InstanceID = step.WF_InstanceID
            };

            if (result.Result == (short)WFEnum.WFEnum.IsPass)
            {
                nextStep.StepName    = "End of the workflow";
                nextStep.IsEndStep   = true;
                nextStep.IsProcessed = true;

                //Set the instance status as finished.
                step.WF_Instance.Status = 1;
                stepService.EditEntity(step);
            }
            else
            {
                nextStep.StepName    = "Initiate Application";
                nextStep.IsStartStep = true;
                nextStep.IsProcessed = false;
            }

            result.Data = nextStep;
            result.NextStepBookMarkName = nextStep.StepName;
        }