Esempio n. 1
0
        public static void PopulateAppUsers(RenewalGBMemo entity)
        {
            var approvedUsers = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString());

            entity.AppUsers = new ApproveUsers();
            if (approvedUsers != null)
            {
                var simp = new SimpleEmployee
                {
                    Code = approvedUsers.ConstructionManagerCode
                };
                entity.AppUsers.ConstructionManager = simp;
            }
            else
            {
                if (entity.Info != null)
                {
                    var simp = new SimpleEmployee
                    {
                        Code = entity.Info.CMAccount
                    };
                    entity.AppUsers.ConstructionManager = simp;
                }
            }
        }
Esempio n. 2
0
        public static void PopulateAppUsers(GBMemo entity)
        {
            var approvedUsers = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString());

            entity.AppUsers = new ApproveUsers();
            if (approvedUsers != null)
            {
                var simp = new SimpleEmployee
                {
                    Code = approvedUsers.ConstructionManagerCode
                };
                entity.AppUsers.ConstructionManager = simp;
            }
            else
            {
                var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == entity.ProjectId);
                if (rbdInfo != null)
                {
                    var simp = new SimpleEmployee
                    {
                        Code = rbdInfo.CMAccount
                    };
                    entity.AppUsers.ConstructionManager = simp;
                }
            }
        }
Esempio n. 3
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();
     }
 }
Esempio n. 4
0
        private void SaveApprovers()
        {
            bool isNew = false;
            ApproveDialogUser approvers = ApproveDialogUser.GetApproveDialogUser(this.Id.ToString());

            if (approvers == null)
            {
                approvers            = new ApproveDialogUser();
                approvers.Id         = Guid.NewGuid();
                approvers.ProjectId  = this.ProjectId;
                approvers.FlowCode   = this.WorkflowCode;
                approvers.RefTableID = this.Id.ToString();
                isNew = true;
            }
            approvers.LastUpdateDate          = DateTime.Now;
            approvers.LastUpdateUserAccount   = ClientCookie.UserCode;
            approvers.ConstructionManagerCode = AppUsers.ConstructionManager.Code;
            approvers.MCCLConsManagerCode     = AppUsers.MCCLConsManager.Code;
            if (isNew)
            {
                approvers.Add();
            }
            else
            {
                approvers.Update();
            }
        }
Esempio n. 5
0
 private void SaveApproveUsers(string actionName)
 {
     switch (actionName)
     {
     case ProjectAction.Submit:
     case ProjectAction.ReSubmit:
         var approveUser = ApproveDialogUser.GetApproveDialogUser(Id.ToString());
         if (approveUser == null)
         {
             approveUser            = new ApproveDialogUser();
             approveUser.Id         = Guid.Empty;
             approveUser.RefTableID = Id.ToString();
             approveUser.ProjectId  = ProjectId;
             approveUser.FlowCode   = FlowCode.Reimage_ConsInvtChecking;
         }
         approveUser.ConstructionManagerCode = AppUsers.ConstructionManager.Code;
         approveUser.FMCode = AppUsers.FM.Code;
         approveUser.FinanceControllerCode = AppUsers.FinanceController.Code;
         approveUser.VPGMCode              = AppUsers.VPGM.Code;
         approveUser.LastUpdateDate        = DateTime.Now;
         approveUser.LastUpdateUserAccount = ClientCookie.UserCode;
         approveUser.Save();
         break;
     }
 }
Esempio n. 6
0
 private void SaveApproveUsers(string actionName)
 {
     switch (actionName)
     {
     case ProjectAction.Submit:
     case ProjectAction.ReSubmit:
         var approveUser = ApproveDialogUser.GetApproveDialogUser(Id.ToString());
         if (approveUser == null)
         {
             approveUser            = new ApproveDialogUser();
             approveUser.Id         = Guid.Empty;
             approveUser.RefTableID = Id.ToString();
             approveUser.ProjectId  = ProjectId;
             approveUser.FlowCode   = FlowCode.Reimage_ConsInfo;
         }
         if (!CheckIfHasNoReinvestment())
         {
             approveUser.ConstructionManagerCode = AppUsers.ConstructionManager.Code;
             approveUser.MCCLConsManagerCode     = AppUsers.MCCLConsManager.Code;
         }
         approveUser.LastUpdateDate        = DateTime.Now;
         approveUser.LastUpdateUserAccount = ClientCookie.UserCode;
         approveUser.Save();
         break;
     }
 }
Esempio n. 7
0
        private void SaveApprovers()
        {
            bool isNew = false;
            ApproveDialogUser approvers = ApproveDialogUser.GetApproveDialogUser(this.Id.ToString());

            if (approvers == null)
            {
                approvers            = new ApproveDialogUser();
                approvers.Id         = Guid.NewGuid();
                approvers.ProjectId  = this.ProjectId;
                approvers.FlowCode   = this.WorkflowCode;
                approvers.RefTableID = this.Id.ToString();
                isNew = true;
            }
            approvers.MarketMgrCode = AppUsers.MarketMgr.Code;
            if (AppUsers.RegionalMgr != null)
            {
                approvers.RegionalMgrCode = AppUsers.RegionalMgr.Code;
            }
            approvers.MDDCode = AppUsers.MDD.Code;
            if (AppUsers.GM != null)
            {
                approvers.GMCode = AppUsers.GM.Code;
            }
            approvers.FCCode           = AppUsers.FC.Code;
            approvers.VPGMCode         = AppUsers.VPGM.Code;
            approvers.MCCLAssetDtrCode = AppUsers.MCCLAssetDtr.Code;
            if (AppUsers.CDO != null)
            {
                approvers.CDOCode = AppUsers.CDO.Code;
            }
            approvers.MngDirectorCode = AppUsers.ManagingDirector.Code;
            if (AppUsers.MCCLAssetMgr != null)
            {
                approvers.MCCLAssetMgrCode = AppUsers.MCCLAssetMgr.Code;
            }
            if (AppUsers.NecessaryNoticeUsers != null)
            {
                approvers.NecessaryNoticeUsers = string.Join(";", AppUsers.NecessaryNoticeUsers.Select(u => u.Code).ToArray());
            }
            if (AppUsers.NoticeUsers != null)
            {
                approvers.NoticeUsers = string.Join(";", AppUsers.NoticeUsers.Select(u => u.Code).ToArray());
            }
            if (isNew)
            {
                approvers.Add();
            }
            else
            {
                approvers.Update();
            }
        }
Esempio n. 8
0
        public static void PopulateAppUsers(RebuildLegalReview entity)
        {
            var approvedUsers = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString());

            entity.AppUsers = new ApproveUsers();
            if (approvedUsers != null)
            {
                var simp = new SimpleEmployee
                {
                    Code = approvedUsers.LegalCode
                };
                entity.AppUsers.Legal = simp;
            }
        }
Esempio n. 9
0
        public static void PopulateAppUsers(RebuildFinancAnalysis entity)
        {
            var approvedUsers = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString());

            entity.AppUsers = new ApproveUsers();
            if (approvedUsers != null)
            {
                var simp = new SimpleEmployee
                {
                    Code = approvedUsers.FMCode
                };
                entity.AppUsers.FM = simp;
            }
        }
Esempio n. 10
0
        private void PopulateAppUsers(MajorLeaseFinancAnalysis entity)
        {
            var approvedUsers = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString());

            entity.AppUsers = new ApproveUsers();
            if (approvedUsers != null)
            {
                var simp = new SimpleEmployee
                {
                    Code = approvedUsers.FMCode
                };
                entity.AppUsers.FM = simp;
            }
        }
Esempio n. 11
0
        public static ProjectDto GetApproverAndNoticeUsers(string projectId)
        {
            var approver = ApproveDialogUser.GetApproveDialogUser(projectId, FlowCode.TempClosure_ClosurePackage);

            if (approver != null)
            {
                return(new ProjectDto
                {
                    ApproveUsers = new ApproveUsers
                    {
                        MarketMgr = Employee.GetSimpleEmployeeByCode(approver.MarketMgrCode),
                        RegionalMgr = Employee.GetSimpleEmployeeByCode(approver.RegionalMgrCode),
                        MDD = Employee.GetSimpleEmployeeByCode(approver.MDDCode),
                        GM = Employee.GetSimpleEmployeeByCode(approver.GMCode),
                        FC = Employee.GetSimpleEmployeeByCode(approver.FCCode),
                        VPGM = Employee.GetSimpleEmployeeByCode(approver.VPGMCode),
                        MCCLAssetMgr = Employee.GetSimpleEmployeeByCode(approver.MCCLAssetMgrCode),
                        MCCLAssetDtr = Employee.GetSimpleEmployeeByCode(approver.MCCLAssetDtrCode),
                        NoticeUsers = string.IsNullOrEmpty(approver.NoticeUsers.TrimEnd(';')) ? new List <SimpleEmployee>() : Employee.GetSimpleEmployeeByCodes(approver.NoticeUsers.TrimEnd(';').Split(';')),

                        NecessaryNoticeUsers = string.IsNullOrEmpty(approver.NecessaryNoticeUsers.TrimEnd(';')) ? new List <SimpleEmployee>() : Employee.GetSimpleEmployeeByCodes(approver.NecessaryNoticeUsers.TrimEnd(';').Split(';'))
                    },
                    FlowCode = FlowCode.TempClosure_ClosurePackage,
                    ProjectId = projectId
                });
            }
            else
            {
                return(new ProjectDto
                {
                    ApproveUsers = new ApproveUsers
                    {
                        MarketMgr = null,
                        RegionalMgr = null,
                        MDD = null,
                        GM = null,
                        FC = null,
                        VPGM = null,
                        MCCLAssetMgr = null,
                        MCCLAssetDtr = null,
                        NoticeUsers = new List <SimpleEmployee>(),
                        NecessaryNoticeUsers = Employee.GetSimpleEmployeeByCodes(NecessaryNoticeConfig.Search(i => i.FlowCode == FlowCode.TempClosure_ClosurePackage && !string.IsNullOrEmpty(i.DefaultUserCode)).Select(i => i.DefaultUserCode).ToArray())
                    },
                    FlowCode = FlowCode.TempClosure_ClosurePackage,
                    ProjectId = projectId
                });
            }
        }
Esempio n. 12
0
        private void PopulateAppUsers(ReimageConsInvtChecking entity)
        {
            var approvedUsers = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString());

            entity.AppUsers = new ApproveUsers();
            if (approvedUsers != null)
            {
                var simp = new SimpleEmployee
                {
                    Code = approvedUsers.ConstructionManagerCode
                };
                entity.AppUsers.ConstructionManager = simp;

                entity.AppUsers = new ApproveUsers();
                simp            = new SimpleEmployee
                {
                    Code = approvedUsers.FMCode
                };
                entity.AppUsers.FM = simp;

                entity.AppUsers = new ApproveUsers();
                simp            = new SimpleEmployee
                {
                    Code = approvedUsers.FinanceControllerCode
                };
                entity.AppUsers.FinanceController = simp;

                entity.AppUsers = new ApproveUsers();
                simp            = new SimpleEmployee
                {
                    Code = approvedUsers.VPGMCode
                };
                entity.AppUsers.VPGM = simp;
            }
            else
            {
                var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId == ProjectId);
                if (reimageInfo != null)
                {
                    entity.AppUsers.ConstructionManager = new SimpleEmployee
                    {
                        Code = reimageInfo.CMAccount
                    };
                }
            }
        }
Esempio n. 13
0
        private void PopulateAppUsers()
        {
            var approvedUsers = ApproveDialogUser.GetApproveDialogUser(this.Id.ToString());

            this.AppUsers = new ApproveUsers();
            if (approvedUsers != null)
            {
                var simp = new SimpleEmployee
                {
                    Code = approvedUsers.ConstructionManagerCode
                };
                this.AppUsers.ConstructionManager = simp;

                simp = new SimpleEmployee
                {
                    Code = approvedUsers.MCCLConsManagerCode
                };
                this.AppUsers.MCCLConsManager = simp;

                //simp = new SimpleEmployee
                //{
                //    Code = approvedUsers.MCCLAssetMgrCode
                //};
                //entity.AppUsers.MCCLAssetMgr = simp;

                //simp = new SimpleEmployee
                //{
                //    Code = approvedUsers.MCCLAssetDtrCode
                //};
                //entity.AppUsers.MCCLAssetDtr = simp;
            }
            else
            {
                var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId == ProjectId);
                if (reimageInfo != null)
                {
                    this.AppUsers.ConstructionManager = new SimpleEmployee
                    {
                        Code = reimageInfo.CMAccount
                    };
                }
            }
        }
Esempio n. 14
0
        private void PopulateAppUsers(MajorLeaseConsInfo entity)
        {
            var approvedUsers = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString());

            entity.AppUsers = new ApproveUsers();
            if (approvedUsers != null)
            {
                var simp = new SimpleEmployee
                {
                    Code = approvedUsers.ConstructionManagerCode
                };
                entity.AppUsers.ConstructionManager = simp;

                simp = new SimpleEmployee
                {
                    Code = approvedUsers.MCCLConsManagerCode
                };
                entity.AppUsers.MCCLConsManager = simp;

                //simp = new SimpleEmployee
                //{
                //    Code = approvedUsers.MCCLAssetMgrCode
                //};
                //entity.AppUsers.MCCLAssetMgr = simp;

                //simp = new SimpleEmployee
                //{
                //    Code = approvedUsers.MCCLAssetDtrCode
                //};
                //entity.AppUsers.MCCLAssetDtr = simp;
            }
            else
            {
                var majorLeaesInfo = MajorLeaseInfo.FirstOrDefault(e => e.ProjectId == ProjectId);
                if (majorLeaesInfo != null)
                {
                    entity.AppUsers.ConstructionManager = new SimpleEmployee()
                    {
                        Code = majorLeaesInfo.CMAccount
                    };
                }
            }
        }
Esempio n. 15
0
 private void SaveApproveUsers(string actionName)
 {
     switch (actionName)
     {
     case ProjectAction.Submit:
     case ProjectAction.ReSubmit:
         var approveUser = ApproveDialogUser.GetApproveDialogUser(Id.ToString());
         if (approveUser == null)
         {
             approveUser            = new ApproveDialogUser();
             approveUser.Id         = Guid.Empty;
             approveUser.RefTableID = Id.ToString();
             approveUser.ProjectId  = ProjectId;
             approveUser.FlowCode   = FlowCode.Rebuild_LegalReview;
         }
         approveUser.LegalCode             = AppUsers.Legal.Code;
         approveUser.LastUpdateDate        = DateTime.Now;
         approveUser.LastUpdateUserAccount = ClientCookie.UserCode;
         approveUser.Save();
         break;
     }
 }
Esempio n. 16
0
        public static RenewalLegalApprovalDTO InitPage(string projectId, string id = null)
        {
            RenewalLegalApprovalDTO dto = new RenewalLegalApprovalDTO();
            var entity  = Get(projectId, id);
            var info    = RenewalInfo.Get(projectId);
            var isActor = ClientCookie.UserCode == info.AssetActorAccount;

            entity.IsProjectFreezed = entity.CheckIfFreezeProject(projectId);
            var nextRefTableId  = new Guid(FlowInfo.GetRefTableId(entity.TableName, projectId));
            var nextFlowStarted = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Package);
            var haveTask        = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_LegalApproval && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode);
            var projectComment  = ProjectComment.GetSavedComment(entity.Id, entity.TableName, ClientCookie.UserCode);
            var appUser         = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString());

            dto.Info             = info;
            dto.Entity           = entity;
            dto.ProjectComment   = projectComment != null ? projectComment.Content : "";
            dto.IsGeneralCounsel = appUser != null && appUser.GeneralCounselCode == ClientCookie.UserCode;
            dto.Editable         = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_LegalApproval);
            dto.Recallable       = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_LegalApproval);
            dto.Savable          = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_LegalApproval) && string.IsNullOrEmpty(id);
            return(dto);
        }
Esempio n. 17
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();
     }
 }
Esempio n. 18
0
        public void SaveApproveUsers(string actionName)
        {
            switch (actionName)
            {
            case ProjectAction.Submit:
            case ProjectAction.ReSubmit:
                var approveUser = ApproveDialogUser.GetApproveDialogUser(Id.ToString());
                if (approveUser == null)
                {
                    approveUser            = new ApproveDialogUser();
                    approveUser.Id         = Guid.Empty;
                    approveUser.RefTableID = Id.ToString();
                    approveUser.ProjectId  = ProjectId;
                    approveUser.FlowCode   = FlowCode.Closure_ClosurePackage;
                }
                if (!string.IsNullOrEmpty(MarketMgrCode))
                {
                    approveUser.MarketMgrCode = MarketMgrCode;
                }
                else
                {
                    approveUser.MarketMgrCode = string.Empty;
                }
                if (!string.IsNullOrEmpty(RegionalMgrCode))
                {
                    approveUser.RegionalMgrCode = RegionalMgrCode;
                }
                else
                {
                    approveUser.RegionalMgrCode = string.Empty;
                }
                if (!string.IsNullOrEmpty(MDD))
                {
                    approveUser.MDDCode = MDD;
                }
                else
                {
                    approveUser.MDDCode = string.Empty;
                }
                if (!string.IsNullOrEmpty(GM))
                {
                    approveUser.GMCode = GM;
                }
                else
                {
                    approveUser.GMCode = string.Empty;
                }
                if (!string.IsNullOrEmpty(FC))
                {
                    approveUser.FCCode = FC;
                }
                else
                {
                    approveUser.FCCode = string.Empty;
                }
                if (!string.IsNullOrEmpty(RDD))
                {
                    approveUser.RDDCode = RDD;
                }
                else
                {
                    approveUser.RDDCode = string.Empty;
                }

                if (!string.IsNullOrEmpty(VPGM))
                {
                    approveUser.VPGMCode = VPGM;
                }
                else
                {
                    approveUser.VPGMCode = string.Empty;
                }

                if (!string.IsNullOrEmpty(CDO))
                {
                    approveUser.CDOCode = CDO;
                }
                else
                {
                    approveUser.CDOCode = string.Empty;
                }

                if (!string.IsNullOrEmpty(CFO))
                {
                    approveUser.CFOCode = CFO;
                }
                else
                {
                    approveUser.CFOCode = string.Empty;
                }

                if (!string.IsNullOrEmpty(MngDirector))
                {
                    approveUser.MngDirectorCode = MngDirector;
                }
                else
                {
                    approveUser.MngDirectorCode = string.Empty;
                }

                if (!string.IsNullOrEmpty(MCCLAssetMgr))
                {
                    approveUser.MCCLAssetMgrCode = MCCLAssetMgr;
                }
                else
                {
                    approveUser.MCCLAssetMgrCode = string.Empty;
                }
                if (!string.IsNullOrEmpty(MCCLAssetDtr))
                {
                    approveUser.MCCLAssetDtrCode = MCCLAssetDtr;
                }
                else
                {
                    approveUser.MCCLAssetDtrCode = string.Empty;
                }
                if (NoticeUsers != null && NoticeUsers.Count > 0)
                {
                    approveUser.NoticeUsers = string.Join(";", NoticeUsers.Select(e => e.Code).ToArray());
                }
                else
                {
                    approveUser.NoticeUsers = string.Empty;
                }
                if (NecessaryNoticeUsers != null && NecessaryNoticeUsers.Count > 0)
                {
                    approveUser.NecessaryNoticeUsers = string.Join(";", NecessaryNoticeUsers.Select(e => e.Code).ToArray());
                }
                else
                {
                    approveUser.NecessaryNoticeUsers = string.Empty;
                }
                approveUser.LastUpdateDate        = DateTime.Now;
                approveUser.LastUpdateUserAccount = ClientCookie.UserCode;
                approveUser.Save();
                break;
            }
        }
Esempio n. 19
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();
                }
            }
        }
Esempio n. 20
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();
            }
        }