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(); } }
public static void Create(PostCreateWorkflow <RenewalInfo> postCreateRenewal) { using (TransactionScope tranScope = new TransactionScope()) { var usCode = postCreateRenewal.Entity.USCode; var store = StoreBasicInfo.GetStorInfo(usCode); var projectId = ProjectInfo.CreateMainProject(FlowCode.Renewal, usCode, NodeCode.Start, ClientCookie.UserCode); postCreateRenewal.Entity.Id = Guid.NewGuid(); postCreateRenewal.Entity.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Entity.CreateTime = DateTime.Now; postCreateRenewal.Entity.StoreNameENUS = store.NameENUS; postCreateRenewal.Entity.StoreNameZHCN = store.NameZHCN; postCreateRenewal.Entity.AssetRepAccount = postCreateRenewal.Team.AssetRep.UserAccount; postCreateRenewal.Entity.AssetRepNameENUS = postCreateRenewal.Team.AssetRep.UserNameENUS; postCreateRenewal.Entity.AssetRepNameZHCN = postCreateRenewal.Team.AssetRep.UserNameZHCN; postCreateRenewal.Entity.AssetActorAccount = postCreateRenewal.Team.AssetActor.UserAccount; postCreateRenewal.Entity.AssetActorNameENUS = postCreateRenewal.Team.AssetActor.UserNameENUS; postCreateRenewal.Entity.AssetActorNameZHCN = postCreateRenewal.Team.AssetActor.UserNameZHCN; postCreateRenewal.Entity.FinanceAccount = postCreateRenewal.Team.Finance.UserAccount; postCreateRenewal.Entity.FinanceNameENUS = postCreateRenewal.Team.Finance.UserNameENUS; postCreateRenewal.Entity.FinanceNameZHCN = postCreateRenewal.Team.Finance.UserNameZHCN; postCreateRenewal.Entity.PMAccount = postCreateRenewal.Team.PM.UserAccount; postCreateRenewal.Entity.PMNameENUS = postCreateRenewal.Team.PM.UserNameENUS; postCreateRenewal.Entity.PMNameZHCN = postCreateRenewal.Team.PM.UserNameZHCN; postCreateRenewal.Entity.LegalAccount = postCreateRenewal.Team.Legal.UserAccount; postCreateRenewal.Entity.LegalNameENUS = postCreateRenewal.Team.Legal.UserNameENUS; postCreateRenewal.Entity.LegalNameZHCN = postCreateRenewal.Team.Legal.UserNameZHCN; postCreateRenewal.Entity.AssetManagerAccount = postCreateRenewal.Team.AssetMgr.UserAccount; postCreateRenewal.Entity.AssetManagerNameENUS = postCreateRenewal.Team.AssetMgr.UserNameENUS; postCreateRenewal.Entity.AssetManagerNameZHCN = postCreateRenewal.Team.AssetMgr.UserNameZHCN; postCreateRenewal.Entity.CMAccount = postCreateRenewal.Team.CM.UserAccount; postCreateRenewal.Entity.CMNameENUS = postCreateRenewal.Team.CM.UserNameENUS; postCreateRenewal.Entity.CMNameZHCN = postCreateRenewal.Team.CM.UserNameZHCN; postCreateRenewal.Entity.ProjectId = projectId; postCreateRenewal.Entity.Add(); ProjectInfo.CreateSubProject(FlowCode.Renewal_Letter, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalLetter.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_LLNegotiation, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalLLNegotiation.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_ConsInfo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.PM.UserAccount); RenewalConsInfo.Create(projectId, postCreateRenewal.Team.PM.UserAccount, postCreateRenewal.Entity.NeedProjectCostEst); ProjectInfo.CreateSubProject(FlowCode.Renewal_Tool, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.Finance.UserAccount); var tool = RenewalTool.Create(projectId, postCreateRenewal.Team.Finance.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_ClearanceReport, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalClearanceReport.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_ConfirmLetter, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalConfirmLetter.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_Analysis, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); var analysis = RenewalAnalysis.Create(postCreateRenewal.Entity); ProjectInfo.CreateSubProject(FlowCode.Renewal_LegalApproval, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalLegalApproval.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_Package, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalPackage.Create(projectId, postCreateRenewal.Team.AssetActor.UserAccount, analysis.Id, tool.Id); ProjectInfo.CreateSubProject(FlowCode.Renewal_ContractInfo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.AssetActor.UserAccount); RenewalContractInfo.Create(projectId); ProjectInfo.CreateSubProject(FlowCode.Renewal_SiteInfo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.PM.UserAccount); RenewalSiteInfo.Create(projectId, postCreateRenewal.Team.PM.UserAccount); ProjectInfo.CreateSubProject(FlowCode.Renewal_GBMemo, projectId, usCode, NodeCode.Start, postCreateRenewal.Team.PM.UserAccount); List <ProjectUsers> projectUsers = new List <ProjectUsers>(); postCreateRenewal.Team.AssetRep.Id = Guid.NewGuid(); postCreateRenewal.Team.AssetRep.ProjectId = projectId; postCreateRenewal.Team.AssetRep.CreateDate = DateTime.Now; postCreateRenewal.Team.AssetRep.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.AssetRep.RoleCode = ProjectUserRoleCode.AssetRep; postCreateRenewal.Team.AssetRep.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetRep, SystemLanguage.ENUS); postCreateRenewal.Team.AssetRep.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetRep, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.AssetRep); postCreateRenewal.Team.AssetActor.Id = Guid.NewGuid(); postCreateRenewal.Team.AssetActor.ProjectId = projectId; postCreateRenewal.Team.AssetActor.CreateDate = DateTime.Now; postCreateRenewal.Team.AssetActor.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.AssetActor.RoleCode = ProjectUserRoleCode.AssetActor; postCreateRenewal.Team.AssetActor.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetActor, SystemLanguage.ENUS); postCreateRenewal.Team.AssetActor.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetActor, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.AssetActor); postCreateRenewal.Team.Finance.Id = Guid.NewGuid(); postCreateRenewal.Team.Finance.ProjectId = projectId; postCreateRenewal.Team.Finance.CreateDate = DateTime.Now; postCreateRenewal.Team.Finance.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.Finance.RoleCode = ProjectUserRoleCode.Finance; postCreateRenewal.Team.Finance.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Finance, SystemLanguage.ENUS); postCreateRenewal.Team.Finance.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Finance, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.Finance); postCreateRenewal.Team.PM.Id = Guid.NewGuid(); postCreateRenewal.Team.PM.ProjectId = projectId; postCreateRenewal.Team.PM.CreateDate = DateTime.Now; postCreateRenewal.Team.PM.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.PM.RoleCode = ProjectUserRoleCode.PM; postCreateRenewal.Team.PM.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.PM, SystemLanguage.ENUS); postCreateRenewal.Team.PM.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.PM, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.PM); postCreateRenewal.Team.Legal.Id = Guid.NewGuid(); postCreateRenewal.Team.Legal.ProjectId = projectId; postCreateRenewal.Team.Legal.CreateDate = DateTime.Now; postCreateRenewal.Team.Legal.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.Legal.RoleCode = ProjectUserRoleCode.Legal; postCreateRenewal.Team.Legal.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Legal, SystemLanguage.ENUS); postCreateRenewal.Team.Legal.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.Legal, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.Legal); postCreateRenewal.Team.AssetMgr.Id = Guid.NewGuid(); postCreateRenewal.Team.AssetMgr.ProjectId = projectId; postCreateRenewal.Team.AssetMgr.CreateDate = DateTime.Now; postCreateRenewal.Team.AssetMgr.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.AssetMgr.RoleCode = ProjectUserRoleCode.AssetManager; postCreateRenewal.Team.AssetMgr.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetManager, SystemLanguage.ENUS); postCreateRenewal.Team.AssetMgr.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.AssetManager, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.AssetMgr); postCreateRenewal.Team.CM.Id = Guid.NewGuid(); postCreateRenewal.Team.CM.ProjectId = projectId; postCreateRenewal.Team.CM.CreateDate = DateTime.Now; postCreateRenewal.Team.CM.CreateUserAccount = ClientCookie.UserCode; postCreateRenewal.Team.CM.RoleCode = ProjectUserRoleCode.CM; postCreateRenewal.Team.CM.RoleNameENUS = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.CM, SystemLanguage.ENUS); postCreateRenewal.Team.CM.RoleNameZHCN = SystemCode.Instance.GetCodeName(ProjectUserRoleCode.CM, SystemLanguage.ZHCN); projectUsers.Add(postCreateRenewal.Team.CM); ProjectUsers.Add(projectUsers.ToArray()); postCreateRenewal.Viewers.ForEach(v => { v.Id = Guid.NewGuid(); v.ProjectId = projectId; v.CreateDate = DateTime.Now; v.CreateUserAccount = ClientCookie.UserCode; v.RoleCode = ProjectUserRoleCode.View; }); ProjectUsers.Add(postCreateRenewal.Viewers.ToArray()); //postCreateRenewal.NecessaryViewers.ForEach(v => //{ // v.Id = Guid.NewGuid(); // v.ProjectId = projectId; // v.CreateDate = DateTime.Now; // v.CreateUserAccount = ClientCookie.UserCode; // v.RoleCode = ProjectUserRoleCode.View; //}); //ProjectUsers.Add(postCreateRenewal.NecessaryViewers.ToArray()); Remind.SendRemind(projectId, FlowCode.Renewal, projectUsers); Remind.SendRemind(projectId, FlowCode.Renewal, postCreateRenewal.Viewers); postCreateRenewal.Entity.GenerateSubmitTask(FlowCode.Renewal_Letter); postCreateRenewal.Entity.GenerateSubmitTask(FlowCode.Renewal_LLNegotiation); postCreateRenewal.Entity.CreateAttachmentsMemo(); ProjectNode.GenerateOnCreate(FlowCode.Renewal, projectId); ProjectProgress.SetProgress(projectId, "10%"); tranScope.Complete(); } }