// If your activity returns a value, derive from CodeActivity<TResult> // and return the value from the Execute method. protected override void Execute(CodeActivityContext context) { // Obtain the runtime value of the Text input argument //string text = context.GetValue(this.Text); #region Initiate an application ////Put the info of the step of initiating an application into step table WF_StepInfo initStep = new WF_StepInfo() { Title = string.Empty, Comment = string.Empty, FlowTo = context.GetValue <int>(FlowTo), InstanceId = Guid.Empty, IsEndStep = false, IsStartStep = true, ParentStepID = -1, ProcessBy = context.GetValue <int>(ProcessBy), ProcessTime = DateTime.Now, StepName = "Initiate Application", SubTime = DateTime.Now, IsProcessed = true, WF_InstanceID = context.GetValue <int>(WF_InstanceID) }; IWF_StepInfoService stepService = new WF_StepInfoService(); stepService.AddEntity(initStep); #endregion WF_StepInfo pmStep = new WF_StepInfo() { Comment = string.Empty, FlowTo = 0, InstanceId = Guid.Empty, IsEndStep = false, IsStartStep = true, ParentStepID = initStep.ID, ProcessBy = (int)initStep.FlowTo, ProcessTime = DateTime.Now, WF_InstanceID = initStep.WF_InstanceID, SubTime = DateTime.Now, StepName = "PM Validation", IsProcessed = false, StepResult = (short)WFEnum.WFEnum.IsContinue }; stepService.AddEntity(pmStep); context.SetValue(NextStepBookMarkName, pmStep.StepName); }
// 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); }