public WorkflowStep CreateStep(int workflowStepId)
        {
            var workflowStep = WorkflowSteps.First(x => x.WorkflowStepId == workflowStepId);
            var activity     = Activities.First(x => x.ActivityId == workflowStep.ActivityId);

            var step = new WorkflowStep
            {
                WorkflowStepId   = workflowStep.WorkflowStepId,
                ActivityId       = workflowStep.ActivityId,
                ActivityTypeId   = activity.ActivityTypeId,
                ExecutionTimeout = activity.ExecutionTimeout,
                HandlerType      = activity.HandlerType,
                Priority         = activity.Priority
            };

            // Add properties to step.
            var stepProperties = WorkflowStepProperties.Where(x => x.WorkflowStepId == workflowStep.WorkflowStepId).ToList();

            if (stepProperties.Count > 0)
            {
                step.StepProperties = new List <StepProperty>();
                foreach (var p in stepProperties)
                {
                    step.StepProperties.Add((StepProperty)Enum.Parse(typeof(StepProperty), p.StepPropertyId.ToString(CultureInfo.InvariantCulture)));
                }
            }

            return(step);
        }
        protected override void Execute(NativeActivityContext context)
        {
            // RECORD WORKFLOW STEPS

            Workflows.Activities.CommonFunctions.WorkflowStepsAdd(

                WorkflowManager.Get(context).Application,

                1,

                WorkQueueItemId.Get(context),

                WorkflowSteps.Get(context),

                "User Interaction Request: " + Server.CommonFunctions.EnumerationToString(Request.Get(context).UserInteractionType)

                );

            // SAVE WORKFLOW STEPS

            WorkflowManager.Get(context).Application.WorkQueueItemWorkflowStepsSave(WorkQueueItemId.Get(context), WorkflowSteps.Get(context));


            // SET USER INTERACTION REQUEST IN THE WORKFLOW MANAGER

            WorkflowManager.Get(context).UserInteractionRequest = Request.Get(context);


            // CREATE A BOOKMARK SET TO THE WORKFLOW INSTANCE ID TO MAKE IT UNIQUE

            context.CreateBookmark(context.WorkflowInstanceId.ToString(), new BookmarkCallback(this.ReceiveResponse));

            return;
        }
示例#3
0
        public void ResumeWorkflow(NativeActivityContext context, Bookmark bookmark, Object workflowManager)
        {
            // REMOVE THE BOOKMARK SO THAT IT CAN BE USED AGAIN

            context.RemoveBookmark(context.WorkflowInstanceId.ToString());


            // RESET WORKFLOW MANAGER INSTANCE

            WorkflowManager.Set(context, workflowManager);

            WorkflowManager.Get(context).WorkflowStatus = WorkflowStatus.Resumed;


            // RECORD WORKFLOW STEPS

            Workflows.Activities.CommonFunctions.WorkflowStepsAdd(

                WorkflowManager.Get(context).Application,

                1,

                WorkQueueItem.Get(context).Id,

                WorkflowSteps.Get(context),

                "Resume Workflow"

                );

            return;
        }
示例#4
0
        public override InteractiveWorkflowManager CreateInteractiveWorkflowManager(IRegionManager regionManager, ICurrentSettingsProvider currentSettingsProvider)
        {
            base.CreateInteractiveWorkflowManager(regionManager, currentSettingsProvider);
            WorkflowSteps.Add(new ProfessionalHintStep(_professionalHintHelper));

            return(new InteractiveWorkflowManager(_workflowNavigationHelper, regionManager, WorkflowSteps));
        }
示例#5
0
        protected override void Execute(CodeActivityContext context)
        {
            // TODO: VALIDATE ENTITY OR THROW EXCEPTION


            Workflows.UserInteractions.Request.RequireFormRequest request = new UserInteractions.Request.RequireFormRequest();

            request.EntityType = Entity.Get(context).EntityType;

            request.EntityObjectId = WorkflowManager.Get(context).Application.EntityObjectIdGet(Entity.Get(context));


            if (Form.Get(context) == null)
            {
                // LOAD FORM BY NAME (NO FORM WAS PASSED FROM PARENT ACTIVITY)

                request.Form = new Core.Forms.Form(WorkflowManager.Get(context).Application, FormName.Get(context));

                if (request.Form == null)
                {
                    CommonFunctions.RaiseActivityException(  // THROW EXCEPTION

                        WorkflowManager.Get(context).Application,

                        1,

                        WorkQueueItemId.Get(context),

                        WorkflowSteps.Get(context),

                        "Unable to load form for " + FormName.Get(context) + "."

                        );
                }

                request.Form.EntityType = request.EntityType;

                request.Form.EntityObjectId = request.EntityObjectId;
            }

            else
            {
                request.Form = Form.Get(context);
            }                                           // USE FORM PASSED IN FROM PARENT ACTIVITY

            request.Form.FormType = Core.Forms.Enumerations.FormType.Instance;


            request.Message = "Form Required: " + request.Form.Name + " (Last Modified: " + request.Form.ModifiedAccountInfo.ActionDate.ToString("MM/dd/yyyy") + ")";

            request.AllowSaveAsDraft = AllowSaveAsDraft.Get(context);

            request.AllowCancel = AllowCancel.Get(context);


            UserInteractionRequest.Set(context, request);

            return;
        }
示例#6
0
        private void RaiseActivityException(String exceptionMessage)
        {
            String caller = (new System.Diagnostics.StackFrame(1)).GetMethod().Name;

            WorkflowSteps.Add(new Mercury.Server.Workflows.WorkflowStep(Application, "Exception [" + caller + "]", exceptionMessage));

            throw new ApplicationException(this.GetType().ToString() + ": " + exceptionMessage);
        }
示例#7
0
        internal void AbortDeletion()
        {
            this.CurrentProcessStep = WorkflowSteps.Idle;

            this.deletionWorker.Dispose();
            this.deletionWorker = null;

            this.OnAborted?.Invoke(this, new EventArgs());
        }
示例#8
0
        public void StartDeleteProcess()
        {
            this.CurrentProcessStep = WorkflowSteps.DeleteProcessRunning;

            this.deletionWorker      = new DeletionWorker();
            this.deletionWorker.Data = this.Data;

            this.deletionWorker.ProgressChanged    += new ProgressChangedEventHandler(deletionWorker_ProgressChanged);
            this.deletionWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(deletionWorker_RunWorkerCompleted);

            this.deletionWorker.RunWorkerAsync();
        }
示例#9
0
        public void StartDeleteProcess()
        {
            this.CurrentProcessStep = WorkflowSteps.DeleteProcessRunning;

            this.deletionWorker = new DeletionWorker {
                Data = this.Data
            };

            this.deletionWorker.ProgressChanged    += this.deletionWorker_ProgressChanged;
            this.deletionWorker.RunWorkerCompleted += this.deletionWorker_RunWorkerCompleted;

            this.deletionWorker.RunWorkerAsync();
        }
        private void WorkflowStepsAdd(String stepDescription)
        {
            if (WorkflowSteps != null)
            {
                String stepName = (new System.Diagnostics.StackFrame(1)).GetMethod().Name;

                Server.Workflows.WorkflowStep workflowStep = new Mercury.Server.Workflows.WorkflowStep(Application, stepName, stepDescription);

                WorkflowSteps.Add(workflowStep);
            }

            return;
        }
        public void ReceiveResponse(NativeActivityContext context, Bookmark bookmark, Object workflowManager)
        {
            // REMOVE THE BOOKMARK SO THAT IT CAN BE USED AGAIN

            context.RemoveBookmark(context.WorkflowInstanceId.ToString());


            // RESET WORKFLOW MANAGER INSTANCE

            WorkflowManager.Set(context, workflowManager);

            Response.Set(context, WorkflowManager.Get(context).UserInteractionResponse);


            // RECORD WORKFLOW STEPS

            if (Response.Get(context) != null)
            {
                Workflows.Activities.CommonFunctions.WorkflowStepsAdd(

                    WorkflowManager.Get(context).Application,

                    1,

                    WorkQueueItemId.Get(context),

                    WorkflowSteps.Get(context),

                    "User Interaction Response: " + Server.CommonFunctions.EnumerationToString(Response.Get(context).UserInteractionType)

                    );
            }

            else
            {
                Workflows.Activities.CommonFunctions.WorkflowStepsAdd(

                    WorkflowManager.Get(context).Application,

                    1,

                    WorkQueueItemId.Get(context),

                    WorkflowSteps.Get(context),

                    "User Interaction Response: Unknown Response"

                    );
            }
            return;
        }
示例#12
0
        void deletionWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.CurrentProcessStep = WorkflowSteps.Idle;

            if (e.Error != null)
            {
                this.showErrorMsg(e.Error.Message);

                this.deletionWorker.Dispose(); this.deletionWorker = null;
            }
            else if (e.Cancelled)
            {
                if (this.deletionWorker.ErrorInfo != null)
                {
                    // A error occurred, process was stopped
                    //
                    // -> Ask user to continue

                    if (OnDeleteError != null)
                    {
                        OnDeleteError(this, this.deletionWorker.ErrorInfo);
                    }
                    else
                    {
                        throw new Exception("Internal error: event handler is missing.");
                    }
                }
                else
                {
                    // The user cancelled the process
                    if (this.OnCancelled != null)
                    {
                        this.OnCancelled(this, new EventArgs());
                    }
                }
            }
            else
            {
                // TODO: Use separate class here?
                int deletedCount   = this.deletionWorker.DeletedCount;
                int failedCount    = this.deletionWorker.FailedCount;
                int protectedCount = this.deletionWorker.ProtectedCount;

                this.deletionWorker.Dispose(); this.deletionWorker = null;

                if (this.OnDeleteProcessFinished != null)
                {
                    this.OnDeleteProcessFinished(this, new DeleteProcessFinishedEventArgs(deletedCount, failedCount, protectedCount));
                }
            }
        }
示例#13
0
        public GettingLoanFlow(WorkflowStep <GettingLoanSteps> initialState, List <IFlowParameter> flowParameters) : base(
                initialState, flowParameters)
        {
            this.Configure(StartStep)
            .OnEntry(() => { })
            .Permit(WorkFlowActions.Next, WorkflowSteps.Single(a => a.Step == GettingLoanSteps.PrimitiveCheck));

            this.Configure(WorkflowSteps.Single(a => a.Step == GettingLoanSteps.PrimitiveCheck))
            .OnEntry(() => { })
            .Permit(WorkFlowActions.Next, WorkflowSteps.Single(a => a.Step == GettingLoanSteps.PreparingDocuments));

            this.Configure(WorkflowSteps.Single(a => a.Step == GettingLoanSteps.PreparingDocuments))
            .OnEntry(() => { })
            .Permit(WorkFlowActions.Next, WorkflowSteps.Single(a => a.Step == GettingLoanSteps.Payment));
        }
示例#14
0
        /// <summary>
        /// Start searching empty folders
        /// </summary>
        public void SearchingForEmptyDirectories()
        {
            this.CurrentProcessStep = WorkflowSteps.StartSearchingForEmptyDirs;

            // Rest folder list
            this.Data.ProtectedFolderList = new Dictionary<string, bool>();

            searchEmptyFoldersWorker = new FindEmptyDirectoryWorker();
            searchEmptyFoldersWorker.Data = this.Data;

            searchEmptyFoldersWorker.ProgressChanged += new ProgressChangedEventHandler(searchEmptyFoldersWorker_ProgressChanged);
            searchEmptyFoldersWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(searchEmptyFoldersWorker_RunWorkerCompleted);

            // Start worker
            searchEmptyFoldersWorker.RunWorkerAsync(this.Data.StartFolder);
        }
示例#15
0
        /// <summary>
        /// Start searching empty folders
        /// </summary>
        public void SearchingForEmptyDirectories()
        {
            this.CurrentProcessStep = WorkflowSteps.StartSearchingForEmptyDirs;

            // Rest folder list
            this.Data.ProtectedFolderList = new Dictionary <string, bool>();

            searchEmptyFoldersWorker      = new FindEmptyDirectoryWorker();
            searchEmptyFoldersWorker.Data = this.Data;

            searchEmptyFoldersWorker.ProgressChanged    += new ProgressChangedEventHandler(searchEmptyFoldersWorker_ProgressChanged);
            searchEmptyFoldersWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(searchEmptyFoldersWorker_RunWorkerCompleted);

            // Start worker
            searchEmptyFoldersWorker.RunWorkerAsync(this.Data.StartFolder);
        }
示例#16
0
        private void DelWorkflowComponentBtn_Click(object sender, EventArgs e)
        {
            //finds + removes the selected step
            List <Guid> ids           = this.ControlIDs;
            int         wfcId         = int.Parse(((Button)sender).CommandArgument.ToString().Split(',')[1]);
            string      id            = ((Button)sender).CommandArgument.ToString().Split(',')[0];
            Guid        guid          = Guid.Parse(id);
            Panel       panelControls = (Panel)WorkflowSteps.FindControl("stepControl" + id);

            WorkflowSteps.Controls.Remove(panelControls);
            ids.Remove(guid);
            this.ControlIDs = ids;

            WorkflowComponentUtil.DeleteWorkflowComponent(wfcId);
            ReloadCurrentPage();
        }
示例#17
0
        /// <summary>
        ///     Start searching empty folders
        /// </summary>
        public void SearchingForEmptyDirectories()
        {
            this.CurrentProcessStep = WorkflowSteps.StartSearchingForEmptyDirs;

            // Rest folder list
            this.Data.ProtectedFolderList = new Dictionary <String, Boolean>();

            this.searchEmptyFoldersWorker = new FindEmptyDirectoryWorker {
                Data = this.Data
            };

            this.searchEmptyFoldersWorker.ProgressChanged    += this.searchEmptyFoldersWorker_ProgressChanged;
            this.searchEmptyFoldersWorker.RunWorkerCompleted += this.searchEmptyFoldersWorker_RunWorkerCompleted;

            // Start worker
            this.searchEmptyFoldersWorker.RunWorkerAsync(this.Data.StartFolder);
        }
示例#18
0
        void searchEmptyFoldersWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.CurrentProcessStep = WorkflowSteps.Idle;

            if (e.Error != null)
            {
                this.searchEmptyFoldersWorker.Dispose(); this.searchEmptyFoldersWorker = null;

                this.showErrorMsg(e.Error.Message);
            }
            else if (e.Cancelled)
            {
                if (this.searchEmptyFoldersWorker.ErrorInfo != null)
                {
                    // A error occurred, process was stopped
                    this.showErrorMsg(this.searchEmptyFoldersWorker.ErrorInfo.ErrorMessage);

                    this.searchEmptyFoldersWorker.Dispose(); this.searchEmptyFoldersWorker = null;

                    if (this.OnAborted != null)
                    {
                        this.OnAborted(this, new EventArgs());
                    }
                }
                else
                {
                    this.searchEmptyFoldersWorker.Dispose(); this.searchEmptyFoldersWorker = null;

                    if (this.OnCancelled != null)
                    {
                        this.OnCancelled(this, new EventArgs());
                    }
                }
            }
            else
            {
                int FolderCount = this.searchEmptyFoldersWorker.FolderCount;

                this.searchEmptyFoldersWorker.Dispose(); this.searchEmptyFoldersWorker = null;

                if (this.OnFinishedScanForEmptyDirs != null)
                {
                    this.OnFinishedScanForEmptyDirs(this, new FinishedScanForEmptyDirsEventArgs(this.Data.EmptyFolderList.Count, FolderCount));
                }
            }
        }
示例#19
0
        private void WorkflowStepsAdd(Server.Workflows.Enumerations.WorkflowStepStatus stepStatus, String stepDescription)
        {
            if (WorkflowSteps != null)
            {
                String stepName = (new System.Diagnostics.StackFrame(1)).GetMethod().Name;

                Server.Workflows.WorkflowStep workflowStep = new Mercury.Server.Workflows.WorkflowStep(Application, stepStatus, stepName, stepDescription);

                WorkflowSteps.Add(workflowStep);

                if (WorkQueueItem.Id != 0)
                {
                    Application.WorkQueueItemWorkflowStepsSave(WorkQueueItem.Id, WorkflowSteps);
                }
            }

            return;
        }
示例#20
0
        protected override void Execute(CodeActivityContext context)
        {
            CommonFunctions.WorkflowStepsAdd(

                Application.Get(context),

                StackDepth.Get(context),

                WorkQueueItemId.Get(context),

                WorkflowSteps.Get(context),

                Status.Get(context),

                Description.Get(context)

                );


            return;
        }
示例#21
0
        void deletionWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.CurrentProcessStep = WorkflowSteps.Idle;

            if (e.Error != null)
            {
                this.showErrorMsg(e.Error.Message);

                this.deletionWorker.Dispose(); this.deletionWorker = null;
            }
            else if (e.Cancelled)
            {
                if (this.deletionWorker.ErrorInfo != null)
                {
                    // A error occurred, process was stopped
                    //
                    // -> Ask user to continue

                    if (OnDeleteError != null)
                        OnDeleteError(this, this.deletionWorker.ErrorInfo);
                    else
                        throw new Exception("Internal error: event handler is missing.");
                }
                else
                {
                    // The user cancelled the process
                    if (this.OnCancelled != null)
                        this.OnCancelled(this, new EventArgs());
                }
            }
            else
            {
                // TODO: Use separate class here?
                int deletedCount = this.deletionWorker.DeletedCount;
                int failedCount = this.deletionWorker.FailedCount;
                int protectedCount = this.deletionWorker.ProtectedCount;

                this.deletionWorker.Dispose(); this.deletionWorker = null;

                if (this.OnDeleteProcessFinished != null)
                    this.OnDeleteProcessFinished(this, new DeleteProcessFinishedEventArgs(deletedCount, failedCount, protectedCount));
            }
        }
示例#22
0
 public WorkflowStepChangedEventArgs(WorkflowSteps NewStep)
 {
     this.NewStep = NewStep;
 }
        protected override void Execute(CodeActivityContext context)
        {
            ActivityCompleted.Set(context, false);

            ActivityCanceled.Set(context, false);


            if (UserInteractionResponse.Get(context).UserInteractionType == UserInteractions.Enumerations.UserInteractionType.RequireForm)
            {
                Workflows.UserInteractions.Response.RequireFormResponse response = (UserInteractions.Response.RequireFormResponse)UserInteractionResponse.Get(context);


                if ((response.Form != null) && (!response.SaveAsDraft) && (!response.Cancel))
                {
                    Form.Set(context, response.Form);

                    Form.Get(context).ResetForm(WorkflowManager.Get(context).Application);

                    FormReceived.Set(context, true);

                    ActivityCompleted.Set(context, true);

                    Activities.CommonFunctions.WorkflowStepsAdd(

                        WorkflowManager.Get(context).Application,

                        1,

                        WorkQueueItemId.Get(context),

                        WorkflowSteps.Get(context),

                        Form.Get(context).Name

                        );
                }

                else if (response.SaveAsDraft)
                {
                    Form.Set(context, response.Form);

                    Form.Get(context).ResetForm(WorkflowManager.Get(context).Application);
                }

                else if (response.Cancel)
                {
                    Activities.CommonFunctions.WorkflowStepsAdd(

                        WorkflowManager.Get(context).Application,

                        1,

                        WorkQueueItemId.Get(context),

                        WorkflowSteps.Get(context),

                        "Form Canceled."

                        );


                    ActivityCompleted.Set(context, true);

                    ActivityCanceled.Set(context, true);
                }

                SaveAsDraft.Set(context, response.SaveAsDraft);
            }
        }
示例#24
0
        protected override void Execute(NativeActivityContext context)
        {
            // RESET APPLICATION REFERENCE ON WORK QUEUE ITEM

            WorkQueueItem.Get(context).Application = WorkflowManager.Get(context).Application;


            // ENSURE THAT THE ITEM IS ASSIGNED TO USER

            WorkQueueItem.Get(context).SelfAssign("Workflow Suspend Work Queue Item", false);


            // ATTEMPT TO SUSPEND THE ITEM

            Success.Set(context, WorkQueueItem.Get(context).Suspend(

                            WorkflowLastStep.Get(context),

                            WorkflowNextStep.Get(context),

                            ConstraintDays.Get(context),

                            MilestoneDays.Get(context),

                            ReleaseItem.Get(context)

                            ));


            if (!Success.Get(context))    // THROW EXCEPTION IF UNABLE TO SUSPEND

            {
                CommonFunctions.RaiseActivityException(WorkflowManager.Get(context).Application,

                                                       1,

                                                       WorkQueueItem.Get(context).Id,

                                                       WorkflowSteps.Get(context),

                                                       WorkflowManager.Get(context).Application.LastException.Message

                                                       );
            }

            // RECORD WORKFLOW STEPS

            Workflows.Activities.CommonFunctions.WorkflowStepsAdd(

                WorkflowManager.Get(context).Application,

                1,

                WorkQueueItem.Get(context).Id,

                WorkflowSteps.Get(context),

                "Suspend for Next Step: " + WorkflowNextStep.Get(context) +

                "  |  Constraint Days: " + ConstraintDays.Get(context).ToString() +

                "  |  Milestone Days: " + MilestoneDays.Get(context).ToString()

                );


            // SAVE WORKFLOW STEPS

            WorkflowManager.Get(context).Application.WorkQueueItemWorkflowStepsSave(WorkQueueItem.Get(context).Id, WorkflowSteps.Get(context));


            // EVALUATE IF WE WANT TO SUSPEND THE WORKFLOW TOO, OR JUST THE WORKFLOW ITEM AND LET THE WORKFLOW CONTINUE

            if (SuspendWorkflow.Get(context))
            {
                // MARK WORKFLOW AS SUSPEND USING WORKFLOW MANAGER

                WorkflowManager.Get(context).WorkflowStatus = WorkflowStatus.Suspended;


                // CREATE A BOOKMARK SET TO THE WORKFLOW INSTANCE ID TO MAKE IT UNIQUE

                context.CreateBookmark(context.WorkflowInstanceId.ToString(), new BookmarkCallback(this.ResumeWorkflow));
            }

            return;
        }
示例#25
0
        internal void AbortDeletion()
        {
            this.CurrentProcessStep = WorkflowSteps.Idle;

            this.deletionWorker.Dispose(); this.deletionWorker = null;

            if (this.OnAborted != null)
                this.OnAborted(this, new EventArgs());
        }
示例#26
0
 internal void ContinueDeleteProcess()
 {
     this.CurrentProcessStep = WorkflowSteps.DeleteProcessRunning;
     this.deletionWorker.RunWorkerAsync();
 }
        protected override void Execute(CodeActivityContext context)
        {
            ActivityCompleted.Set(context, false);

            ActivityCanceled.Set(context, false);


            if (UserInteractionResponse.Get(context).UserInteractionType == UserInteractions.Enumerations.UserInteractionType.Prompt)
            {
                Workflows.UserInteractions.Response.PromptUserResponse response = (UserInteractions.Response.PromptUserResponse)UserInteractionResponse.Get(context);


                if (response.ButtonClicked != UserInteractions.Enumerations.UserPromptButtonClicked.None)
                {
                    ButtonClicked.Set(context, response.ButtonClicked);



                    if (response.InputText == null)
                    {
                        response.InputText = String.Empty;
                    }

                    InputText.Set(context, response.InputText);


                    if (response.SelectedValue == null)
                    {
                        response.SelectedValue = String.Empty;
                    }

                    SelectedValue.Set(context, response.SelectedValue);


                    if (response.SelectedText == null)
                    {
                        response.SelectedText = String.Empty;
                    }

                    SelectedText.Set(context, response.SelectedText);


                    Activities.CommonFunctions.WorkflowStepsAdd(

                        WorkflowManager.Get(context).Application,

                        1,

                        WorkQueueItemId.Get(context),

                        WorkflowSteps.Get(context),

                        "Button Clicked: " + ButtonClicked.Get(context).ToString() + "  |  Selected Text = " + SelectedText.Get(context).ToString()

                        );


                    // IF USER DID NOT CANCEL, OR THEY DID CANCEL AND CANCEL ALLOWED, MARK COMPLETED

                    if ((response.ButtonClicked != UserInteractions.Enumerations.UserPromptButtonClicked.Cancel)

                        || ((response.ButtonClicked == UserInteractions.Enumerations.UserPromptButtonClicked.Cancel) && (AllowCancel.Get(context))))
                    {
                        ActivityCompleted.Set(context, true);
                    }
                }
            }
        }
示例#28
0
 public WorkflowStep <TStep> Next()
 {
     Fire(WorkFlowActions.Next);
     return(WorkflowSteps.FirstOrDefault(a => Equals(a.Step, State.Step) && Equals(a.IsFinal, State.IsFinal)));
 }
示例#29
0
 internal void ContinueDeleteProcess()
 {
     this.CurrentProcessStep = WorkflowSteps.DeleteProcessRunning;
     this.deletionWorker.RunWorkerAsync();
 }
示例#30
0
        public void StartDeleteProcess()
        {
            this.CurrentProcessStep = WorkflowSteps.DeleteProcessRunning;

            this.deletionWorker = new DeletionWorker();
            this.deletionWorker.Data = this.Data;

            this.deletionWorker.ProgressChanged += new ProgressChangedEventHandler(deletionWorker_ProgressChanged);
            this.deletionWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(deletionWorker_RunWorkerCompleted);

            this.deletionWorker.RunWorkerAsync();
        }
示例#31
0
        protected override void Execute(CodeActivityContext context)
        {
            if (UserInteractionResponse.Get(context) == null)
            {
                return;
            }                                                              // VALIDATE RESPONSE WAS RECEIVED, OTHERWISE LOOP REQUEST


            ActivityCompleted.Set(context, false);

            ActivityCanceled.Set(context, false);

            if (UserInteractionResponse.Get(context).UserInteractionType == UserInteractions.Enumerations.UserInteractionType.ContactEntity)
            {
                Workflows.UserInteractions.Response.ContactEntityResponse response = (UserInteractions.Response.ContactEntityResponse)UserInteractionResponse.Get(context);


                if ((!response.Cancel) || (!AllowCancel.Get(context)))
                {
                    //if ((response.ContactType != Mercury.Server.Core.Enumerations.EntityContactType.NotSpecified) &&
                    //    (response.ContactOutcome != Mercury.Server.Core.Enumerations.ContactOutcome.NotSpecified)) {

                    if ((response.EntityContact.ContactType != Mercury.Server.Core.Enumerations.EntityContactType.NotSpecified) &&
                        (response.EntityContact.ContactOutcome != Mercury.Server.Core.Enumerations.ContactOutcome.NotSpecified))
                    {
                        #region Contact Received

                        // Core.Entity.EntityContact entityContact = new Mercury.Server.Core.Entity.EntityContact (WorkflowManager.Get (context).Application);

                        Core.Entity.EntityContact entityContact = response.EntityContact;

                        entityContact.Application = WorkflowManager.Get(context).Application;


                        if (!AllowEditContactDateTime.Get(context))
                        {
                            entityContact.ContactDate = DateTime.Now;
                        }

                        //else {

                        //    entityContact.ContactDate = response.EntityContact.ContactDate;

                        //}


                        //entityContact.EntityId = (response.Entity != null) ? response.Entity.Id : 0;

                        //entityContact.RelatedEntityId = (response.RelatedEntity != null) ? response.RelatedEntity.Id : 0;

                        //entityContact.EntityContactInformationId = response.EntityContactInformationId;


                        //entityContact.Direction = response.Direction;

                        //entityContact.ContactType = response.ContactType;


                        //entityContact.ContactOutcome = response.ContactOutcome;

                        //entityContact.Successful = (response.ContactOutcome == Mercury.Server.Core.Enumerations.ContactOutcome.Success);


                        //entityContact.Regarding = response.Regarding;

                        //entityContact.Remarks = response.Remarks;



                        entityContact.ContactedByName = WorkflowManager.Get(context).Application.Session.UserDisplayName;



                        if (AutoSaveContact.Get(context))
                        {
                            ActivityCompleted.Set(context, entityContact.Save());
                        }

                        else
                        {
                            ActivityCompleted.Set(context, true);
                        }

                        EntityContact.Set(context, entityContact);


                        if (ActivityCompleted.Get(context))
                        {
                            ContactAttempts.Set(context, ContactAttempts.Get(context) + 1);

                            ContactSuccess.Set(context, entityContact.Successful);

                            ContactOutcome.Set(context, entityContact.ContactOutcome);

                            Activities.CommonFunctions.WorkflowStepsAdd(

                                WorkflowManager.Get(context).Application,

                                1,

                                WorkQueueItemId.Get(context),

                                WorkflowSteps.Get(context),

                                "Contact Outcome: " + ContactOutcome.Get(context).ToString() + "  |  # of Attempts = " + ContactAttempts.Get(context).ToString()

                                );
                        }

                        else
                        {
                            Activities.CommonFunctions.RaiseActivityException(

                                WorkflowManager.Get(context).Application,

                                1,

                                WorkQueueItemId.Get(context),

                                WorkflowSteps.Get(context),

                                "Unable to save contact information."

                                );
                        }

                        #endregion
                    }
                }

                else
                {
                    // CONTACT CANCELED

                    EntityContact.Set(context, null);

                    ActivityCanceled.Set(context, true);

                    ActivityCompleted.Set(context, true);
                }
            }
        }
示例#32
0
 public WorkflowStepChangedEventArgs(WorkflowSteps NewStep)
 {
     this.NewStep = NewStep;
 }
示例#33
0
        void searchEmptyFoldersWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.CurrentProcessStep = WorkflowSteps.Idle;

            if (e.Error != null)
            {
                this.searchEmptyFoldersWorker.Dispose(); this.searchEmptyFoldersWorker = null;

                this.showErrorMsg(e.Error.Message);
            }
            else if (e.Cancelled)
            {
                if (this.searchEmptyFoldersWorker.ErrorInfo != null)
                {
                    // A error occurred, process was stopped
                    this.showErrorMsg(this.searchEmptyFoldersWorker.ErrorInfo.ErrorMessage);

                    this.searchEmptyFoldersWorker.Dispose(); this.searchEmptyFoldersWorker = null;

                    if (this.OnAborted != null)
                        this.OnAborted(this, new EventArgs());
                }
                else
                {
                    this.searchEmptyFoldersWorker.Dispose(); this.searchEmptyFoldersWorker = null;

                    if (this.OnCancelled != null)
                        this.OnCancelled(this, new EventArgs());
                }
            }
            else
            {
                int FolderCount = this.searchEmptyFoldersWorker.FolderCount;

                this.searchEmptyFoldersWorker.Dispose(); this.searchEmptyFoldersWorker = null;

                if (this.OnFinishedScanForEmptyDirs != null)
                    this.OnFinishedScanForEmptyDirs(this, new FinishedScanForEmptyDirsEventArgs(this.Data.EmptyFolderList.Count, FolderCount));
            }
        }