public void Submit(string comment, Action onExecuting = null)
        {
            var actor = ProjectUsers.GetProjectUser(this.ProjectId, ProjectUserRoleCode.AssetActor);
            var task  = TaskWork.GetTaskWork(ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish,
                                             FlowCode.Renewal, WorkflowCode);
            var dataFields = SetWorkflowDataFields(task);
            var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields);

            if (procInstId > 0)
            {
                using (TransactionScope tranScope = new TransactionScope())
                {
                    this.ProcInstId        = procInstId;
                    this.CreateTime        = DateTime.Now;
                    this.CreateUserAccount = ClientCookie.UserCode;
                    this.Update();
                    var approveDialogUser = new ApproveDialogUser();
                    approveDialogUser.Id         = Guid.NewGuid();
                    approveDialogUser.LegalCode  = AppUsers.Legal.Code;
                    approveDialogUser.ProjectId  = this.ProjectId;
                    approveDialogUser.FlowCode   = this.WorkflowCode;
                    approveDialogUser.RefTableID = this.Id.ToString();
                    approveDialogUser.Add();
                    var project = ProjectInfo.Get(this.ProjectId, this.WorkflowCode);
                    project.CreateUserAccount = ClientCookie.UserCode;
                    project.Update();
                    var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);
                    if (SavedComment != null)
                    {
                        SavedComment.Status     = ProjectCommentStatus.Submit;
                        SavedComment.Content    = comment;
                        SavedComment.CreateTime = DateTime.Now;
                        SavedComment.Update();
                    }
                    else
                    {
                        ProjectComment.AddComment(
                            ProjectCommentAction.Submit,
                            comment,
                            this.Id,
                            this.TableName,
                            FlowCode.Renewal,
                            procInstId,
                            ProjectCommentStatus.Submit
                            );
                    }
                    ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_LegalApproval_Input);
                    if (onExecuting != null)
                    {
                        onExecuting();
                    }
                    tranScope.Complete();
                }
            }
        }
Exemple #2
0
        public void Submit(string comment, Action onExecuting = null)
        {
            var actor = ProjectUsers.GetProjectUser(this.ProjectId, ProjectUserRoleCode.AssetActor);
            var task  = TaskWork.GetTaskWork(ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish,
                                             FlowCode.Renewal, WorkflowCode);
            var dataFields = SetWorkflowDataFields(task);
            var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields);

            if (procInstId > 0)
            {
                using (TransactionScope tranScope = new TransactionScope())
                {
                    task.Finish();
                    this.ProcInstId        = procInstId;
                    this.CreateTime        = DateTime.Now;
                    this.CreateUserAccount = ClientCookie.UserCode;
                    this.Update();
                    var project = ProjectInfo.Get(this.ProjectId, this.WorkflowCode);
                    project.CreateUserAccount = ClientCookie.UserCode;
                    project.Update();
                    var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);
                    if (SavedComment != null)
                    {
                        SavedComment.Status     = ProjectCommentStatus.Submit;
                        SavedComment.Content    = comment;
                        SavedComment.CreateTime = DateTime.Now;
                        SavedComment.Update();
                    }
                    else
                    {
                        ProjectComment.AddComment(
                            ProjectCommentAction.Submit,
                            comment,
                            this.Id,
                            this.TableName,
                            FlowCode.Renewal,
                            procInstId,
                            ProjectCommentStatus.Submit
                            );
                    }
                    if (onExecuting != null)
                    {
                        onExecuting();
                    }
                    ProjectInfo.FinishNode(ProjectId, WorkflowCode, NodeCode.Renewal_Letter_Upload);
                    ProjectProgress.SetProgress(ProjectId, "20%");
                    tranScope.Complete();
                }
            }
        }