コード例 #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (TransactionId.Length != 0)
            {
                hash ^= TransactionId.GetHashCode();
            }
            if (CommandId.Length != 0)
            {
                hash ^= CommandId.GetHashCode();
            }
            if (WorkflowId.Length != 0)
            {
                hash ^= WorkflowId.GetHashCode();
            }
            if (effectiveAt_ != null)
            {
                hash ^= EffectiveAt.GetHashCode();
            }
            hash ^= events_.GetHashCode();
            if (Offset.Length != 0)
            {
                hash ^= Offset.GetHashCode();
            }
            if (traceContext_ != null)
            {
                hash ^= TraceContext.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #2
0
        /// <summary>
        ///     Submits a membership request to the specified group's
        ///     moderation workflow for approval.
        /// </summary>
        /// <param name="member">The member information for the membership request</param>
        public void AddAModeratedMember(CommunityMember member)
        {
            // Define a unique reference representing the entity
            // under moderation. Note that this entity may be
            // transient or may not yet have been assigned a
            // unique identifier. Defining an item reference allows
            // you to bridge this gap.

            // For example: "members:/{group-id}/{user-reference}"

            var targetReference = CreateUri(member.GroupId, member.User);

            // Retrieve the workflow supporting moderation of
            // membership for the group to which the user is
            // being added.

            var moderationWorkflow = GetWorkflowFor(member.GroupId);

            // The workflow defines the intial (or 'start') state
            // for moderation.

            var initialState = moderationWorkflow.InitialState;

            // Create a new workflow item...

            var workflowItem = new WorkflowItem(
                WorkflowId.Create(moderationWorkflow.Id), // ...under the group's moderation workflow
                new WorkflowState(initialState),          // ...in the workflow's initial state
                Reference.Create(targetReference)         // ...identified with this reference
                );

            var memberRequest = _memberAdapter.Adapt(member);

            try
            {
                _workflowItemService.Add(workflowItem, memberRequest);
            }
            catch (SocialAuthenticationException ex)
            {
                throw new SocialRepositoryException("The application failed to authenticate with Episerver Social.",
                                                    ex);
            }
            catch (MaximumDataSizeExceededException ex)
            {
                throw new SocialRepositoryException(
                          "The application request was deemed too large for Episerver Social.", ex);
            }
            catch (SocialCommunicationException ex)
            {
                throw new SocialRepositoryException("The application failed to communicate with Episerver Social.", ex);
            }
            catch (SocialException ex)
            {
                throw new SocialRepositoryException("Episerver Social failed to process the application request.", ex);
            }
        }
コード例 #3
0
ファイル: StartWorkflow.cs プロジェクト: pgava/FlowTasks
        /// <summary>
        /// Activity entry point
        /// </summary>
        /// <param name="context">Activity context</param>
        protected override void Execute(NativeActivityContext context)
        {
            Logger.Debug("StartWorkflow -> Start");

            WorkflowId.Set(context, context.WorkflowInstanceId.ToString());

            context.ScheduleActivity(_startWorkflowCatch, OnWorkflowCompleteCallback);

            Logger.Debug("StartWorkflow -> End");
        }
コード例 #4
0
        protected override void Execute(NativeActivityContext context)
        {
            Logger.Debug("InvokeChildWorkflow -> Start");

            var id = InvokeWorkflow(context.WorkflowInstanceId, WorkflowCode.Get(context), Domain.Get(context), Properties.Get(context), Async.Get(context));

            NewWorkflowId.Set(context, id);
            WorkflowId.Set(context, id);

            if (!Async.Get(context))
            {
                context.ScheduleActivity(_sync, OnChildWorkflowCompleteCallback);
            }

            Logger.Debug("InvokeChildWorkflow -> End");
        }
コード例 #5
0
 private void btnNext_Click(object sender, System.EventArgs e)
 {
     if (((WFIEditarControlWorkflow)ctlWizardStep).Update())
     {
         WorkflowId = ((WFIEditarControlWorkflow)ctlWizardStep).WorkflowId;
         StepIndex++;
         if (StepIndex == WizardSteps.Count)
         {
             Context.Items.Add("intWorkflowId", WorkflowId);
             Context.Items.Add("strNombre", lblNombre.Text);
             //Server.Transfer("ESWFP001B.aspx", true);
             Response.Redirect(EditUrl("intWorkflowId", WorkflowId.ToString()));
         }
         else
             LoadWizardStep();
     }
 }
コード例 #6
0
        /// <summary>
        /// OnChildWorkflowComplete Callback
        /// </summary>
        /// <remarks>
        /// Runs after Child workflow complete. Only for synchronous
        /// </remarks>
        /// <param name="context">NativeActivityContext</param>
        /// <param name="completedInstance">ActivityInstance</param>
        private void OnChildWorkflowCompleteCallback(NativeActivityContext context, ActivityInstance completedInstance)
        {
            Logger.Debug("OnChildWorkflowCompleteCallback -> Start");

            GetWorkflowResultResponse res;

            using (var proxy = new Proxy.FlowTasksService())
            {
                res = proxy.GetWorkflowResult(new GetWorkflowResultRequest
                {
                    WorkflowId = WorkflowId.Get(context)
                });
            }

            WorkflowResult.Set(context, res.WorkflowResultInfo.Result);

            Logger.Debug("OnChildWorkflowCompleteCallback -> End");
        }
コード例 #7
0
ファイル: Transition.cs プロジェクト: zhh007/objectflow
 public override int GetHashCode()
 {
     unchecked
     {
         int multiplier = 31;
         int ret        = 0;
         if (WorkflowId != null)
         {
             ret = (ret + WorkflowId.GetHashCode()) * multiplier;
         }
         if (From != null)
         {
             ret = (ret + From.GetHashCode()) * multiplier;
         }
         if (To != null)
         {
             ret = (ret + To.GetHashCode()) * multiplier;
         }
         return(ret);
     }
 }
コード例 #8
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Offset.Length != 0)
            {
                hash ^= Offset.GetHashCode();
            }
            if (WorkflowId.Length != 0)
            {
                hash ^= WorkflowId.GetHashCode();
            }
            hash ^= activeContracts_.GetHashCode();
            if (traceContext_ != null)
            {
                hash ^= TraceContext.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
コード例 #9
0
        /// <summary>
        ///     Takes action on the specified workflow item, representing a
        ///     membership request.
        /// </summary>
        /// <param name="workflowId">The id of the workflow </param>
        /// <param name="action">The moderation action to be taken</param>
        /// <param name="userId">The unique id of the user under moderation.</param>
        /// <param name="communityId">The unique id of the community to which membership has been requested.</param>
        public void Moderate(string workflowId, string action, string userId, string communityId)
        {
            var membershipRequest   = GetMembershipRequest(userId, communityId);
            var populatedWorkflowId = WorkflowId.Create(workflowId);

            var requestReference = Reference.Create(CreateUri(membershipRequest.Group, membershipRequest.User));

            try
            {
                var transitionToken = _workflowService.BeginTransitionSession(populatedWorkflowId, requestReference);
                try
                {
                    // Retrieve the moderation workflow associated with
                    // the item to be acted upon.

                    var workflow = _workflowService.Get(populatedWorkflowId);

                    // Leverage the workflow to determine what the
                    // resulting state of the item will be upon taking
                    // the specified action.

                    //retrieve the current state of the workflow item once the begintransitionsession begins.
                    var filter = new WorkflowItemFilter {
                        Target = requestReference
                    };
                    var criteria = new Criteria <WorkflowItemFilter> {
                        Filter = filter
                    };
                    var workflowItem = _workflowItemService.Get(criteria).Results.Last();

                    // Example: Current State: "Pending", Action: "Approve" => Transitioned State: "Approved"
                    var transitionedState = workflow.Transition(workflowItem.State, new WorkflowAction(action));

                    var subsequentWorkflowItem = new WorkflowItem(
                        workflow.Id,
                        transitionedState,
                        requestReference
                        );

                    _workflowItemService.Add(subsequentWorkflowItem, membershipRequest, transitionToken);

                    // Perform any application logic given the item's
                    // new state.

                    if (IsApproved(subsequentWorkflowItem.State))
                    {
                        _memberRepository.Add(_memberAdapter.Adapt(membershipRequest));
                    }
                }
                finally
                {
                    _workflowService.EndTransitionSession(transitionToken);
                }
            }
            catch (SocialAuthenticationException ex)
            {
                throw new SocialRepositoryException("The application failed to authenticate with Episerver Social.",
                                                    ex);
            }
            catch (MaximumDataSizeExceededException ex)
            {
                throw new SocialRepositoryException(
                          "The application request was deemed too large for Episerver Social.", ex);
            }
            catch (SocialCommunicationException ex)
            {
                throw new SocialRepositoryException("The application failed to communicate with Episerver Social.", ex);
            }
            catch (SocialException ex)
            {
                throw new SocialRepositoryException("Episerver Social failed to process the application request.", ex);
            }
        }
コード例 #10
0
        /*
         * private void SaveToFile(object sender, System.EventArgs e)
         * {
         *  saveFileDialog1.FileName = $"{Model.Workflow.Name}_{Model.Workflow.Version}.json";
         *  if(saveFileDialog1.ShowDialog(this) == DialogResult.OK)
         *      model.SaveToFile(saveFileDialog1.FileName);
         * }
         *
         * private void OpenFromFile(object sender, System.EventArgs e)
         * {
         *  if(openFileDialog1.ShowDialog(this) == DialogResult.OK)
         *  {
         *      model = new Model(openFileDialog1.FileName);
         *      LoadModel();
         *  }
         * }
         */

        private void OpenWorkflow(WorkflowId wf)
        {
            model = new Model(wf.Name, wf.Version);
            LoadModel();
        }
コード例 #11
0
 public override int GetHashCode()
 {
     return(WorkflowId.GetHashCode());
 }
コード例 #12
0
        public override bool Equals(object other)
        {
            var otherW = other as IndexWorkflowRecord;

            return(otherW != null?WorkflowId.Equals(otherW.WorkflowId) : false);
        }
コード例 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string selectedTab = QueryHelper.GetString("showtab", null);

        if (!string.IsNullOrEmpty(selectedTab))
        {
            switch (selectedTab.ToLowerCSafe())
            {
            case "scopes":
                contentTargetUrl = "Workflow_Scopes.aspx";
                break;

            case "steps":
                contentTargetUrl = "Workflow_Steps.aspx";
                break;

            default:
                contentTargetUrl = "Workflow_General.aspx";
                break;
            }

            headerTargetUrl = URLHelper.AddParameterToUrl("Workflow_Header.aspx", "showtab", selectedTab);
        }
        else
        {
            contentTargetUrl = "Workflow_General.aspx";
            headerTargetUrl  = "Workflow_Header.aspx";
        }

        bool saved     = QueryHelper.GetBoolean("saved", false);
        bool converted = QueryHelper.GetBoolean("converted", false);

        if (converted)
        {
            contentTargetUrl = URLHelper.AddParameterToUrl(contentTargetUrl, "converted", "1");
        }
        else if (saved)
        {
            contentTargetUrl = URLHelper.AddParameterToUrl(contentTargetUrl, "saved", "1");
        }

        if (WorkflowId != 0)
        {
            contentTargetUrl = URLHelper.AddParameterToUrl(contentTargetUrl, "workflowid", WorkflowId.ToString());
            headerTargetUrl  = URLHelper.AddParameterToUrl(headerTargetUrl, "workflowid", WorkflowId.ToString());
        }
    }