示例#1
0
        /// <summary>
        /// بعد از اينكه تسك به اتمام رسيد
        /// </summary>
        /// <param name="taskEventArg"></param>
        protected virtual void OnAfterFinishTask(FinishTaskEventArgs taskEventArg)
        {
            if (taskEventArg.TaskAction.Task1.TaskTypeID == (int)TaskTypeEnum.Subflow)
            {
                SubflowTaskBase act = (SubflowTaskBase)GetTaskClassByTaskCode(taskEventArg.TaskAction.Task1.TaskCode);
                act.CreateSubflowInstance(taskEventArg);
            }

            if (AfterFinishTask != null)
            {
                AfterFinishTask(this, taskEventArg);
            }
            else
            {
                DoAction(this, taskEventArg);
            }
        }
示例#2
0
        /// <summary>
        /// قبل از اتمام ورك فلو
        /// </summary>
        /// <param name="WorkflowEventArg"></param>
        protected virtual void OnBeforeFinishWorkflowInstance(FinishWorkflowEventArgs e)
        {
            if (e.WfInstance != null && e.WfInstance.ParentTaskInstanceID.HasValue) // اگر اين ورك فلو يك ساب فلو بود
            {
                TaskInstance    ti         = wfs.GetTaskInstanceByID(e.WfInstance.ParentTaskInstanceID.Value);
                SubflowTaskBase sfBase     = (SubflowTaskBase)GetTaskClassByTaskCode(ti.TaskCode);
                string          actionCode = sfBase.GetResultActionCode(e);
                TaskAction      ta         = wfs.GetTaskActionByCode(ti.WorkflowInstance.WorkflowID, actionCode);
                FinishTask(ti, ta, e.UserName, e.CurrentTask.PerformerID, e.CurrentTask.Comment, e.CurrentTask.TaskDueDate);
            }

            if (BeforeFinishWorkflow != null)
            {
                BeforeFinishWorkflow(this, e);
            }

            if (e.Cancel == true)
            {
                throw new WFUserException(e.CancelMessage);
            }
        }