예제 #1
0
 public void Resubmit(string comment, string SerialNumber)
 {
     K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Resubmit", comment);
     using (TransactionScope tranScope = new TransactionScope())
     {
         this.CreateUserAccount = ClientCookie.UserCode;
         this.Update();
         var approveDialogUser = ApproveDialogUser.GetApproveDialogUser(this.Id.ToString());
         approveDialogUser.LegalCode = AppUsers.Legal.Code;
         //approveDialogUser.GeneralCounselCode = AppUsers.GeneralCounsel.Code;
         approveDialogUser.LastUpdateDate        = DateTime.Now;
         approveDialogUser.LastUpdateUserAccount = ClientCookie.UserCode;
         approveDialogUser.Update();
         ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_LegalApproval_Input);
         ProjectComment.AddComment(
             ProjectCommentAction.ReSubmit,
             comment,
             this.Id,
             this.TableName,
             FlowCode.Renewal,
             this.ProcInstId,
             ProjectCommentStatus.Submit
             );
         tranScope.Complete();
     }
 }
예제 #2
0
        public void Resubmit(string comment, string SerialNumber, Action onExecuting = null)
        {
            var task       = TaskWork.FirstOrDefault(t => t.RefID == this.ProjectId && t.TypeCode == this.WorkflowCode && t.ReceiverAccount == ClientCookie.UserCode);
            var dataFields = SetWorkflowDataFields(task);

            K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Resubmit", comment, dataFields);
            using (TransactionScope tranScope = new TransactionScope())
            {
                task.Finish();
                this.CreateUserAccount = ClientCookie.UserCode;
                this.Update();
                ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_Tool_Input);
                ProjectComment.AddComment(
                    ProjectCommentAction.ReSubmit,
                    comment,
                    this.Id,
                    this.TableName,
                    FlowCode.Renewal,
                    this.ProcInstId,
                    ProjectCommentStatus.Submit
                    );
                if (onExecuting != null)
                {
                    onExecuting();
                }
                tranScope.Complete();
            }
        }
예제 #3
0
        public void Reject(string comment, string SerialNumber)
        {
            K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, ProjectAction.Decline, comment);
            using (TransactionScope tranScope = new TransactionScope())
            {
                ProjectInfo.Reject(this.ProjectId, this.WorkflowCode);
                var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);
                if (SavedComment != null)
                {
                    SavedComment.Status     = ProjectCommentStatus.Submit;
                    SavedComment.Action     = ProjectCommentAction.Decline;
                    SavedComment.Content    = comment;
                    SavedComment.CreateTime = DateTime.Now;
                    SavedComment.Update();
                }
                else
                {
                    ProjectComment.AddComment(
                        ProjectCommentAction.Decline,
                        comment,
                        this.Id,
                        this.TableName,
                        FlowCode.TempClosure,
                        this.ProcInstId,
                        ProjectCommentStatus.Submit
                        );
                }

                tranScope.Complete();
            }
        }
예제 #4
0
        public override void Recall(string comment)
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                ProjectInfo.Reset(this.ProjectId, this.WorkflowCode, ProjectStatus.Recalled);
                ProjectComment.AddComment(
                    ProjectCommentAction.Recall,
                    comment,
                    this.Id,
                    this.TableName,
                    FlowCode.TempClosure,
                    this.ProcInstId,
                    ProjectCommentStatus.Submit
                    );
                var actor            = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == this.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
                var legal            = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == this.ProjectId && pu.RoleCode == ProjectUserRoleCode.Legal);
                var oldUnfinishTasks = TaskWork.Search(t => t.RefID == this.ProjectId && t.TypeCode == FlowCode.TempClosure_LegalReview && t.Status == TaskWorkStatus.UnFinish).ToList();
                oldUnfinishTasks.ForEach(t =>
                {
                    t.Status = TaskWorkStatus.Cancel;
                });
                TaskWork.Update(oldUnfinishTasks.ToArray());
                tranScope.Complete();
            }
            string comments = ClientCookie.UserNameZHCN + "进行了流程撤回操作";

            K2FxContext.Current.GoToActivityAndRecord(
                this.ProcInstId.Value,
                this.WorkflowActOriginator,
                ClientCookie.UserCode,
                ProjectAction.Recall,
                comments
                );
            //ProjectInfo.Reset(this.ProjectId, WorkflowCode);
        }
예제 #5
0
 public void Save(string comment, Action onExecuting = null)
 {
     using (TransactionScope tranScope = new TransactionScope())
     {
         var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);
         if (SavedComment != null)
         {
             SavedComment.Status     = ProjectCommentStatus.Save;
             SavedComment.Content    = comment;
             SavedComment.CreateTime = DateTime.Now;
             SavedComment.Update();
         }
         else
         {
             ProjectComment.AddComment(
                 ProjectCommentAction.Submit,
                 comment,
                 this.Id,
                 this.TableName,
                 FlowCode.Renewal,
                 null,
                 ProjectCommentStatus.Save
                 );
         }
         this.Update();
         if (onExecuting != null)
         {
             onExecuting();
         }
         tranScope.Complete();
     }
 }
예제 #6
0
        public void Approve(string comment, string SerialNumber)
        {
            K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Approve", comment);
            var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);

            if (SavedComment != null)
            {
                SavedComment.Status     = ProjectCommentStatus.Submit;
                SavedComment.Action     = ProjectCommentAction.Approve;
                SavedComment.Content    = comment;
                SavedComment.CreateTime = DateTime.Now;
                SavedComment.Update();
            }
            else
            {
                ProjectComment.AddComment(
                    ProjectCommentAction.Approve,
                    comment,
                    this.Id,
                    this.TableName,
                    FlowCode.TempClosure,
                    this.ProcInstId,
                    ProjectCommentStatus.Submit
                    );
            }
        }
예제 #7
0
        public void Save(string comment)
        {
            if (Any(p => p.Id == this.Id))
            {
                Update(this);
            }
            else
            {
                Add(this);
            }
            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.TempClosure,
                    null,
                    ProjectCommentStatus.Save
                    );
            }
        }
예제 #8
0
        public void Submit(string comment, Action onExecuting = null)
        {
            var legal = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == this.ProjectId && pu.RoleCode == ProjectUserRoleCode.Legal);
            var task  = TaskWork.GetTaskWork(this.ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish,
                                             FlowCode.TempClosure, this.WorkflowCode);

            task.Status     = TaskWorkStatus.Finished;
            task.FinishTime = DateTime.Now;
            List <ProcessDataField> dataFields = new List <ProcessDataField>
            {
                new ProcessDataField("dest_Creator", this.CreateUserAccount),
                new ProcessDataField("dest_Legal", legal.UserAccount),
                new ProcessDataField("ProcessCode", this.WorkflowProcessCode),
                new ProcessDataField("ProjectTaskInfo", JsonConvert.SerializeObject(task))
            };
            var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields);

            if (procInstId > 0)
            {
                using (TransactionScope tranScope = new TransactionScope())
                {
                    TaskWork.Update(task);
                    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.TempClosure,
                            procInstId,
                            ProjectCommentStatus.Submit
                            );
                    }
                    ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.TempClosure_LegalReview_Input);
                    if (onExecuting != null)
                    {
                        onExecuting();
                    }
                    tranScope.Complete();
                }
            }
        }
예제 #9
0
        public void Submit(string comment, Action onExecuting = null)
        {
            try
            {
                RenewalInfo info = RenewalInfo.Get(this.ProjectId);
                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 (var 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
                                );
                        }
                        ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_Tool_Input);
                        if (onExecuting != null)
                        {
                            onExecuting();
                        }
                        tranScope.Complete();
                    }
                }
            }
            catch (Exception ex)
            {
                Log4netHelper.WriteInfo("[[Renewal Too]]:" + JsonConvert.SerializeObject(ex));
                throw ex;
            }
        }
예제 #10
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())
                {
                    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();
                }
            }
        }
예제 #11
0
        public void Submit(string comment, Action onExecuting = null)
        {
            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();
                    if (this.HasReinvenstment)
                    {
                        SaveApprovers();
                    }
                    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 (HasReinvenstment)
                    {
                        ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_ConsInfo_Input);
                    }
                    if (onExecuting != null)
                    {
                        onExecuting();
                    }
                    tranScope.Complete();
                }
            }
        }
예제 #12
0
 public void Approve(string comment, string SerialNumber)
 {
     K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Approve", comment);
     ProjectComment.AddComment(
         ProjectCommentAction.Approve,
         comment,
         this.Id,
         this.TableName,
         FlowCode.Renewal,
         this.ProcInstId,
         ProjectCommentStatus.Submit
         );
 }
예제 #13
0
 public void Approve(string comment, string SerialNumber)
 {
     K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Approve", comment);
     using (var tranScope = new TransactionScope())
     {
         ProjectComment.AddComment(
             ProjectCommentAction.Approve,
             comment,
             this.Id,
             this.TableName,
             FlowCode.Renewal,
             this.ProcInstId,
             ProjectCommentStatus.Submit
             );
         tranScope.Complete();
     }
 }
예제 #14
0
 public void Reject(string comment, string SerialNumber)
 {
     K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Reject", comment);
     using (TransactionScope tranScope = new TransactionScope())
     {
         ProjectInfo.Reject(this.ProjectId, this.WorkflowCode);
         ProjectComment.AddComment(
             ProjectCommentAction.Decline,
             comment,
             this.Id,
             this.TableName,
             FlowCode.Renewal,
             this.ProcInstId,
             ProjectCommentStatus.Submit
             );
         tranScope.Complete();
     }
 }
예제 #15
0
 public void Return(string comment, string SerialNumber)
 {
     K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Return", comment);
     using (TransactionScope tranScope = new TransactionScope())
     {
         //TaskWork.Finish(t => t.ReceiverAccount == ClientCookie.UserCode && t.Status == TaskWorkStatus.UnFinish && t.TypeCode == this.WorkflowCode && t.RefID == this.ProjectId);
         ProjectInfo.Reset(this.ProjectId, this.WorkflowCode);
         ProjectComment.AddComment(
             ProjectCommentAction.Return,
             comment,
             this.Id,
             this.TableName,
             FlowCode.Renewal,
             this.ProcInstId,
             ProjectCommentStatus.Submit
             );
         tranScope.Complete();
     }
 }
예제 #16
0
 public void Resubmit(string comment, string SerialNumber)
 {
     K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Resubmit", comment);
     using (TransactionScope tranScope = new TransactionScope())
     {
         this.CreateUserAccount = ClientCookie.UserCode;
         this.Update();
         ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.TempClosure_LegalReview_Input);
         ProjectComment.AddComment(
             ProjectCommentAction.ReSubmit,
             comment,
             this.Id,
             this.TableName,
             FlowCode.TempClosure,
             this.ProcInstId,
             ProjectCommentStatus.Submit
             );
         tranScope.Complete();
     }
 }
예제 #17
0
        public void Resubmit(string serialNumber)
        {
            var comment    = "";
            var task       = TaskWork.FirstOrDefault(t => t.RefID == this.ProjectId && t.TypeCode == this.WorkflowCode && t.ReceiverAccount == ClientCookie.UserCode && t.Status == TaskWorkStatus.UnFinish);
            var dataFields = SetWorkflowDataFields(task);

            K2FxContext.Current.ApprovalProcess(serialNumber, ClientCookie.UserCode, "Resubmit", comment, dataFields);
            using (TransactionScope tranScope = new TransactionScope())
            {
                Save();
                ProjectComment.AddComment(
                    ProjectCommentAction.ReSubmit,
                    comment,
                    this.Id,
                    this.TableName,
                    FlowCode.Renewal,
                    this.ProcInstId,
                    ProjectCommentStatus.Submit
                    );
                tranScope.Complete();
            }
        }
예제 #18
0
        public void Return(string comment, string SerialNumber)
        {
            TaskWork.Finish(e => e.RefID == ProjectId &&
                            e.TypeCode == WorkflowCode &&
                            e.Status == TaskWorkStatus.UnFinish);
            //&& e.K2SN != SerialNumber);

            K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Return", comment);
            using (TransactionScope tranScope = new TransactionScope())
            {
                ProjectInfo.Reset(this.ProjectId, this.WorkflowCode, ProjectStatus.UnFinish);
                var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);
                if (SavedComment != null)
                {
                    SavedComment.Status     = ProjectCommentStatus.Submit;
                    SavedComment.Action     = ProjectCommentAction.Return;
                    SavedComment.Content    = comment;
                    SavedComment.CreateTime = DateTime.Now;
                    SavedComment.Update();
                }
                else
                {
                    ProjectComment.AddComment(
                        ProjectCommentAction.Return,
                        comment,
                        this.Id,
                        this.TableName,
                        FlowCode.TempClosure,
                        this.ProcInstId,
                        ProjectCommentStatus.Submit
                        );
                }


                tranScope.Complete();
            }
        }
예제 #19
0
 public void Approve(string comment, string SerialNumber, bool isGeneralCouncel)
 {
     if (isGeneralCouncel)
     {
         K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Approve", comment);
     }
     else
     {
         K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Approve", comment, SetWorkflowDataFieldsByLegal());
     }
     using (TransactionScope tranScope = new TransactionScope())
     {
         if (!isGeneralCouncel)
         {
             var approveDialogUser = ApproveDialogUser.GetApproveDialogUser(this.Id.ToString());
             approveDialogUser.GeneralCounselCode = AppUsers.GeneralCounsel.Code;
             approveDialogUser.Update();
         }
         this.LastUpdateTime        = DateTime.Now;
         this.LastUpdateUserAccount = ClientCookie.UserCode;
         this.Update();
         ProjectComment.AddComment(
             ProjectCommentAction.Approve,
             comment,
             this.Id,
             this.TableName,
             FlowCode.Renewal,
             this.ProcInstId,
             ProjectCommentStatus.Submit
             );
         if (!isGeneralCouncel)
         {
             ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_LegalApproval_LegalReview);
         }
         tranScope.Complete();
     }
 }
예제 #20
0
        public void Save(string comment)
        {
            var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);

            if (SavedComment != null)
            {
                SavedComment.Status     = ProjectCommentStatus.Save;
                SavedComment.Content    = comment;
                SavedComment.CreateTime = DateTime.Now;
                SavedComment.Update();
            }
            else
            {
                ProjectComment.AddComment(
                    ProjectCommentAction.Submit,
                    comment,
                    this.Id,
                    this.TableName,
                    FlowCode.Renewal,
                    null,
                    ProjectCommentStatus.Save
                    );
            }
        }
예제 #21
0
 public override void Recall(string comment)
 {
     K2FxContext.Current.GoToActivityAndRecord(
         this.ProcInstId.Value,
         this.WorkflowActOriginator,
         ClientCookie.UserCode,
         ProjectAction.Recall,
         comment
         );
     using (TransactionScope tranScope = new TransactionScope())
     {
         ProjectComment.AddComment(
             ProjectCommentAction.Recall,
             comment,
             this.Id,
             this.TableName,
             FlowCode.Renewal,
             this.ProcInstId,
             ProjectCommentStatus.Submit
             );
         ProjectInfo.Reset(this.ProjectId, this.WorkflowCode, ProjectStatus.Recalled);
         tranScope.Complete();
     }
 }
예제 #22
0
        public void Submit(string comment, ApproveUsers approvers, Action onExecuting = null)
        {
            var legal = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == this.ProjectId && pu.RoleCode == ProjectUserRoleCode.Legal);
            var task  = TaskWork.GetTaskWork(this.ProjectId, ClientCookie.UserCode, TaskWorkStatus.UnFinish,
                                             FlowCode.TempClosure, this.WorkflowCode);

            task.Status     = TaskWorkStatus.Finished;
            task.FinishTime = DateTime.Now;
            string destMRMgrs = approvers.MarketMgr.Code;

            if (approvers.RegionalMgr != null)
            {
                destMRMgrs += ";" + approvers.RegionalMgr.Code;
            }
            List <ProcessDataField> dataFields = new List <ProcessDataField>
            {
                new ProcessDataField("dest_Creator", this.CreateUserAccount),
                new ProcessDataField("dest_MRMgrs", destMRMgrs),
                new ProcessDataField("dest_GMApprovers", string.Concat(approvers.MDD.Code, ";", approvers.GM.Code, ";", approvers.FC.Code)),
                new ProcessDataField("dest_VPGM", approvers.VPGM.Code),
                new ProcessDataField("ProcessCode", this.WorkflowProcessCode),
                new ProcessDataField("ProjectTaskInfo", JsonConvert.SerializeObject(task))
            };
            var procInstId = K2FxContext.Current.StartProcess(WorkflowProcessCode, ClientCookie.UserCode, dataFields);

            if (procInstId > 0)
            {
                using (TransactionScope tranScope = new TransactionScope())
                {
                    TaskWork.Update(task);
                    var project = ProjectInfo.Get(this.ProjectId, FlowCode.TempClosure_ClosurePackage);
                    project.CreateUserAccount = ClientCookie.UserCode;
                    project.Update();
                    this.CreateUserAccount = ClientCookie.UserCode;
                    this.ProcInstId        = procInstId;
                    Update(this);
                    var approver = ApproveDialogUser.GetApproveDialogUser(this.Id.ToString());
                    if (approver == null)
                    {
                        approver = new ApproveDialogUser();
                    }
                    approver.ProjectId     = this.ProjectId;
                    approver.RefTableID    = this.Id.ToString();
                    approver.FlowCode      = FlowCode.TempClosure_ClosurePackage;
                    approver.MarketMgrCode = approvers.MarketMgr.Code;
                    if (approvers.RegionalMgr != null)
                    {
                        approver.RegionalMgrCode = approvers.RegionalMgr.Code;
                    }
                    approver.MDDCode  = approvers.MDD.Code;
                    approver.GMCode   = approvers.GM.Code;
                    approver.FCCode   = approvers.FC.Code;
                    approver.VPGMCode = approvers.VPGM.Code;
                    //approver.MCCLAssetMgrCode = approvers.MCCLAssetMgr.Code;
                    //approver.MCCLAssetDtrCode = approvers.MCCLAssetDtr.Code;
                    approver.NecessaryNoticeUsers = string.Join(";", approvers.NecessaryNoticeUsers.Select(u => u.Code).ToArray());
                    approver.NoticeUsers          = string.Join(";", approvers.NoticeUsers.Select(u => u.Code).ToArray());
                    approver.Save();
                    ProjectInfo.FinishNode(this.ProjectId, FlowCode.TempClosure_ClosurePackage, NodeCode.TempClosure_ClosurePackage_Input);
                    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,
                            "TempClosurePackage",
                            FlowCode.TempClosure,
                            this.ProcInstId,
                            ProjectCommentStatus.Submit
                            );
                    }
                    if (onExecuting != null)
                    {
                        onExecuting();
                    }
                    tranScope.Complete();
                }
            }
        }
예제 #23
0
        public void Resubmit(string comment, string SerialNumber, ApproveUsers newApprover, Action onExecuting = null)
        {
            var    assetActor = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == this.ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
            string destMRMgrs = newApprover.MarketMgr.Code;

            if (newApprover.RegionalMgr != null)
            {
                destMRMgrs += ";" + newApprover.RegionalMgr.Code;
            }
            List <ProcessDataField> dataFields = new List <ProcessDataField>
            {
                new ProcessDataField("dest_Creator", this.CreateUserAccount),
                new ProcessDataField("dest_MRMgrs", destMRMgrs),
                new ProcessDataField("dest_GMApprovers", string.Concat(newApprover.MDD.Code, ";", newApprover.GM.Code, ";", newApprover.FC.Code)),
                new ProcessDataField("dest_VPGM", newApprover.VPGM.Code),
                new ProcessDataField("ProcessCode", this.WorkflowProcessCode)
            };

            K2FxContext.Current.ApprovalProcess(SerialNumber, ClientCookie.UserCode, "Resubmit", comment, dataFields);
            using (TransactionScope tranScope = new TransactionScope())
            {
                var project = ProjectInfo.Get(this.ProjectId, FlowCode.TempClosure_ClosurePackage);
                project.CreateUserAccount = ClientCookie.UserCode;
                project.Update();
                this.CreateUserAccount = ClientCookie.UserCode;
                Update(this);
                var approver = ApproveDialogUser.GetApproveDialogUser(this.Id.ToString());
                if (approver == null)
                {
                    approver = new ApproveDialogUser();
                }
                approver.ProjectId     = this.ProjectId;
                approver.RefTableID    = this.Id.ToString();
                approver.FlowCode      = this.WorkflowCode;
                approver.MarketMgrCode = newApprover.MarketMgr.Code;
                if (newApprover.RegionalMgr != null)
                {
                    approver.RegionalMgrCode = newApprover.RegionalMgr.Code;
                }
                else
                {
                    approver.RegionalMgrCode = null;
                }
                approver.MDDCode          = newApprover.MDD.Code;
                approver.GMCode           = newApprover.GM.Code;
                approver.FCCode           = newApprover.FC.Code;
                approver.VPGMCode         = newApprover.VPGM.Code;
                approver.MCCLAssetMgrCode = newApprover.MCCLAssetMgr.Code;
                approver.MCCLAssetDtrCode = newApprover.MCCLAssetDtr.Code;
                approver.NoticeUsers      = string.Join(";", newApprover.NoticeUsers.Select(u => u.Code).ToArray());
                approver.Save();
                ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.TempClosure_ClosurePackage_Input);
                var SavedComment = ProjectComment.GetSavedComment(this.Id, this.TableName, ClientCookie.UserCode);
                if (SavedComment != null)
                {
                    SavedComment.Status     = ProjectCommentStatus.Submit;
                    SavedComment.Action     = ProjectCommentAction.ReSubmit;
                    SavedComment.Content    = comment;
                    SavedComment.CreateTime = DateTime.Now;
                    SavedComment.Update();
                }
                else
                {
                    ProjectComment.AddComment(
                        ProjectCommentAction.ReSubmit,
                        comment,
                        this.Id,
                        this.TableName,
                        FlowCode.TempClosure,
                        this.ProcInstId,
                        ProjectCommentStatus.Submit
                        );
                }

                var task = TaskWork.FirstOrDefault(t => t.RefID == this.ProjectId && t.TypeCode == this.WorkflowCode && t.ReceiverAccount == assetActor.UserAccount);
                task.Finish();
                if (onExecuting != null)
                {
                    onExecuting();
                }
                tranScope.Complete();
            }
        }