Example #1
0
        public override string Edit()
        {
            var taskWork = TaskWork.FirstOrDefault(e => e.ReceiverAccount == ClientCookie.UserCode && e.SourceCode == FlowCode.Closure && e.TypeCode == FlowCode.Closure_ExecutiveSummary && e.RefID == this.ProjectId);


            taskWork.Status         = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN = "任务";
            taskWork.StatusNameENUS = "任务";

            var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId);

            taskWork.ReceiverAccount  = closureEntity.AssetActorAccount;
            taskWork.ReceiverNameENUS = closureEntity.AssetActorNameENUS;
            taskWork.ReceiverNameZHCN = closureEntity.AssetActorNameZHCN;
            taskWork.Id           = Guid.NewGuid();
            taskWork.CreateTime   = DateTime.Now;
            taskWork.Url          = TaskWork.BuildUrl(FlowCode.Closure_ExecutiveSummary, this.ProjectId, "");
            taskWork.ActivityName = NodeCode.Start;
            taskWork.ProcInstID   = null;
            taskWork.FinishTime   = null;
            taskWork.ActionName   = SetTaskActionName(ProjectId);
            TaskWork.Add(taskWork);

            this.IsHistory = true;

            this.Save();

            var objectCopy = new ObjectCopy();
            var newEntity  = objectCopy.AutoCopy(this);

            newEntity.Id         = Guid.NewGuid();
            newEntity.ProcInstID = 0;
            newEntity.IsHistory  = false;
            newEntity.Add();

            var projectEntity = ProjectInfo.Get(this.ProjectId, FlowCode.Closure_ExecutiveSummary);

            projectEntity.Status = ProjectStatus.UnFinish;

            ProjectInfo.Update(projectEntity);
            ProjectInfo.Reset(ProjectId, FlowCode.Closure_ExecutiveSummary);
            ProjectInfo.Reset(ProjectId, FlowCode.Closure);
            var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() && e.RefTableName == ClosureExecutiveSummary.TableName).AsNoTracking().ToList();

            var newList = new List <Attachment>();

            foreach (var att in attList)
            {
                var newAtt = objectCopy.AutoCopy(att);
                newAtt.RefTableID = newEntity.Id.ToString();
                newAtt.ID         = Guid.NewGuid();
                newList.Add(newAtt);
            }
            Attachment.Add(newList.ToArray());
            return(taskWork.Url);
        }
Example #2
0
        public TaskWork GenerateSubmitTask(string flowCode)
        {
            TaskWork.Cancel(t => t.TypeCode == flowCode && t.ActivityName == "Start" && t.RefID == this.ProjectId);
            TaskWork taskWork = new TaskWork();
            var      url      = TaskWork.BuildUrl(flowCode, this.ProjectId);

            switch (flowCode)
            {
            case FlowCode.Renewal_Letter:
                taskWork = GenerateTask(flowCode, url, AssetActorAccount, AssetActorNameENUS, AssetActorNameZHCN, "Start");
                break;

            case FlowCode.Renewal_LLNegotiation:
                taskWork = GenerateTask(flowCode, url, AssetActorAccount, AssetActorNameENUS, AssetActorNameZHCN, "Start");
                break;

            case FlowCode.Renewal_ConsInfo:
                taskWork = GenerateTask(flowCode, url, PMAccount, PMNameENUS, PMNameZHCN, "Start");
                break;

            case FlowCode.Renewal_Tool:
                taskWork = GenerateTask(flowCode, url, FinanceAccount, FinanceNameENUS, FinanceNameZHCN, "Start");
                break;

            case FlowCode.Renewal_Analysis:
                taskWork = GenerateTask(flowCode, url, AssetActorAccount, AssetActorNameENUS, AssetActorNameZHCN, "Start");
                break;

            case FlowCode.Renewal_ClearanceReport:
                taskWork = GenerateTask(flowCode, url, AssetActorAccount, AssetActorNameENUS, AssetActorNameZHCN, "Start");
                break;

            case FlowCode.Renewal_ConfirmLetter:
                taskWork = GenerateTask(flowCode, url, AssetActorAccount, AssetActorNameENUS, AssetActorNameZHCN, "Start");
                break;

            case FlowCode.Renewal_LegalApproval:
                taskWork = GenerateTask(flowCode, url, AssetActorAccount, AssetActorNameENUS, AssetActorNameZHCN, "Start");
                break;

            case FlowCode.Renewal_Package:
                taskWork = GenerateTask(flowCode, url, AssetActorAccount, AssetActorNameENUS, AssetActorNameZHCN, "Start");
                break;

            case FlowCode.Renewal_ContractInfo:
                taskWork = GenerateTask(flowCode, url, AssetActorAccount, AssetActorNameENUS, AssetActorNameZHCN, "Start");
                break;

            case FlowCode.Renewal_SiteInfo:
                taskWork = GenerateTask(flowCode, url, PMAccount, PMNameENUS, PMNameZHCN, "Start");
                break;
            }
            return(taskWork);
        }
Example #3
0
        public override string Edit()
        {
            if (!PreEdit(this.ProjectId))
            {
                return("");
            }
            var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId);
            var store         = StoreBasicInfo.GetStorInfo(closureEntity.USCode);
            var taskWork      = new TaskWork();
            var source        = FlowInfo.Get(FlowCode.Closure);
            var taskType      = FlowInfo.Get(FlowCode.Closure_WOCheckList);

            taskWork.SourceCode     = source.Code;
            taskWork.SourceNameZHCN = source.NameZHCN;
            taskWork.SourceNameENUS = source.NameENUS;
            taskWork.Status         = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN = "任务";
            taskWork.StatusNameENUS = "任务";
            taskWork.Title          = TaskWork.BuildTitle(this.ProjectId, store.NameZHCN, store.NameENUS);
            taskWork.RefID          = this.ProjectId;
            taskWork.StoreCode      = closureEntity.USCode;

            taskWork.TypeCode         = taskType.Code;
            taskWork.TypeNameENUS     = taskType.NameENUS;
            taskWork.TypeNameZHCN     = taskType.NameZHCN;
            taskWork.ReceiverAccount  = closureEntity.PMAccount;
            taskWork.ReceiverNameENUS = closureEntity.PMNameENUS;
            taskWork.ReceiverNameZHCN = closureEntity.PMNameZHCN;
            taskWork.Id           = Guid.NewGuid();
            taskWork.CreateTime   = DateTime.Now;
            taskWork.Url          = TaskWork.BuildUrl(FlowCode.Closure_WOCheckList, this.ProjectId, "");
            taskWork.ActivityName = NodeCode.Start;
            TaskWork.Add(taskWork);

            this.IsHistory          = true;
            this.RefreshClosureTool = false;
            //TaskWork.SetTaskHistory(this.Id, this.ProcInstID);

            this.Save();
            var objectCopy = new ObjectCopy();
            var newWo      = objectCopy.AutoCopy(this);

            newWo.Id         = Guid.NewGuid();
            newWo.ProcInstID = 0;
            newWo.Save();

            var projectEntity = ProjectInfo.Get(this.ProjectId, FlowCode.Closure_WOCheckList);

            ProjectInfo.UnFinishNode(this.ProjectId, FlowCode.Closure_WOCheckList, NodeCode.Closure_WOCheckList_Approve, ProjectStatus.UnFinish);
            var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() &&
                                            e.RefTableName == ClosureWOCheckList.TableName);
            var objCopy = new ObjectCopy();
            var newList = new List <Attachment>();

            foreach (var att in attList)
            {
                var newAtt = objCopy.AutoCopy(att);
                newAtt.RefTableID = newWo.Id.ToString();
                newAtt.ID         = Guid.NewGuid();
                newList.Add(newAtt);
            }
            Attachment.AddList(newList);
            return(taskWork.Url);
        }
Example #4
0
        public static void Create(PostCreateWorkflow <TempClosureInfo> tempClosure)
        {
            using (TransactionScope tranScope = new TransactionScope())
            {
                var store = StoreBasicInfo.GetStorInfo(tempClosure.Entity.USCode);
                tempClosure.Entity.Id = Guid.NewGuid();
                tempClosure.Entity.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Entity.CreateTime        = DateTime.Now;

                tempClosure.Entity.StoreNameENUS = store.NameENUS;
                tempClosure.Entity.StoreNameZHCN = store.NameZHCN;

                tempClosure.Entity.AssetRepAccount  = tempClosure.Team.AssetRep.UserAccount;
                tempClosure.Entity.AssetRepNameENUS = tempClosure.Team.AssetRep.UserNameENUS;
                tempClosure.Entity.AssetRepNameZHCN = tempClosure.Team.AssetRep.UserNameZHCN;

                tempClosure.Entity.AssetActorAccount  = tempClosure.Team.AssetActor.UserAccount;
                tempClosure.Entity.AssetActorNameENUS = tempClosure.Team.AssetActor.UserNameENUS;
                tempClosure.Entity.AssetActorNameZHCN = tempClosure.Team.AssetActor.UserNameZHCN;

                tempClosure.Entity.FinanceAccount  = tempClosure.Team.Finance.UserAccount;
                tempClosure.Entity.FinanceNameENUS = tempClosure.Team.Finance.UserNameENUS;
                tempClosure.Entity.FinanceNameZHCN = tempClosure.Team.Finance.UserNameZHCN;

                tempClosure.Entity.PMAccount  = tempClosure.Team.PM.UserAccount;
                tempClosure.Entity.PMNameENUS = tempClosure.Team.PM.UserNameENUS;
                tempClosure.Entity.PMNameZHCN = tempClosure.Team.PM.UserNameZHCN;

                tempClosure.Entity.LegalAccount  = tempClosure.Team.Legal.UserAccount;
                tempClosure.Entity.LegalNameENUS = tempClosure.Team.Legal.UserNameENUS;
                tempClosure.Entity.LegalNameZHCN = tempClosure.Team.Legal.UserNameZHCN;

                tempClosure.Entity.AssetManagerAccount  = tempClosure.Team.AssetMgr.UserAccount;
                tempClosure.Entity.AssetManagerNameENUS = tempClosure.Team.AssetMgr.UserNameENUS;
                tempClosure.Entity.AssetManagerNameZHCN = tempClosure.Team.AssetMgr.UserNameZHCN;

                tempClosure.Entity.CMAccount  = tempClosure.Team.CM.UserAccount;
                tempClosure.Entity.CMNameENUS = tempClosure.Team.CM.UserNameENUS;
                tempClosure.Entity.CMNameZHCN = tempClosure.Team.CM.UserNameZHCN;

                var projectId = ProjectInfo.CreateMainProject(FlowCode.TempClosure, tempClosure.Entity.USCode, NodeCode.Start, tempClosure.Entity.CreateUserAccount);
                tempClosure.Entity.ProjectId = projectId;
                Add(tempClosure.Entity);

                List <ProjectUsers> projectUsers = new List <ProjectUsers>();

                tempClosure.Team.AssetRep.Id                = Guid.NewGuid();
                tempClosure.Team.AssetRep.ProjectId         = projectId;
                tempClosure.Team.AssetRep.CreateDate        = DateTime.Now;
                tempClosure.Team.AssetRep.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.AssetRep.RoleCode          = ProjectUserRoleCode.AssetRep;
                tempClosure.Team.AssetRep.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetRep, SystemLanguage.ENUS);
                tempClosure.Team.AssetRep.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetRep, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.AssetRep);

                tempClosure.Team.AssetActor.Id                = Guid.NewGuid();
                tempClosure.Team.AssetActor.ProjectId         = projectId;
                tempClosure.Team.AssetActor.CreateDate        = DateTime.Now;
                tempClosure.Team.AssetActor.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.AssetActor.RoleCode          = ProjectUserRoleCode.AssetActor;
                tempClosure.Team.AssetActor.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetActor, SystemLanguage.ENUS);
                tempClosure.Team.AssetActor.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetActor, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.AssetActor);

                tempClosure.Team.Finance.Id                = Guid.NewGuid();
                tempClosure.Team.Finance.ProjectId         = projectId;
                tempClosure.Team.Finance.CreateDate        = DateTime.Now;
                tempClosure.Team.Finance.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.Finance.RoleCode          = ProjectUserRoleCode.Finance;
                tempClosure.Team.Finance.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Finance, SystemLanguage.ENUS);
                tempClosure.Team.Finance.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Finance, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.Finance);

                tempClosure.Team.PM.Id                = Guid.NewGuid();
                tempClosure.Team.PM.ProjectId         = projectId;
                tempClosure.Team.PM.CreateDate        = DateTime.Now;
                tempClosure.Team.PM.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.PM.RoleCode          = ProjectUserRoleCode.PM;
                tempClosure.Team.PM.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.PM, SystemLanguage.ENUS);
                tempClosure.Team.PM.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.PM, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.PM);

                tempClosure.Team.Legal.Id                = Guid.NewGuid();
                tempClosure.Team.Legal.ProjectId         = projectId;
                tempClosure.Team.Legal.CreateDate        = DateTime.Now;
                tempClosure.Team.Legal.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.Legal.RoleCode          = ProjectUserRoleCode.Legal;
                tempClosure.Team.Legal.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Legal, SystemLanguage.ENUS);
                tempClosure.Team.Legal.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Legal, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.Legal);

                tempClosure.Team.AssetMgr.Id                = Guid.NewGuid();
                tempClosure.Team.AssetMgr.ProjectId         = projectId;
                tempClosure.Team.AssetMgr.CreateDate        = DateTime.Now;
                tempClosure.Team.AssetMgr.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.AssetMgr.RoleCode          = ProjectUserRoleCode.AssetManager;
                tempClosure.Team.AssetMgr.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetManager, SystemLanguage.ENUS);
                tempClosure.Team.AssetMgr.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetManager, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.AssetMgr);

                tempClosure.Team.CM.Id                = Guid.NewGuid();
                tempClosure.Team.CM.ProjectId         = projectId;
                tempClosure.Team.CM.CreateDate        = DateTime.Now;
                tempClosure.Team.CM.CreateUserAccount = ClientCookie.UserCode;
                tempClosure.Team.CM.RoleCode          = ProjectUserRoleCode.CM;
                tempClosure.Team.CM.RoleNameENUS      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.CM, SystemLanguage.ENUS);
                tempClosure.Team.CM.RoleNameZHCN      = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.CM, SystemLanguage.ZHCN);
                projectUsers.Add(tempClosure.Team.CM);
                ProjectUsers.Add(projectUsers.ToArray());

                tempClosure.Viewers.ForEach(v =>
                {
                    v.Id                = Guid.NewGuid();
                    v.ProjectId         = projectId;
                    v.CreateDate        = DateTime.Now;
                    v.CreateUserAccount = ClientCookie.UserCode;
                    v.RoleCode          = ProjectUserRoleCode.View;
                });
                ProjectUsers.Add(tempClosure.Viewers.ToArray());
                //tempClosure.NecessaryViewers.ForEach(v =>
                //{
                //    v.Id = Guid.NewGuid();
                //    v.ProjectId = projectId;
                //    v.CreateDate = DateTime.Now;
                //    v.CreateUserAccount = ClientCookie.UserCode;
                //    v.RoleCode = ProjectUserRoleCode.View;
                //});
                //ProjectUsers.Add(tempClosure.NecessaryViewers.ToArray());

                Remind.SendRemind(projectId, FlowCode.TempClosure, projectUsers);
                ProjectInfo.CreateSubProject(FlowCode.TempClosure_LegalReview, projectId, tempClosure.Entity.USCode, NodeCode.Start, ClientCookie.UserCode);
                TempClosureLegalReview.Create(projectId);
                ProjectInfo.CreateSubProject(FlowCode.TempClosure_ClosurePackage, projectId, tempClosure.Entity.USCode, NodeCode.Start, ClientCookie.UserCode);
                TempClosurePackage.Create(projectId);
                ProjectInfo.CreateSubProject(FlowCode.TempClosure_ClosureMemo, projectId, tempClosure.Entity.USCode, NodeCode.Start, ClientCookie.UserCode);
                ProjectInfo.CreateSubProject(FlowCode.TempClosure_ReopenMemo, projectId, tempClosure.Entity.USCode, NodeCode.Start, ClientCookie.UserCode);

                string taskUrl = TaskWork.BuildUrl(FlowCode.TempClosure_LegalReview, projectId, "");
                string title   = TaskWork.BuildTitle(projectId, store.NameZHCN, store.NameENUS);
                TaskWork.SendTask(projectId, title, store.StoreCode, taskUrl, tempClosure.Team.AssetActor, FlowCode.TempClosure, FlowCode.TempClosure_LegalReview, "Start");
                ProjectNode.GenerateOnCreate(FlowCode.TempClosure, projectId);
                tranScope.Complete();
            }
        }
Example #5
0
        public TaskWork GenerateToolUploadTask()
        {
            var url = TaskWork.BuildUrl(FlowCode.Renewal_Tool, this.ProjectId, "/Process/View");

            return(GenerateTask(FlowCode.Renewal_Tool, url, AssetActorAccount, AssetActorNameENUS, AssetActorNameZHCN, "Start"));
        }
Example #6
0
        public override string Edit()
        {
            if (!PreEdit(this.ProjectId))
            {
                return("");
            }
            var closureEntity = ClosureInfo.GetByProjectId(this.ProjectId);
            var store         = StoreBasicInfo.GetStorInfo(closureEntity.USCode);
            var taskWork      = new TaskWork();
            var source        = FlowInfo.Get(FlowCode.Closure);
            var taskType      = FlowInfo.Get(FlowCode.Closure_ClosureTool);

            taskWork.SourceCode     = source.Code;
            taskWork.SourceNameZHCN = source.NameZHCN;
            taskWork.SourceNameENUS = source.NameENUS;
            taskWork.Status         = TaskWorkStatus.UnFinish;
            taskWork.StatusNameZHCN = "任务";
            taskWork.StatusNameENUS = "任务";
            taskWork.Title          = TaskWork.BuildTitle(this.ProjectId, store.NameZHCN, store.NameENUS);
            taskWork.RefID          = this.ProjectId;
            taskWork.StoreCode      = closureEntity.USCode;

            taskWork.TypeCode         = taskType.Code;
            taskWork.TypeNameENUS     = taskType.NameENUS;
            taskWork.TypeNameZHCN     = taskType.NameZHCN;
            taskWork.ReceiverAccount  = closureEntity.FinanceAccount;
            taskWork.ReceiverNameENUS = closureEntity.FinanceNameENUS;
            taskWork.ReceiverNameZHCN = closureEntity.FinanceNameZHCN;
            taskWork.Id           = Guid.NewGuid();
            taskWork.CreateTime   = DateTime.Now;
            taskWork.ActivityName = NodeCode.Start;
            taskWork.ActionName   = SetTaskActionName(ProjectId);
            taskWork.Url          = TaskWork.BuildUrl(FlowCode.Closure_ClosureTool, this.ProjectId, "");
            TaskWork.Add(taskWork);

            this.IsHistory = true;
            TaskWork.SetTaskHistory(this.Id, this.ProcInstID);
            this.Save();

            var objectCopy = new ObjectCopy();
            var newEntity  = objectCopy.AutoCopy(this);

            newEntity.Id         = Guid.NewGuid();
            newEntity.ProcInstID = 0;
            newEntity.IsHistory  = false;
            newEntity.Save();

            //复制ImpactOtherStore信息
            var impactOtherStores = ClosureToolImpactOtherStore.Search(i => i.ClosureId == this.Id).AsNoTracking().ToArray();

            if (impactOtherStores.Length > 0)
            {
                foreach (var impactItem in impactOtherStores)
                {
                    impactItem.Id        = Guid.NewGuid();
                    impactItem.ClosureId = newEntity.Id;
                }
                ClosureToolImpactOtherStore.Add(impactOtherStores);
            }

            ProjectInfo.Reset(this.ProjectId, FlowCode.Closure_ClosureTool);

            var attList = Attachment.Search(e => e.RefTableID == this.Id.ToString() &&
                                            e.RefTableName == ClosureTool.TableName).AsNoTracking().ToList();

            var newList = new List <Attachment>();

            foreach (var att in attList)
            {
                var newAtt = objCopy.AutoCopy(att);
                newAtt.RefTableID = newEntity.Id.ToString();
                newAtt.ID         = Guid.NewGuid();
                newList.Add(newAtt);
            }
            Attachment.AddList(newList);
            return(taskWork.Url);
        }