private static string GetReimageInvestmentCost(string rimgProjectId) { string strRturn = ""; var consCk = ReimageConsInvtChecking.GetWorkflowEntity(rimgProjectId, FlowCode.Reimage_ConsInvtChecking); if (consCk != null) { var revensCost = ReinvestmentCost.GetByConsInfoId(consCk.EntityId); if (revensCost != null && !string.IsNullOrEmpty(revensCost.TotalReinvestmentFAAct)) { strRturn = revensCost.TotalReinvestmentFAAct; } } return(strRturn); }
public override void Finish(TaskWorkStatus status, TaskWork task) { using (var scope = new TransactionScope()) { switch (status) { case TaskWorkStatus.K2ProcessApproved: var imgInfo = ReimageInfo.Search(e => e.ProjectId.Equals(ProjectId)).FirstOrDefault(); ProjectInfo.FinishNode(ProjectId, FlowCode.Reimage_GBMemo, NodeCode.Finish, ProjectStatus.Finished); if (IsInOperation) { ProjectInfo.FinishNode(ProjectId, FlowCode.Reimage_ReopenMemo, NodeCode.Finish, ProjectStatus.Finished); ProjectInfo.FinishNode(ProjectId, FlowCode.Reimage_TempClosureMemo, NodeCode.Finish, ProjectStatus.Finished); } else { var taskUrlReopen = string.Format(@"/Reimage/Main#/ReopenMemo?projectId={0}", ProjectId); var taskReopen = imgInfo.GenerateTaskWork(FlowCode.Reimage_ReopenMemo, "Reopen Memo", "Reopen Memo", taskUrlReopen); taskReopen.ActivityName = NodeCode.Start; taskReopen.ActionName = SetTaskActionName(ProjectId); //TaskWork.Add(taskReopen); if (rmgInfo.ReopenDate.HasValue) { ScheduleLog.GenerateTaskSchedule(rmgInfo.ReopenDate.Value.AddDays(-7), taskReopen, ClientCookie.UserCode, ProjectId, FlowCode.Reimage_ReopenMemo, rmgInfo.USCode); } ProjectInfo.Reset(ProjectId, FlowCode.Reimage_ReopenMemo); var taskUrlClosure = string.Format(@"/Reimage/Main#/TempClosureMemo?projectId={0}", ProjectId); var taskClosure = imgInfo.GenerateTaskWork(FlowCode.Reimage_TempClosureMemo, "TempClosure Memo", "TempClosure Memo", taskUrlClosure); taskClosure.ActivityName = NodeCode.Start; taskClosure.ActionName = SetTaskActionName(ProjectId); TaskWork.Add(taskClosure); ProjectInfo.Reset(ProjectId, FlowCode.Reimage_TempClosureMemo); } var consCheckingTask = TaskWork.FirstOrDefault(e => e.RefID == ProjectId && e.TypeCode == FlowCode.Reimage_ConsInvtChecking && e.Status == TaskWorkStatus.UnFinish); var checkingProj = ProjectInfo.FirstOrDefault(e => e.ProjectId == ProjectId && e.FlowCode == FlowCode.Reimage_ConsInvtChecking); if (consCheckingTask == null && checkingProj != null && checkingProj.Status != ProjectStatus.Finished) { var consInvtChecking = new ReimageConsInvtChecking(); consInvtChecking.ProjectId = task.RefID; consInvtChecking.GenerateConsInvtCheckingTask(true); } ProjectInfo.CompleteMainIfEnable(ProjectId); var pmTaskUrl = string.Format(@"/Reimage/Main#/GBMemo/Process/Notify?projectId={0}", ProjectId); var pmTask = imgInfo.GenerateTaskWork(WorkflowCode, "Reimage GBMemo", "Reimage GBMemo", pmTaskUrl); pmTask.ActivityName = "Notify"; pmTask.ActionName = "Notify"; TaskWork.Add(pmTask); GenerateSiteInfoTask(); break; case TaskWorkStatus.K2ProcessDeclined: ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.Reimage, ProjectStatus.Rejected); ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.Reimage_GBMemo, ProjectStatus.Rejected); break; } scope.Complete(); } }
public void Save(bool pushOrNot) { using (TransactionScope tranScope = new TransactionScope()) { var projectInfo = ProjectInfo.Get(Id); if (projectInfo == null) { ProjectId = ProjectInfo.CreateDLProject(Id, FlowCode.Reimage, USCode, NodeCode.Start, ClientCookie.UserCode, pushOrNot); var store = StoreBasicInfo.GetStorInfo(USCode); var reimageInfo = new ReimageInfo(); reimageInfo.Id = Guid.NewGuid(); reimageInfo.ProjectId = ProjectId; reimageInfo.USCode = USCode; reimageInfo.CreateDate = DateTime.Now; reimageInfo.CreateUserAccount = ClientCookie.UserCode; reimageInfo.CreateUserNameENUS = ClientCookie.UserNameENUS; reimageInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN; reimageInfo.AssetRepAccount = ""; reimageInfo.AssetRepNameZHCN = ""; reimageInfo.AssetRepNameENUS = ""; reimageInfo.AssetActorAccount = ""; reimageInfo.AssetActorNameZHCN = ""; reimageInfo.AssetActorNameENUS = ""; reimageInfo.FinanceAccount = ""; reimageInfo.FinanceNameZHCN = ""; reimageInfo.FinanceNameENUS = ""; reimageInfo.PMAccount = ""; reimageInfo.PMNameZHCN = ""; reimageInfo.PMNameENUS = ""; reimageInfo.LegalAccount = ""; reimageInfo.LegalNameZHCN = ""; reimageInfo.LegalNameENUS = ""; reimageInfo.StoreNameENUS = store.NameENUS; reimageInfo.StoreNameZHCN = store.NameZHCN; reimageInfo.GBDate = GBDate; reimageInfo.ReopenDate = ReopenDate; reimageInfo.Add(); var reimageConsInfo = new ReimageConsInfo(); reimageConsInfo.Id = Guid.NewGuid(); reimageConsInfo.ProjectId = ProjectId; reimageConsInfo.IsHistory = false; reimageConsInfo.CreateTime = DateTime.Now; reimageConsInfo.CreateUserAccount = ClientCookie.UserCode; reimageConsInfo.Add(); var reinvestmentBasicInfo = new ReinvestmentBasicInfo(); reinvestmentBasicInfo.ConsInfoID = reimageConsInfo.Id; reinvestmentBasicInfo.RightSizingSeatNo = RightSizingSeatNO; reinvestmentBasicInfo.NewDesignType = AfterReimageDesignType; reinvestmentBasicInfo.Add(); var reimageConsInvtChecking = new ReimageConsInvtChecking(); reimageConsInvtChecking.Id = Guid.NewGuid(); reimageConsInvtChecking.ProjectId = ProjectId; reimageConsInvtChecking.IsHistory = false; reimageConsInvtChecking.CreateTime = DateTime.Now; reimageConsInvtChecking.CreateUserAccount = ClientCookie.UserCode; reimageConsInvtChecking.Add(); var writeOffAmount = new WriteOffAmount(); writeOffAmount.Id = Guid.NewGuid(); writeOffAmount.ConsInfoID = reimageConsInvtChecking.Id; writeOffAmount.TotalWriteOff = Reimage_Total_WO_Proj; writeOffAmount.TotalActual = Reimage_Total_WO_Act; writeOffAmount.Add(); var reinvestmentCost = new ReinvestmentCost(); reinvestmentCost.Id = Guid.NewGuid(); reinvestmentCost.ConsInfoID = reimageConsInvtChecking.Id; reinvestmentCost.TotalReinvestmentBudget = Reimage_Total_Reinvestment_Proj; reinvestmentCost.TotalReinvestmentPMAct = Reimage_Total_Reinvestment_Act; reinvestmentCost.Add(); var reopenMemo = new ReopenMemo(); reopenMemo.Id = Guid.NewGuid(); reopenMemo.ProjectId = ProjectId; reopenMemo.NewMcCafe = false; reopenMemo.NewKiosk = false; reopenMemo.NewMDS = false; reopenMemo.Is24H = false; reopenMemo.AftARSN = AfterReimageSeatNO; reopenMemo.Add(); } else { ProjectId = projectInfo.ProjectId; projectInfo.IsPushed = pushOrNot; projectInfo.Update(); var store = StoreBasicInfo.GetStorInfo(USCode); var reimageInfo = ReimageInfo.FirstOrDefault(i => i.ProjectId == ProjectId); if (reimageInfo != null) { reimageInfo.GBDate = GBDate; reimageInfo.ReopenDate = ReopenDate; reimageInfo.Update(); } else { reimageInfo = new ReimageInfo(); reimageInfo.Id = Guid.NewGuid(); reimageInfo.ProjectId = ProjectId; reimageInfo.USCode = USCode; reimageInfo.CreateDate = DateTime.Now; reimageInfo.CreateUserAccount = ClientCookie.UserCode; reimageInfo.CreateUserNameENUS = ClientCookie.UserNameENUS; reimageInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN; reimageInfo.AssetRepAccount = ""; reimageInfo.AssetRepNameZHCN = ""; reimageInfo.AssetRepNameENUS = ""; reimageInfo.AssetActorAccount = ""; reimageInfo.AssetActorNameZHCN = ""; reimageInfo.AssetActorNameENUS = ""; reimageInfo.FinanceAccount = ""; reimageInfo.FinanceNameZHCN = ""; reimageInfo.FinanceNameENUS = ""; reimageInfo.PMAccount = ""; reimageInfo.PMNameZHCN = ""; reimageInfo.PMNameENUS = ""; reimageInfo.LegalAccount = ""; reimageInfo.LegalNameZHCN = ""; reimageInfo.LegalNameENUS = ""; reimageInfo.StoreNameENUS = store.NameENUS; reimageInfo.StoreNameZHCN = store.NameZHCN; reimageInfo.GBDate = GBDate; reimageInfo.ReopenDate = ReopenDate; reimageInfo.Add(); } var reimageConsInfo = ReimageConsInfo.FirstOrDefault(i => i.ProjectId == ProjectId && i.IsHistory == false); if (reimageConsInfo != null) { var reinvestmentBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(i => i.ConsInfoID == reimageConsInfo.Id); if (reinvestmentBasicInfo != null) { reinvestmentBasicInfo.RightSizingSeatNo = RightSizingSeatNO; reinvestmentBasicInfo.NewDesignType = AfterReimageDesignType; reinvestmentBasicInfo.Update(); } else { reinvestmentBasicInfo = new ReinvestmentBasicInfo(); reinvestmentBasicInfo.ConsInfoID = reimageConsInfo.Id; reinvestmentBasicInfo.RightSizingSeatNo = RightSizingSeatNO; reinvestmentBasicInfo.NewDesignType = AfterReimageDesignType; reinvestmentBasicInfo.Add(); } } else { reimageConsInfo = new ReimageConsInfo(); reimageConsInfo.Id = Guid.NewGuid(); reimageConsInfo.ProjectId = ProjectId; reimageConsInfo.IsHistory = false; reimageConsInfo.CreateTime = DateTime.Now; reimageConsInfo.CreateUserAccount = ClientCookie.UserCode; reimageConsInfo.Add(); var reinvestmentBasicInfo = new ReinvestmentBasicInfo(); reinvestmentBasicInfo.ConsInfoID = reimageConsInfo.Id; reinvestmentBasicInfo.RightSizingSeatNo = RightSizingSeatNO; reinvestmentBasicInfo.NewDesignType = AfterReimageDesignType; reinvestmentBasicInfo.Add(); } var reimageConsInvtChecking = ReimageConsInvtChecking.FirstOrDefault(i => i.ProjectId == ProjectId && i.IsHistory == false); if (reimageConsInvtChecking != null) { var writeOffAmount = WriteOffAmount.FirstOrDefault(i => i.ConsInfoID == reimageConsInvtChecking.Id); if (writeOffAmount != null) { writeOffAmount.TotalWriteOff = Reimage_Total_WO_Proj; writeOffAmount.TotalActual = Reimage_Total_WO_Act; writeOffAmount.Update(); } else { writeOffAmount = new WriteOffAmount(); writeOffAmount.Id = Guid.NewGuid(); writeOffAmount.ConsInfoID = reimageConsInvtChecking.Id; writeOffAmount.TotalWriteOff = Reimage_Total_WO_Proj; writeOffAmount.TotalActual = Reimage_Total_WO_Act; writeOffAmount.Add(); } var reinvestmentCost = ReinvestmentCost.FirstOrDefault(i => i.ConsInfoID == reimageConsInvtChecking.Id); if (reinvestmentCost != null) { reinvestmentCost.TotalReinvestmentBudget = Reimage_Total_Reinvestment_Proj; reinvestmentCost.TotalReinvestmentPMAct = Reimage_Total_Reinvestment_Act; reinvestmentCost.Update(); } else { reinvestmentCost = new ReinvestmentCost(); reinvestmentCost.Id = Guid.NewGuid(); reinvestmentCost.ConsInfoID = reimageConsInvtChecking.Id; reinvestmentCost.TotalReinvestmentBudget = Reimage_Total_Reinvestment_Proj; reinvestmentCost.TotalReinvestmentPMAct = Reimage_Total_Reinvestment_Act; reinvestmentCost.Add(); } } else { reimageConsInvtChecking = new ReimageConsInvtChecking(); reimageConsInvtChecking.Id = Guid.NewGuid(); reimageConsInvtChecking.ProjectId = ProjectId; reimageConsInvtChecking.IsHistory = false; reimageConsInvtChecking.CreateTime = DateTime.Now; reimageConsInvtChecking.CreateUserAccount = ClientCookie.UserCode; reimageConsInvtChecking.Add(); var writeOffAmount = new WriteOffAmount(); writeOffAmount.Id = Guid.NewGuid(); writeOffAmount.ConsInfoID = reimageConsInvtChecking.Id; writeOffAmount.TotalWriteOff = Reimage_Total_WO_Proj; writeOffAmount.TotalActual = Reimage_Total_WO_Act; writeOffAmount.Add(); var reinvestmentCost = new ReinvestmentCost(); reinvestmentCost.Id = Guid.NewGuid(); reinvestmentCost.ConsInfoID = reimageConsInvtChecking.Id; reinvestmentCost.TotalReinvestmentBudget = Reimage_Total_Reinvestment_Proj; reinvestmentCost.TotalReinvestmentPMAct = Reimage_Total_Reinvestment_Act; reinvestmentCost.Add(); } var reopenMemo = ReopenMemo.FirstOrDefault(i => i.ProjectId == ProjectId); if (reopenMemo != null) { reopenMemo.AftARSN = AfterReimageSeatNO; reopenMemo.Update(); } else { reopenMemo = new ReopenMemo(); reopenMemo.Id = Guid.NewGuid(); reopenMemo.ProjectId = ProjectId; reopenMemo.NewMcCafe = false; reopenMemo.NewKiosk = false; reopenMemo.NewMDS = false; reopenMemo.Is24H = false; reopenMemo.AftARSN = AfterReimageSeatNO; reopenMemo.Add(); } } tranScope.Complete(); } }