public static RenewalPackageDTO InitPage(string projectId, string id = null) { RenewalPackageDTO dto = new RenewalPackageDTO(); var entity = RenewalPackage.Get(projectId, id); var project = ProjectInfo.Get(projectId, FlowCode.Renewal_Package); var info = RenewalInfo.Get(projectId); entity.IsProjectFreezed = entity.CheckIfFreezeProject(projectId); entity.GenerateCover(); var haveTask = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Package && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode); var projectComment = ProjectComment.GetSavedComment(entity.Id, "RenewalPackage", ClientCookie.UserCode); var projectNode = NodeInfo.GetNodeInfo(project.NodeCode); dto.Info = info; dto.Entity = entity; dto.Analysis = RenewalAnalysis.Get(entity.AnalysisId.Value); dto.FinMeasureOutput = RenewalToolFinMeasureOutput.GetByToolId(entity.ToolId.Value); dto.Uploadable = projectNode.Sequence >= 4 && ClientCookie.UserCode == dto.Info.AssetActorAccount; var editStatuses = new[] { ProjectStatus.Finished, ProjectStatus.Rejected }; dto.ProjectComment = projectComment != null ? projectComment.Content : ""; dto.Editable = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_Package); dto.Recallable = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_Package); dto.Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_Package) && string.IsNullOrEmpty(id); if (entity.ProcInstId.HasValue) { var currentActivityName = K2FxContext.Current.GetCurrentActivityName(entity.ProcInstId.Value); dto.Rejectable = !entity.WorkflowNormalActors.Contains(currentActivityName); } dto.IsLindaLu = string.Compare(ClientCookie.UserCode, ConfigurationManager.AppSettings["AssetMgrCode"], true) == 0; return(dto); }
public static ConsInfoDTO <RenewalInfo, RenewalConsInfo> InitPage(string projectId, string id = "") { RenewalInfo info = RenewalInfo.Get(projectId); var consInfo = RenewalConsInfo.Get(projectId, id); if (consInfo == null) { consInfo = new RenewalConsInfo(); consInfo.ProjectId = projectId; } var isOriginator = ClientCookie.UserCode == info.PMAccount; consInfo.IsProjectFreezed = consInfo.CheckIfFreezeProject(projectId); var nextRefTableId = new Guid(FlowInfo.GetRefTableId("RenewalTool", projectId)); var nextFlowStarted = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Tool); var haveTask = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Tool && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode); var projectComment = ProjectComment.GetSavedComment(consInfo.Id, "RenewalConsInfo", ClientCookie.UserCode); if (string.IsNullOrEmpty(id)) { consInfo.HasReinvenstment = info.NeedProjectCostEst; } ConsInfoDTO <RenewalInfo, RenewalConsInfo> dto = new ConsInfoDTO <RenewalInfo, RenewalConsInfo>(); dto.Entity = consInfo; dto.Info = info; dto.ReinBasicInfo = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id); dto.ReinCost = ReinvestmentCost.GetByConsInfoId(consInfo.Id); dto.WriteOff = WriteOffAmount.GetByConsInfoId(consInfo.Id); dto.ProjectComment = projectComment != null ? projectComment.Content : ""; dto.Editable = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_ConsInfo); dto.Recallable = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_ConsInfo); dto.Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_ConsInfo) && string.IsNullOrEmpty(id); return(dto); }
public MajorLeaseFinancAnalysis GetFinanceInfo(string strProjectId, string entityId = "") { MajorLeaseFinancAnalysis entity = null; if (string.IsNullOrEmpty(entityId)) { entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault(); } else { entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault(); } if (entity != null) { entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId); entity.IsShowEdit = ProjectInfo.IsFlowEditable(strProjectId, FlowCode.MajorLease_FinanceAnalysis); entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, FlowCode.MajorLease_FinanceAnalysis); } else { entity = new MajorLeaseFinancAnalysis(); entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId); } entity.IsShowSave = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.MajorLease_FinanceAnalysis); PopulateAppUsers(entity); return(entity); }
public MajorLeaseConsInfo GetConsInfo(string strProjectId, string entityId = "") { MajorLeaseConsInfo entity = null; var majorLeaseInfo = MajorLeaseInfo.Search(e => e.ProjectId == strProjectId).FirstOrDefault(); if (string.IsNullOrEmpty(entityId)) { entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault(); } else { entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault(); } if (entity != null) { entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId); entity.ReinCost = ReinvestmentCost.GetByConsInfoId(entity.Id); entity.ReinBasicInfo = ReinvestmentBasicInfo.GetByConsInfoId(entity.Id); if (entity.ReinBasicInfo == null) { entity.ReinBasicInfo = new ReinvestmentBasicInfo { GBDate = majorLeaseInfo.GBDate, ReopenDate = majorLeaseInfo.ReopenDate }; } entity.WriteOff = WriteOffAmount.GetByConsInfoId(entity.Id); entity.IsShowEdit = ProjectInfo.IsFlowEditable(strProjectId, WorkflowCode); entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, WorkflowCode); } else { if (majorLeaseInfo != null) { entity = new MajorLeaseConsInfo { ReinBasicInfo = new ReinvestmentBasicInfo { GBDate = majorLeaseInfo.GBDate, ReopenDate = majorLeaseInfo.ReopenDate }, IsProjectFreezed = CheckIfFreezeProject(strProjectId), ReinvenstmentType = 1 }; } } entity.IsShowSave = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.MajorLease_ConsInfo); PopulateAppUsers(entity); return(entity); }
public ReimageConsInvtChecking GetConsInvtChecking(string strProjectId, string entityId = "") { ProjectId = strProjectId; ReimageConsInvtChecking entity = null; if (string.IsNullOrEmpty(entityId)) { entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault(); } else { entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault(); } if (entity != null) { entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId); entity.ApprovalType = entity.GetApprovalType(); var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == strProjectId && e.FlowCode == WorkflowCode); if (projectInfo != null) { var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId == strProjectId); if (reimageInfo != null && ClientCookie.UserCode.Equals(reimageInfo.PMAccount)) { var isExistTask = TaskWork.Search(e => e.RefID == strProjectId && e.TypeCode == WorkflowCode && e.Status == TaskWorkStatus.UnFinish && e.ReceiverAccount == ClientCookie.UserCode && e.ActivityName == WFReimageConsInvtChecking.Act_Originator).Any(); entity.IsShowEdit = projectInfo.Status == ProjectStatus.Finished && !isExistTask; entity.IsShowRecall = projectInfo.Status != ProjectStatus.Finished && !isExistTask; } } } else { entity = new ReimageConsInvtChecking(); entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId); } entity.IsShowSave = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.Reimage_ConsInvtChecking); PopulateAppUsers(entity); return(entity); }
public static MajorLeaseLegalReview GetLegalReviewInfo(string strProjectId, string entityId = "") { var entity = string.IsNullOrEmpty(entityId) ? FirstOrDefault(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory) : FirstOrDefault(e => e.Id.ToString().Equals(entityId)); if (entity != null) { entity.IsShowEdit = ProjectInfo.IsFlowEditable(strProjectId, FlowCode.MajorLease_LegalReview); entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, FlowCode.MajorLease_LegalReview); } else { entity = new MajorLeaseLegalReview(); } entity.IsProjectFreezed = entity.CheckIfFreezeProject(strProjectId); entity.IsShowSave = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.MajorLease_LegalReview); PopulateAppUsers(entity); return(entity); }
public static RenewalAnalysisDTO InitPage(string projectId) { RenewalAnalysisDTO dto = new RenewalAnalysisDTO(); var consInfo = RenewalConsInfo.Get(projectId); var analysis = Get(projectId); if (consInfo.HasReinvenstment) { var reinBasic = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo(); analysis.OperationSize = reinBasic.NewOperationSize; } dto.Info = RenewalInfo.Get(projectId); analysis.LastRemodeling = GetLastRemodeling(dto.Info.USCode); dto.Entity = analysis; dto.HasReinvenstment = consInfo.HasReinvenstment; dto.StoreInfo = PrepareStoreInfo(projectId, dto.Info.USCode); dto.Editable = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_Analysis); dto.Recallable = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_Analysis); dto.Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_Analysis); return(dto); }
public RebuildConsInvtChecking GetConsInvtChecking(string strProjectId, string entityId = "") { ProjectId = strProjectId; RebuildConsInvtChecking entity = null; if (string.IsNullOrEmpty(entityId)) { entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault(); } else { entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault(); } var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == strProjectId); UsCode = rbdInfo.USCode; if (entity != null) { entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId); entity.ApprovalType = entity.GetApprovalType(); entity.IsShowEdit = ProjectInfo.IsFlowEditable(strProjectId, FlowCode.Rebuild_ConsInvtChecking); entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, FlowCode.Rebuild_ConsInvtChecking); } else { entity = new RebuildConsInvtChecking(); entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId); entity.ProjectId = strProjectId; } if (ClientCookie.UserCode.Equals(rbdInfo.PMAccount)) { entity.IsShowSave = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.Rebuild_ConsInvtChecking); } PopulateAppUsers(entity); return(entity); }
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); }
public MajorLeaseConsInvtChecking GetConsInvtChecking(string strProjectId, string entityId = "") { ProjectId = strProjectId; MajorLeaseConsInvtChecking entity = null; if (string.IsNullOrEmpty(entityId)) { entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault(); } else { entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault(); } var majorLeaseInfo = MajorLeaseInfo.FirstOrDefault(e => e.ProjectId == strProjectId); USCode = majorLeaseInfo.USCode; if (entity != null) { entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId); entity.ApprovalType = entity.GetApprovalType(); entity.IsShowEdit = ProjectInfo.IsFlowEditable(strProjectId, FlowCode.MajorLease_ConsInvtChecking); entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, FlowCode.MajorLease_ConsInvtChecking); } else { entity = new MajorLeaseConsInvtChecking(); entity.ProjectId = strProjectId; entity.Save(); entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId); } entity.IsShowSave = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.MajorLease_ConsInvtChecking); PopulateAppUsers(entity); return(entity); }
public static ReimageGBMemo GetGBMemo(string projectId, string entityId = "") { var memo = (string.IsNullOrEmpty(entityId) ? FirstOrDefault(e => e.ProjectId.Equals(projectId) && !e.IsHistory) : FirstOrDefault(e => e.Id.ToString().Equals(entityId))) ?? new ReimageGBMemo(); memo.ProjectId = projectId; string usCode = ""; var rmgInfo = ReimageInfo.GetReimageInfo(projectId); memo.rmgInfo = rmgInfo; usCode = rmgInfo.USCode; memo.Store = StoreBasicInfo.GetStore(usCode); var consInfo = new ReimageConsInfo(); memo.ReinvestInfo = consInfo.GetReinvestmentBasicInfo(projectId); if (memo.Id == Guid.Empty) { memo.IsClosed = (memo.Store.StoreBasicInfo.statusName == "Closed"); memo.IsInOperation = false; if (memo.ReinvestInfo != null) { if ((memo.ReinvestInfo.NewAttachedKiosk.HasValue && memo.ReinvestInfo.NewAttachedKiosk.Value) || (memo.ReinvestInfo.NewRemoteKiosk.HasValue && memo.ReinvestInfo.NewRemoteKiosk.Value)) { memo.IsKiosk = true; } memo.IsMcCafe = memo.ReinvestInfo.NewMcCafe.HasValue && memo.ReinvestInfo.NewMcCafe.Value; memo.IsMDS = memo.ReinvestInfo.NewMDS.HasValue && memo.ReinvestInfo.NewMDS.Value; memo.Is24Hour = memo.ReinvestInfo.NewTwientyFourHour.HasValue && memo.ReinvestInfo.NewTwientyFourHour.Value; memo.GBDate = memo.ReinvestInfo.GBDate; memo.ConstCompletionDate = memo.ReinvestInfo.ConsCompletionDate; memo.ReopenDate = memo.ReinvestInfo.ReopenDate; } memo.Save(); } else { var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == projectId && e.FlowCode == FlowCode.Reimage_GBMemo); if (projectInfo != null) { if (ClientCookie.UserCode.Equals(rmgInfo.PMAccount)) //if (reimageInfo != null) { var isExistTask = TaskWork.Any(e => e.RefID == projectId && e.TypeCode == FlowCode.Reimage_GBMemo && e.Status == TaskWorkStatus.UnFinish && e.ReceiverAccount == ClientCookie.UserCode && e.ActivityName == WorkflowActOriginator); memo.IsShowEdit = projectInfo.Status == ProjectStatus.Finished && !isExistTask; memo.IsShowRecall = CheckIfShowRecallByPojectStatus(projectInfo.Status) && !isExistTask; } } } if (ClientCookie.UserCode.Equals(rmgInfo.PMAccount)) { memo.IsShowSave = ProjectInfo.IsFlowSavable(projectId, FlowCode.Reimage_GBMemo); } PopulateAppUsers(memo); return(memo); }
public static RenewalToolDTO InitPage(string projectId, string id = null) { RenewalToolDTO dto = new RenewalToolDTO(); var tool = RenewalTool.Get(projectId, id); var project = ProjectInfo.Get(projectId, FlowCode.Renewal_Tool); var info = RenewalInfo.Get(projectId); var isFinance = ClientCookie.UserCode == info.FinanceAccount; tool.IsProjectFreezed = tool.CheckIfFreezeProject(projectId); var nextRefTableId = new Guid(FlowInfo.GetRefTableId("RenewalAnalysis", projectId)); var nextFlowStarted = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Analysis); var haveTask = TaskWork.Any(t => t.RefID == projectId && t.TypeCode == FlowCode.Renewal_Tool && t.Status == TaskWorkStatus.UnFinish && t.ReceiverAccount == ClientCookie.UserCode); var projectComment = ProjectComment.GetSavedComment(tool.Id, "RenewalTool", ClientCookie.UserCode); var projectNode = NodeInfo.GetNodeInfo(project.NodeCode); var packageStarted = ProjectInfo.IsFlowStarted(projectId, FlowCode.Renewal_Package); string selectedYearMonth = null; dto.Info = info; dto.Entity = tool; dto.TTMDataYearMonths = RenewalToolFinMeasureInput.GetYearMonths(projectId, out selectedYearMonth); dto.FinMeasureInput = RenewalToolFinMeasureInput.Get(projectId, dto.Entity.Id); if (string.IsNullOrEmpty(dto.FinMeasureInput.FinanceYear) || string.IsNullOrEmpty(dto.FinMeasureInput.FinanceMonth)) { var ym = selectedYearMonth.Split('-'); dto.FinMeasureInput.FinanceYear = ym[0]; dto.FinMeasureInput.FinanceMonth = ym[1]; } dto.FinMeasureInput.FinanceDataYearMonth = dto.FinMeasureInput.FinanceYear + "-" + dto.FinMeasureInput.FinanceMonth; //dto.FinMeasureInput.ContributionMargin = StoreCM.Get(dto.Info.USCode).ContributionMargin; McdAMEntities amdb = new McdAMEntities(); var finfo = amdb.DataSync_LDW_AM_STFinanceData2.FirstOrDefault(f => f.UsCode == dto.Info.USCode && f.FinanceYear == dto.FinMeasureInput.FinanceYear && f.FinanceMonth == dto.FinMeasureInput.FinanceMonth); decimal cm = 0; if (finfo != null && !string.IsNullOrEmpty(finfo.contribution_marginPct)) { cm = decimal.Parse(finfo.contribution_marginPct); } dto.FinMeasureInput.ContributionMargin = cm; var coninfo = RenewalConsInfo.FirstOrDefault(e => e.ProjectId == projectId && !e.IsHistory); var conProj = ProjectInfo.FirstOrDefault(e => e.ProjectId == projectId && e.FlowCode == "Renewal_ConsInfo"); dto.WriteOffAndReinCost = RenewalToolWriteOffAndReinCost.Get(projectId, dto.Entity.Id, projectNode); if (coninfo != null && !coninfo.HasReinvenstment) { dto.WriteOffAndReinCost.REWriteOff = null; dto.WriteOffAndReinCost.LHIWriteOff = null; dto.WriteOffAndReinCost.ESSDWriteOff = null; dto.WriteOffAndReinCost.ESSDWriteOff = null; dto.WriteOffAndReinCost.RECost = null; dto.WriteOffAndReinCost.LHICost = null; dto.WriteOffAndReinCost.ESSDCost = null; } dto.Uploadable = projectNode.Sequence >= 3 && ClientCookie.UserCode == dto.Info.AssetActorAccount && !packageStarted; dto.ProjectComment = projectComment != null ? projectComment.Content : ""; dto.Editable = ProjectInfo.IsFlowEditable(projectId, FlowCode.Renewal_Tool); dto.Recallable = ProjectInfo.IsFlowRecallable(projectId, FlowCode.Renewal_Tool); dto.Savable = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_Tool) && string.IsNullOrEmpty(id); dto.IsFinished = ProjectInfo.Any( e => e.ProjectId == projectId && e.FlowCode == FlowCode.Renewal_Tool && e.Status == ProjectStatus.Finished); return(dto); }
public static ReimageConsInfo GetConsInfo(string strProjectId, string entityId = "") { ReimageConsInfo entity = null; if (string.IsNullOrEmpty(entityId)) { entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault(); } else { entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault(); } var reimageInfo = ReimageInfo.FirstOrDefault(e => e.ProjectId == strProjectId); if (entity != null) { entity.IsProjectFreezed = entity.CheckIfFreezeProject(strProjectId); entity.ReinCost = ReinvestmentCost.GetByConsInfoId(entity.Id); entity.ReinBasicInfo = ReinvestmentBasicInfo.GetByConsInfoId(entity.Id); if (entity.ReinBasicInfo != null) { entity.ReinBasicInfo.GBDate = reimageInfo.GBDate; entity.ReinBasicInfo.ReopenDate = reimageInfo.ReopenDate; } else { entity.ReinBasicInfo = new ReinvestmentBasicInfo { GBDate = reimageInfo.GBDate, ReopenDate = reimageInfo.ReopenDate }; } entity.WriteOff = WriteOffAmount.GetByConsInfoId(entity.Id); var attachmentReinCost = Attachment.FirstOrDefault(e => e.RefTableID == entity.Id.ToString() && e.TypeCode == "ReinCost"); if (attachmentReinCost != null && entity.ReinCost != null) { entity.ReinCost.ReinCostUser = attachmentReinCost.CreatorNameENUS; entity.ReinCost.ReinCostTime = attachmentReinCost.CreateTime; } var attachmentWriteOff = Attachment.FirstOrDefault(e => e.RefTableID == entity.Id.ToString() && e.TypeCode == "WriteOff"); if (attachmentWriteOff != null) { entity.WriteOff.WriteOffUser = attachmentWriteOff.CreatorNameENUS; entity.WriteOff.WriteOffTime = attachmentWriteOff.CreateTime; } //entity.ProcInstID = entity.ProcInstId; entity.IsShowEdit = ProjectInfo.IsFlowEditable(strProjectId, FlowCode.Reimage_ConsInfo); entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, FlowCode.Reimage_ConsInfo); } else { //var reimage = ReimageInfo.FirstOrDefault(e => e.ProjectId == strProjectId); //if (reimage != null) //{ // entity = new ReimageConsInfo // { // ReinBasicInfo = // new ReinvestmentBasicInfo // { // GBDate = reimage.GBDate, // ReopenDate = reimage.ReopenDate // }, // IsProjectFreezed =entity.CheckIfFreezeProject(strProjectId), // ReinvenstmentType = 1 // }; //} entity.IsProjectFreezed = entity.CheckIfFreezeProject(strProjectId); entity.ReinBasicInfo = ReinvestmentBasicInfo.GetByConsInfoId(entity.Id); if (entity.ReinBasicInfo != null) { entity.ReinBasicInfo.GBDate = reimageInfo.GBDate; entity.ReinBasicInfo.ReopenDate = reimageInfo.ReopenDate; } else { entity.ReinBasicInfo = new ReinvestmentBasicInfo { GBDate = reimageInfo.GBDate, ReopenDate = reimageInfo.ReopenDate }; } } entity.IsShowSave = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.Reimage_ConsInfo); entity.PopulateAppUsers(); return(entity); }
public RebuildConsInfo GetConsInfo(string strProjectId, string entityId = "") { RebuildConsInfo entity = null; if (string.IsNullOrEmpty(entityId)) { entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault(); } else { entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault(); } if (entity != null) { entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId); entity.ReinCost = ReinvestmentCost.GetByConsInfoId(entity.Id); entity.ReinBasicInfo = ReinvestmentBasicInfo.GetByConsInfoId(entity.Id); var attachmentReinCost = Attachment.FirstOrDefault(e => e.RefTableID == entity.Id.ToString() && e.TypeCode == "ReinCost"); if (entity.ReinCost != null && attachmentReinCost != null) { entity.ReinCost.ReinCostUser = attachmentReinCost.CreatorNameENUS; entity.ReinCost.ReinCostTime = attachmentReinCost.CreateTime; } if (entity.ReinBasicInfo == null) { var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == strProjectId); if (rbdInfo != null) { entity.ReinBasicInfo = new ReinvestmentBasicInfo { GBDate = rbdInfo.GBDate, ReopenDate = rbdInfo.ReopenDate, ConsCompletionDate = rbdInfo.ConstCompletionDate }; } } entity.WriteOff = WriteOffAmount.GetByConsInfoId(entity.Id); var attachmentWriteOff = Attachment.FirstOrDefault(e => e.RefTableID == entity.Id.ToString() && e.TypeCode == "WriteOff"); if (entity.WriteOff != null && attachmentWriteOff != null) { entity.WriteOff.WriteOffUser = attachmentWriteOff.CreatorNameENUS; entity.WriteOff.WriteOffTime = attachmentWriteOff.CreateTime; } entity.IsShowEdit = ProjectInfo.IsFlowEditable(strProjectId, FlowCode.Rebuild_ConsInfo); entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, FlowCode.Rebuild_ConsInfo); entity.IsShowSave = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.Rebuild_ConsInfo); } else { var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == strProjectId); if (rbdInfo != null) { entity = new RebuildConsInfo { ReinBasicInfo = new ReinvestmentBasicInfo { GBDate = rbdInfo.GBDate, ReopenDate = rbdInfo.ReopenDate }, IsProjectFreezed = CheckIfFreezeProject(strProjectId), ProjectId = strProjectId }; } } PopulateAppUsers(entity); return(entity); }