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); }
private string GetApprovalType() { var approvalType = string.Empty; var reinvestment = ReinvestmentCost.FirstOrDefault(e => e.ConsInfoID == Id); var writeOffAmount = WriteOffAmount.FirstOrDefault(e => e.ConsInfoID == Id); if (reinvestment != null && writeOffAmount != null) { var totalVariance = GetTotalVariance(reinvestment, writeOffAmount); if (totalVariance <= (decimal)0.05) { approvalType = "LeqFivePercent"; } else if (totalVariance > (decimal)0.05 && totalVariance <= (decimal)0.1) { approvalType = "BetweenFiveAndTenPercent"; } else if (totalVariance > (decimal)0.1) { approvalType = "MoreThanPercent"; } } return(approvalType); }
private decimal GetTotalVariance(ReinvestmentCost reinvestment, WriteOffAmount writeOffAmount) { var totalReinvestmentVariance = Math.Abs(reinvestment.TotalReinvestmentVariance.As <decimal>()); decimal totalWriteOffVariance = 0; if (writeOffAmount.TotalII.As <decimal>() != 0) { totalWriteOffVariance = Math.Abs((writeOffAmount.TotalActual.As <decimal>() - writeOffAmount.TotalII.As <decimal>()) / writeOffAmount.TotalII.As <decimal>()); } return(totalWriteOffVariance); }
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); }
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 void Save(bool pushOrNot) { using (TransactionScope tranScope = new TransactionScope()) { var projectInfo = ProjectInfo.Get(Id); if (projectInfo == null) { ProjectId = ProjectInfo.CreateDLProject(Id, FlowCode.Renewal, USCode, NodeCode.Start, ClientCookie.UserCode, pushOrNot); var renewalInfo = new RenewalInfo(); renewalInfo.Id = Guid.NewGuid(); renewalInfo.ProjectId = ProjectId; renewalInfo.USCode = USCode; renewalInfo.RenewalYears = 0; renewalInfo.NeedProjectCostEst = false; renewalInfo.CreateTime = DateTime.Now; renewalInfo.CreateUserAccount = ClientCookie.UserCode; renewalInfo.Add(); var renewalConsInfo = new RenewalConsInfo(); renewalConsInfo.Id = Guid.NewGuid(); renewalConsInfo.ProjectId = ProjectId; renewalConsInfo.HasReinvenstment = false; renewalConsInfo.IsHistory = false; renewalConsInfo.CreateTime = DateTime.Now; renewalConsInfo.CreateUserAccount = ClientCookie.UserCode; renewalConsInfo.ProcInstId = 0; renewalConsInfo.Add(); var writeOffAmount = new WriteOffAmount(); writeOffAmount.Id = Guid.NewGuid(); writeOffAmount.ConsInfoID = renewalConsInfo.Id; writeOffAmount.TotalWriteOff = Renewal_Total_WO_Proj; writeOffAmount.TotalNBV = Renewal_Total_WO_Act; writeOffAmount.Add(); var reinvestmentCost = new ReinvestmentCost(); reinvestmentCost.Id = Guid.NewGuid(); reinvestmentCost.ConsInfoID = renewalConsInfo.Id; reinvestmentCost.TotalReinvestmentNorm = Renewal_Total_Reinvestment_Proj; reinvestmentCost.LHINorm = Renewal_Total_Reinvestment_Act; reinvestmentCost.Add(); var renewalAnalysis = new RenewalAnalysis(); renewalAnalysis.Id = Guid.NewGuid(); renewalAnalysis.ProjectId = ProjectId; renewalAnalysis.CreateUserAccount = ClientCookie.UserCode; renewalAnalysis.CreateTime = DateTime.Now; renewalAnalysis.IsHistory = false; renewalAnalysis.FairMarketRentAgent = Fair_Market_Rent; renewalAnalysis.DR1stTYAmount = DR1stTYAmount; renewalAnalysis.RentDeviation = RentDeviation; renewalAnalysis.DRMFLastTYSales = DRMFLastTYSales; renewalAnalysis.DRMF1stTY = DRMF1stTY; renewalAnalysis.Add(); var renewalTool = new RenewalTool(); renewalTool.Id = Guid.NewGuid(); renewalTool.ProjectId = ProjectId; renewalTool.IsHistory = false; renewalTool.CreateTime = DateTime.Now; renewalTool.CreateUserAccount = ClientCookie.UserCode; renewalTool.Add(); var renewalToolFinMeasureOutput = new RenewalToolFinMeasureOutput(); renewalToolFinMeasureOutput.Id = Guid.NewGuid(); renewalToolFinMeasureOutput.ToolId = renewalTool.Id; renewalToolFinMeasureOutput.RentAsProdSalesYr1 = SRMFLastTYSales; renewalToolFinMeasureOutput.RentAsProdSalesAvg = SRMF1stTYSales; renewalToolFinMeasureOutput.Add(); var projectContractInfo = new ProjectContractInfo(); projectContractInfo.Id = Guid.NewGuid(); projectContractInfo.ProjectId = ProjectId; projectContractInfo.ContractInfoId = Guid.Empty; projectContractInfo.CreatedTime = DateTime.Now; projectContractInfo.WriteBack = false; projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Add(); } else { ProjectId = projectInfo.ProjectId; projectInfo.IsPushed = pushOrNot; projectInfo.Update(); var renewalInfo = RenewalInfo.FirstOrDefault(i => i.ProjectId == ProjectId); if (renewalInfo == null) { renewalInfo = new RenewalInfo(); renewalInfo.Id = Guid.NewGuid(); renewalInfo.ProjectId = ProjectId; renewalInfo.USCode = USCode; renewalInfo.RenewalYears = 0; renewalInfo.NeedProjectCostEst = false; renewalInfo.CreateTime = DateTime.Now; renewalInfo.CreateUserAccount = ClientCookie.UserCode; renewalInfo.Add(); } var renewalConsInfo = RenewalConsInfo.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory); if (renewalConsInfo == null) { renewalConsInfo = new RenewalConsInfo(); renewalConsInfo.Id = Guid.NewGuid(); renewalConsInfo.ProjectId = ProjectId; renewalConsInfo.HasReinvenstment = false; renewalConsInfo.IsHistory = false; renewalConsInfo.CreateTime = DateTime.Now; renewalConsInfo.CreateUserAccount = ClientCookie.UserCode; renewalConsInfo.ProcInstId = 0; renewalConsInfo.Add(); } var writeOffAmount = WriteOffAmount.FirstOrDefault(i => i.ConsInfoID == renewalConsInfo.Id); if (writeOffAmount == null) { writeOffAmount = new WriteOffAmount(); writeOffAmount.Id = Guid.NewGuid(); writeOffAmount.ConsInfoID = renewalConsInfo.Id; writeOffAmount.TotalWriteOff = Renewal_Total_WO_Proj; writeOffAmount.TotalNBV = Renewal_Total_WO_Act; writeOffAmount.Add(); } else { writeOffAmount.TotalWriteOff = Renewal_Total_WO_Proj; writeOffAmount.TotalNBV = Renewal_Total_WO_Act; writeOffAmount.Update(); } var reinvestmentCost = ReinvestmentCost.FirstOrDefault(i => i.ConsInfoID == renewalConsInfo.Id); if (reinvestmentCost == null) { reinvestmentCost = new ReinvestmentCost(); reinvestmentCost.Id = Guid.NewGuid(); reinvestmentCost.ConsInfoID = renewalConsInfo.Id; reinvestmentCost.TotalReinvestmentNorm = Renewal_Total_Reinvestment_Proj; reinvestmentCost.LHINorm = Renewal_Total_Reinvestment_Act; reinvestmentCost.Add(); } else { reinvestmentCost.TotalReinvestmentNorm = Renewal_Total_Reinvestment_Proj; reinvestmentCost.LHINorm = Renewal_Total_Reinvestment_Act; reinvestmentCost.Update(); } var renewalAnalysis = RenewalAnalysis.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory); if (renewalAnalysis == null) { renewalAnalysis = new RenewalAnalysis(); renewalAnalysis.Id = Guid.NewGuid(); renewalAnalysis.ProjectId = ProjectId; renewalAnalysis.CreateUserAccount = ClientCookie.UserCode; renewalAnalysis.CreateTime = DateTime.Now; renewalAnalysis.IsHistory = false; renewalAnalysis.FairMarketRentAgent = Fair_Market_Rent; renewalAnalysis.DR1stTYAmount = DR1stTYAmount; renewalAnalysis.RentDeviation = RentDeviation; renewalAnalysis.DRMFLastTYSales = DRMFLastTYSales; renewalAnalysis.DRMF1stTY = DRMF1stTY; renewalAnalysis.Add(); } else { renewalAnalysis.FairMarketRentAgent = Fair_Market_Rent; renewalAnalysis.DR1stTYAmount = DR1stTYAmount; renewalAnalysis.RentDeviation = RentDeviation; renewalAnalysis.DRMFLastTYSales = DRMFLastTYSales; renewalAnalysis.DRMF1stTY = DRMF1stTY; renewalAnalysis.Update(); } var renewalTool = RenewalTool.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory); if (renewalTool == null) { renewalTool = new RenewalTool(); renewalTool.Id = Guid.NewGuid(); renewalTool.ProjectId = ProjectId; renewalTool.IsHistory = false; renewalTool.CreateTime = DateTime.Now; renewalTool.CreateUserAccount = ClientCookie.UserCode; renewalTool.Add(); } var renewalToolFinMeasureOutput = RenewalToolFinMeasureOutput.FirstOrDefault(i => i.ToolId == renewalTool.Id); if (renewalToolFinMeasureOutput == null) { renewalToolFinMeasureOutput = new RenewalToolFinMeasureOutput(); renewalToolFinMeasureOutput.Id = Guid.NewGuid(); renewalToolFinMeasureOutput.ToolId = renewalTool.Id; renewalToolFinMeasureOutput.RentAsProdSalesYr1 = SRMFLastTYSales; renewalToolFinMeasureOutput.RentAsProdSalesAvg = SRMF1stTYSales; renewalToolFinMeasureOutput.Add(); } else { renewalToolFinMeasureOutput.RentAsProdSalesYr1 = SRMFLastTYSales; renewalToolFinMeasureOutput.RentAsProdSalesAvg = SRMF1stTYSales; renewalToolFinMeasureOutput.Update(); } var projectContractInfo = ProjectContractInfo.FirstOrDefault(i => i.ProjectId == ProjectId); if (projectContractInfo != null) { projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Update(); } else { projectContractInfo = new ProjectContractInfo(); projectContractInfo.Id = Guid.NewGuid(); projectContractInfo.ProjectId = ProjectId; projectContractInfo.ContractInfoId = Guid.Empty; projectContractInfo.CreatedTime = DateTime.Now; projectContractInfo.WriteBack = false; projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Add(); } } tranScope.Complete(); } }
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); }
public void Save(bool pushOrNot) { using (TransactionScope tranScope = new TransactionScope()) { var projectInfo = ProjectInfo.Get(Id); if (projectInfo == null) { ProjectId = ProjectInfo.CreateDLProject(Id, FlowCode.MajorLease, USCode, NodeCode.Start, ClientCookie.UserCode, pushOrNot); var mlcInfo = new MajorLeaseInfo(); mlcInfo.Id = Guid.NewGuid(); mlcInfo.ProjectId = ProjectId; mlcInfo.USCode = USCode; mlcInfo.ChangeRentalType = ChangeRentalType; mlcInfo.ChangeRentalTypeDESC = ChangeRentalTypeDESC; mlcInfo.ChangeRedLineType = ChangeRedLineType; mlcInfo.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC; mlcInfo.ChangeLeaseTermType = ChangeLeaseTermType; mlcInfo.ChangeLeaseTermDESC = ChangeLeaseTermDESC; mlcInfo.CreateTime = DateTime.Now; mlcInfo.CreateUserAccount = ClientCookie.UserCode; mlcInfo.CreateUserNameENUS = ClientCookie.UserNameENUS; mlcInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN; mlcInfo.ChangeLandlordType = ChangeLandlordType; mlcInfo.ChangeLandLordDESC = ChangeLandLordDESC; mlcInfo.Add(); var mlcPackage = new MajorLeaseChangePackage(); mlcPackage.Id = Guid.NewGuid(); mlcPackage.ProjectId = ProjectId; mlcPackage.WriteOff = MLCNetWriteOff_Act; mlcPackage.IsHistory = false; mlcPackage.CreateUserAccount = ClientCookie.UserCode; mlcPackage.CreateTime = DateTime.Now; mlcPackage.Add(); var mlcConsInvtChecking = new MajorLeaseConsInvtChecking(); mlcConsInvtChecking.Id = Guid.NewGuid(); mlcConsInvtChecking.ProjectId = ProjectId; mlcConsInvtChecking.IsHistory = false; mlcConsInvtChecking.CreateTime = DateTime.Now; mlcConsInvtChecking.Add(); var reinvestmentCost = new ReinvestmentCost(); reinvestmentCost.Id = Guid.NewGuid(); reinvestmentCost.ConsInfoID = mlcConsInvtChecking.Id; reinvestmentCost.TotalReinvestmentFAAct = MLC_TotalReinvestment_Act; reinvestmentCost.Add(); var projectContractInfo = new ProjectContractInfo(); projectContractInfo.Id = Guid.NewGuid(); projectContractInfo.ProjectId = ProjectId; projectContractInfo.ContractInfoId = Guid.Empty; projectContractInfo.CreatedTime = DateTime.Now; projectContractInfo.WriteBack = false; projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Add(); } else { ProjectId = projectInfo.ProjectId; projectInfo.IsPushed = pushOrNot; projectInfo.Update(); var mlcInfo = MajorLeaseInfo.FirstOrDefault(i => i.ProjectId == ProjectId); if (mlcInfo != null) { mlcInfo.ChangeRentalType = ChangeRentalType; mlcInfo.ChangeRentalTypeDESC = ChangeRentalTypeDESC; mlcInfo.ChangeRedLineType = ChangeRedLineType; mlcInfo.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC; mlcInfo.ChangeLeaseTermType = ChangeLeaseTermType; mlcInfo.ChangeLeaseTermDESC = ChangeLeaseTermDESC; mlcInfo.ChangeLandlordType = ChangeLandlordType; mlcInfo.ChangeLandLordDESC = ChangeLandLordDESC; mlcInfo.Update(); } else { mlcInfo = new MajorLeaseInfo(); mlcInfo.Id = Guid.NewGuid(); mlcInfo.ProjectId = ProjectId; mlcInfo.USCode = USCode; mlcInfo.ChangeRentalType = ChangeRentalType; mlcInfo.ChangeRentalTypeDESC = ChangeRentalTypeDESC; mlcInfo.ChangeRedLineType = ChangeRedLineType; mlcInfo.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC; mlcInfo.ChangeLeaseTermType = ChangeLeaseTermType; mlcInfo.ChangeLeaseTermDESC = ChangeLeaseTermDESC; mlcInfo.CreateTime = DateTime.Now; mlcInfo.CreateUserAccount = ClientCookie.UserCode; mlcInfo.CreateUserNameENUS = ClientCookie.UserNameENUS; mlcInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN; mlcInfo.ChangeLandlordType = ChangeLandlordType; mlcInfo.ChangeLandLordDESC = ChangeLandLordDESC; mlcInfo.Add(); } var mlcPackage = MajorLeaseChangePackage.GetMajorPackageInfo(ProjectId); if (mlcPackage != null) { mlcPackage.WriteOff = MLCNetWriteOff_Act; mlcPackage.Update(); } else { mlcPackage = new MajorLeaseChangePackage(); mlcPackage.Id = Guid.NewGuid(); mlcPackage.ProjectId = ProjectId; mlcPackage.WriteOff = MLCNetWriteOff_Act; mlcPackage.IsHistory = false; mlcPackage.CreateUserAccount = ClientCookie.UserCode; mlcPackage.CreateTime = DateTime.Now; mlcPackage.Add(); } var mlcConsInvtChecking = MajorLeaseConsInvtChecking.FirstOrDefault(i => i.ProjectId == ProjectId && i.IsHistory == false); if (mlcConsInvtChecking == null) { mlcConsInvtChecking = new MajorLeaseConsInvtChecking(); mlcConsInvtChecking.Id = Guid.NewGuid(); mlcConsInvtChecking.ProjectId = ProjectId; mlcConsInvtChecking.IsHistory = false; mlcConsInvtChecking.CreateTime = DateTime.Now; mlcConsInvtChecking.Add(); } var reinvestmentCost = ReinvestmentCost.GetByConsInfoId(mlcConsInvtChecking.Id); if (reinvestmentCost != null) { reinvestmentCost.TotalReinvestmentFAAct = MLC_TotalReinvestment_Act; reinvestmentCost.Update(); } else { reinvestmentCost = new ReinvestmentCost(); reinvestmentCost.Id = Guid.NewGuid(); reinvestmentCost.ConsInfoID = mlcConsInvtChecking.Id; reinvestmentCost.TotalReinvestmentFAAct = MLC_TotalReinvestment_Act; reinvestmentCost.Add(); } var projectContractInfo = ProjectContractInfo.FirstOrDefault(i => i.ProjectId == ProjectId); if (projectContractInfo != null) { projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Update(); } else { projectContractInfo = new ProjectContractInfo(); projectContractInfo.Id = Guid.NewGuid(); projectContractInfo.ProjectId = ProjectId; projectContractInfo.ContractInfoId = Guid.Empty; projectContractInfo.CreatedTime = DateTime.Now; projectContractInfo.WriteBack = false; projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Add(); } } tranScope.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(); } }
public override void Finish(TaskWorkStatus status, TaskWork task) { RenewalInfo info = RenewalInfo.Get(this.ProjectId); switch (status) { case TaskWorkStatus.K2ProcessApproved: //var toolUploadTask = TaskWork.FirstOrDefault(t => t.RefID == ProjectId // && t.TypeCode == FlowCode.Renewal_Tool // && t.ReceiverAccount == info.AssetActorAccount // && t.ActivityName == "AssetActor" // && t.Status == TaskWorkStatus.Cancel); //if (toolUploadTask != null) //{ // toolUploadTask.Status = TaskWorkStatus.UnFinish; // toolUploadTask.Update(); //} //else if (!ProjectInfo.IsFlowStarted(this.ProjectId, FlowCode.Renewal_Tool)) //{ // info.GenerateSubmitTask(FlowCode.Renewal_Tool); //} var tool = RenewalTool.Get(ProjectId); Guid entityId; var toolProj = ProjectInfo.FirstOrDefault(e => e.Status == ProjectStatus.Finished && e.ProjectId == ProjectId && e.FlowCode == FlowCode.Renewal_Tool); if (toolProj != null) { NoticeToActor(info.AssetActorAccount, info.USCode); tool.Edit(); entityId = tool.NewEntityId; } else { entityId = tool.Id; ProjectInfo.Reset(this.ProjectId, FlowCode.Renewal_Tool); info.GenerateSubmitTask(FlowCode.Renewal_Tool); } var entity = RenewalToolWriteOffAndReinCost.FirstOrDefault(w => w.ToolId == entityId); if (entity == null) { entity = new RenewalToolWriteOffAndReinCost(); entity.Id = Guid.NewGuid(); entity.ToolId = tool.Id; entity.Add(); } var writeOffAmount = WriteOffAmount.GetByConsInfoId(this.Id); var reinCost = ReinvestmentCost.GetByConsInfoId(this.Id); if (writeOffAmount != null) { entity.REWriteOff = DataConverter.ToDecimal(writeOffAmount.REWriteOff); entity.LHIWriteOff = DataConverter.ToDecimal(writeOffAmount.LHIWriteOff); entity.ESSDWriteOff = DataConverter.ToDecimal(writeOffAmount.ESSDWriteOff); } else { entity.REWriteOff = 0; entity.LHIWriteOff = 0; entity.ESSDWriteOff = 0; } if (reinCost != null) { entity.RECost = DataConverter.ToDecimal(reinCost.RECostNorm); entity.LHICost = DataConverter.ToDecimal(reinCost.LHINorm); entity.ESSDCost = DataConverter.ToDecimal(reinCost.ESSDNorm); } else { entity.RECost = 0; entity.LHICost = 0; entity.ESSDCost = 0; } Log4netHelper.WriteInfo(JsonConvert.SerializeObject(new { desc = "renewal tool info:", entityId, tool, writeOffAmount, reinCost, Id })); entity.Update(); if (HasReinvenstment) { ProjectInfo.FinishNode(this.ProjectId, this.WorkflowCode, NodeCode.Renewal_ConsInfo_Approval); } break; case TaskWorkStatus.K2ProcessDeclined: break; } task.Finish(); }
public override string Edit() { using (var tranScope = new TransactionScope()) { var info = RenewalInfo.Get(this.ProjectId); var consInfo = Duplicator.AutoCopy(this); consInfo.Id = Guid.NewGuid(); consInfo.IsHistory = false; consInfo.CreateUserAccount = ClientCookie.UserCode; consInfo.Add(); IsHistory = true; this.Update(); ProjectInfo.Reset(ProjectId, this.WorkflowCode); var attachments = Attachment.GetList(this.TableName, Id.ToString(), string.Empty); attachments.ForEach(att => { att.RefTableID = consInfo.Id.ToString(); att.ID = Guid.NewGuid(); }); Attachment.Add(attachments.ToArray()); var reinBasic = ReinvestmentBasicInfo.GetByConsInfoId(this.Id); if (reinBasic != null) { var newReinBasic = Duplicator.AutoCopy(reinBasic); newReinBasic.Id = 0; newReinBasic.ConsInfoID = consInfo.Id; newReinBasic.Add(); } var wf = WriteOffAmount.GetByConsInfoId(this.Id); if (wf != null) { var newWf = Duplicator.AutoCopy(wf); newWf.Id = Guid.NewGuid(); newWf.ConsInfoID = consInfo.Id; newWf.Add(); } var reinCost = ReinvestmentCost.GetByConsInfoId(this.Id); if (reinCost != null) { var newReinCost = Duplicator.AutoCopy(reinCost); newReinCost.Id = Guid.NewGuid(); newReinCost.ConsInfoID = consInfo.Id; newReinCost.Add(); } var oldTasks = TaskWork.Search(t => t.RefID == ProjectId && t.Status == TaskWorkStatus.UnFinish && new string[] { FlowCode.Renewal_ConsInfo, FlowCode.Renewal_Tool }.Contains(t.TypeCode)).ToList(); oldTasks.ForEach(t => { t.Status = TaskWorkStatus.Cancel; }); TaskWork.Update(oldTasks.ToArray()); var toolUploadTask = TaskWork.FirstOrDefault(t => t.RefID == ProjectId && t.TypeCode == FlowCode.Renewal_Tool && t.ReceiverAccount == info.AssetActorAccount && t.ActivityName == "AssetActor" && t.Status == TaskWorkStatus.UnFinish); if (toolUploadTask != null) { toolUploadTask.Status = TaskWorkStatus.Cancel; toolUploadTask.Update(); } CompleteRenewalToolTask(); var task = info.GenerateSubmitTask(this.WorkflowCode); tranScope.Complete(); return(task.Url); } }
public void Save(bool pushOrNot) { using (TransactionScope tranScope = new TransactionScope()) { var projectInfo = ProjectInfo.Get(Id); if (projectInfo == null) { ProjectId = ProjectInfo.CreateDLProject(Id, FlowCode.Rebuild, USCode, NodeCode.Start, ClientCookie.UserCode, pushOrNot); var rebuildInfo = new RebuildInfo(); rebuildInfo.Id = Guid.NewGuid(); rebuildInfo.ProjectId = ProjectId; rebuildInfo.USCode = USCode; rebuildInfo.CreateTime = DateTime.Now; rebuildInfo.CreateUserAccount = ClientCookie.UserCode; rebuildInfo.CreateUserNameENUS = ClientCookie.UserNameENUS; rebuildInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN; rebuildInfo.GBDate = GBDate; rebuildInfo.ReopenDate = ReopenDate; rebuildInfo.Add(); var rebuildPackage = new RebuildPackage(); rebuildPackage.Id = Guid.NewGuid(); rebuildPackage.ProjectId = ProjectId; rebuildPackage.IsHistory = false; rebuildPackage.ChangeLandlordType = ChangeLandlordType; rebuildPackage.NewLandlord = ChangeLandLordDESC; rebuildPackage.ChangeRentalType = ChangeRentalType; rebuildPackage.ChangeRentalTypeDESC = ChangeRentalTypeDESC; rebuildPackage.ChangeLeaseTermType = ChangeLeaseTermType; rebuildPackage.ChangeLeaseTermDESC = ChangeLeaseTermDESC; rebuildPackage.ChangeRedLineType = ChangeRedLineType; rebuildPackage.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC; //rebuildPackage.NewRentalStructure = NewRentalStructure; rebuildPackage.Add(); var projectContractInfo = new ProjectContractInfo(); projectContractInfo.Id = Guid.NewGuid(); projectContractInfo.ProjectId = ProjectId; projectContractInfo.ContractInfoId = Guid.Empty; projectContractInfo.CreatedTime = DateTime.Now; projectContractInfo.WriteBack = false; projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Add(); var rebuildConsInfo = new RebuildConsInfo(); rebuildConsInfo.Id = Guid.NewGuid(); rebuildConsInfo.ProjectId = ProjectId; rebuildConsInfo.IsHistory = false; rebuildConsInfo.CreateTime = DateTime.Now; rebuildConsInfo.CreateUserAccount = ClientCookie.UserCode; rebuildConsInfo.Add(); var reinvestmentBasicInfo = new ReinvestmentBasicInfo(); reinvestmentBasicInfo.ConsInfoID = rebuildConsInfo.Id; reinvestmentBasicInfo.EstimatedSeatNo = OriginalSeatNO; reinvestmentBasicInfo.RightSizingSeatNo = AfterRebuildSeatNO; reinvestmentBasicInfo.NewDesignType = AfterRebuildDesignType; reinvestmentBasicInfo.NewOperationSize = AfterRebuildOperationArea; reinvestmentBasicInfo.Add(); var rebuildConsInvtChecking = new RebuildConsInvtChecking(); rebuildConsInvtChecking.Id = Guid.NewGuid(); rebuildConsInvtChecking.ProjectId = ProjectId; rebuildConsInvtChecking.IsHistory = false; rebuildConsInvtChecking.Add(); var writeOffAmount = new WriteOffAmount(); writeOffAmount.Id = Guid.NewGuid(); writeOffAmount.ConsInfoID = rebuildConsInvtChecking.Id; writeOffAmount.TotalActual = Rebuild_TotalWO_Act; writeOffAmount.Add(); var reinvestmentCost = new ReinvestmentCost(); reinvestmentCost.Id = Guid.NewGuid(); reinvestmentCost.ConsInfoID = rebuildConsInvtChecking.Id; reinvestmentCost.TotalReinvestmentFAAct = Rebuild_TotalReinvestment_Act; reinvestmentCost.Add(); } else { ProjectId = projectInfo.ProjectId; projectInfo.IsPushed = pushOrNot; projectInfo.Update(); var rebuildInfo = RebuildInfo.FirstOrDefault(i => i.ProjectId == ProjectId); if (rebuildInfo != null) { rebuildInfo.GBDate = GBDate; rebuildInfo.ReopenDate = ReopenDate; rebuildInfo.Update(); } else { rebuildInfo = new RebuildInfo(); rebuildInfo.Id = Guid.NewGuid(); rebuildInfo.ProjectId = ProjectId; rebuildInfo.USCode = USCode; rebuildInfo.CreateTime = DateTime.Now; rebuildInfo.CreateUserAccount = ClientCookie.UserCode; rebuildInfo.CreateUserNameENUS = ClientCookie.UserNameENUS; rebuildInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN; rebuildInfo.GBDate = GBDate; rebuildInfo.ReopenDate = ReopenDate; rebuildInfo.Add(); } var rebuildPackage = RebuildPackage.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory); if (rebuildPackage != null) { rebuildPackage.ChangeLandlordType = ChangeLandlordType; rebuildPackage.NewLandlord = ChangeLandLordDESC; rebuildPackage.ChangeRentalType = ChangeRentalType; rebuildPackage.ChangeRentalTypeDESC = ChangeRentalTypeDESC; rebuildPackage.ChangeLeaseTermType = ChangeLeaseTermType; rebuildPackage.ChangeLeaseTermDESC = ChangeLeaseTermDESC; rebuildPackage.ChangeRedLineType = ChangeRedLineType; rebuildPackage.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC; //rebuildPackage.NewRentalStructure = NewRentalStructure; rebuildPackage.Update(); } else { rebuildPackage = new RebuildPackage(); rebuildPackage.Id = Guid.NewGuid(); rebuildPackage.ProjectId = ProjectId; rebuildPackage.IsHistory = false; rebuildPackage.ChangeLandlordType = ChangeLandlordType; rebuildPackage.NewLandlord = ChangeLandLordDESC; rebuildPackage.ChangeRentalType = ChangeRentalType; rebuildPackage.ChangeRentalTypeDESC = ChangeRentalTypeDESC; rebuildPackage.ChangeLeaseTermType = ChangeLeaseTermType; rebuildPackage.ChangeLeaseTermDESC = ChangeLeaseTermDESC; rebuildPackage.ChangeRedLineType = ChangeRedLineType; rebuildPackage.ChangeRedLineTypeDESC = ChangeRedLineTypeDESC; //rebuildPackage.NewRentalStructure = NewRentalStructure; rebuildPackage.Add(); } var projectContractInfo = ProjectContractInfo.FirstOrDefault(i => i.ProjectId == ProjectId); if (projectContractInfo != null) { projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Update(); } else { projectContractInfo = new ProjectContractInfo(); projectContractInfo.Id = Guid.NewGuid(); projectContractInfo.ProjectId = ProjectId; projectContractInfo.ContractInfoId = Guid.Empty; projectContractInfo.CreatedTime = DateTime.Now; projectContractInfo.WriteBack = false; projectContractInfo.EditMode = EditMode; projectContractInfo.PartyAFullName = PartyAFullName; projectContractInfo.McDLegalEntity = ContractEntityName; projectContractInfo.McDOwnership = McdOwnership; projectContractInfo.ContactPerson = ContactPerson; projectContractInfo.ContactMode = ContactMode; projectContractInfo.RentType = RentType; projectContractInfo.TotalLeasedArea = RentSize; projectContractInfo.LeasePurchaseTerm = ContractTerm; projectContractInfo.LeasePurchase = ContractType; projectContractInfo.StartDate = ContractStartDate; projectContractInfo.EndDate = ContraceEndDate; projectContractInfo.StartYear = ContractStartYear; projectContractInfo.EndYear = ContraceEndYear; projectContractInfo.RentCommencementDate = RentPaymentStartDate; projectContractInfo.DeadlineToNotice = DeadlineToNoticeLL; projectContractInfo.Changedafter2010 = ChangedAfter2010; projectContractInfo.RentStructure = RentStructure; projectContractInfo.WithEarlyTerminationClause = EarlyTerminationClause; projectContractInfo.EarlyTerminationClauseDetail = EarlyTerminationClauseDescription; projectContractInfo.RentPaymentArrangement = RentPaymentArrangement; projectContractInfo.HasDeposit = Deposit; projectContractInfo.DepositAmount = DepositAmount; projectContractInfo.RefundableDate = WhenRefund; projectContractInfo.WithPenaltyClause = withPenaltyClause; projectContractInfo.HasBankGuarantee = BankGuarantee; projectContractInfo.BGNumber = BankGuaranteeNumber; projectContractInfo.BGAmount = BankGuaranteeAmount; projectContractInfo.BGCommencementDate = BGCommencementDate; projectContractInfo.BGEndDate = BGEndDate; projectContractInfo.Add(); } var rebuildConsInfo = RebuildConsInfo.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory); if (rebuildConsInfo == null) { rebuildConsInfo = new RebuildConsInfo(); rebuildConsInfo.Id = Guid.NewGuid(); rebuildConsInfo.ProjectId = ProjectId; rebuildConsInfo.IsHistory = false; rebuildConsInfo.CreateTime = DateTime.Now; rebuildConsInfo.CreateUserAccount = ClientCookie.UserCode; rebuildConsInfo.Add(); } var reinvestmentBasicInfo = ReinvestmentBasicInfo.FirstOrDefault(i => i.ConsInfoID == rebuildConsInfo.Id); if (reinvestmentBasicInfo != null) { reinvestmentBasicInfo.EstimatedSeatNo = OriginalSeatNO; reinvestmentBasicInfo.RightSizingSeatNo = AfterRebuildSeatNO; reinvestmentBasicInfo.NewDesignType = AfterRebuildDesignType; reinvestmentBasicInfo.NewOperationSize = AfterRebuildOperationArea; reinvestmentBasicInfo.Update(); } else { reinvestmentBasicInfo = new ReinvestmentBasicInfo(); reinvestmentBasicInfo.ConsInfoID = rebuildConsInfo.Id; reinvestmentBasicInfo.EstimatedSeatNo = OriginalSeatNO; reinvestmentBasicInfo.RightSizingSeatNo = AfterRebuildSeatNO; reinvestmentBasicInfo.NewDesignType = AfterRebuildDesignType; reinvestmentBasicInfo.NewOperationSize = AfterRebuildOperationArea; reinvestmentBasicInfo.Add(); } var rebuildConsInvtChecking = RebuildConsInvtChecking.FirstOrDefault(i => i.ProjectId == ProjectId && !i.IsHistory); if (rebuildConsInvtChecking == null) { rebuildConsInvtChecking = new RebuildConsInvtChecking(); rebuildConsInvtChecking.Id = Guid.NewGuid(); rebuildConsInvtChecking.ProjectId = ProjectId; rebuildConsInvtChecking.IsHistory = false; rebuildConsInvtChecking.Add(); } var writeOffAmount = WriteOffAmount.FirstOrDefault(i => i.ConsInfoID == rebuildConsInvtChecking.Id); if (writeOffAmount != null) { writeOffAmount.TotalActual = Rebuild_TotalWO_Act; writeOffAmount.Update(); } else { writeOffAmount = new WriteOffAmount(); writeOffAmount.Id = Guid.NewGuid(); writeOffAmount.ConsInfoID = rebuildConsInvtChecking.Id; writeOffAmount.TotalActual = Rebuild_TotalWO_Act; writeOffAmount.Add(); } var reinvestmentCost = ReinvestmentCost.FirstOrDefault(i => i.ConsInfoID == rebuildConsInvtChecking.Id); if (reinvestmentCost != null) { reinvestmentCost.TotalReinvestmentFAAct = Rebuild_TotalReinvestment_Act; reinvestmentCost.Update(); } else { reinvestmentCost = new ReinvestmentCost(); reinvestmentCost.Id = Guid.NewGuid(); reinvestmentCost.ConsInfoID = rebuildConsInvtChecking.Id; reinvestmentCost.TotalReinvestmentFAAct = Rebuild_TotalReinvestment_Act; reinvestmentCost.Add(); } } tranScope.Complete(); } }
public static ReopenMemo GetReopenMemo(string projectId) { var memo = FirstOrDefault(e => e.ProjectId.Equals(projectId)); bool isEmptyMemo = false; if (memo == null) { memo = new ReopenMemo(); isEmptyMemo = true; } memo.ProjectId = projectId; if (projectId.ToLower().IndexOf("rebuild") >= 0) { var rbdInfo = new RebuildInfo(); memo.RbdInfo = rbdInfo.GetRebuildInfo(projectId); memo.Store = StoreBasicInfo.GetStore(memo.RbdInfo.USCode); var consInfo = new RebuildConsInfo(); consInfo = consInfo.GetConsInfo(projectId); var rein = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo(); memo.ReinvestInfo = rein; var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost(); memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget; if (!memo.ReopenDate.HasValue) { memo.ReopenDate = memo.ReinvestInfo.ReopenDate; } if (!memo.GBDate.HasValue) { memo.GBDate = memo.ReinvestInfo.GBDate; } var gbMemo = GBMemo.GetGBMemo(projectId); if (!memo.CompletionDate.HasValue && gbMemo != null) { memo.CompletionDate = gbMemo.ConstCompletionDate; } //if (string.IsNullOrEmpty(memo.DesignConcept)) // memo.DesignConcept = memo.ReinvestInfo.NewDesignType; var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount(); memo.WriteOff = writeoff; } else if (projectId.ToLower().IndexOf("reimage") >= 0) { memo.RmgInfo = ReimageInfo.GetReimageInfo(projectId); memo.Store = StoreBasicInfo.GetStore(memo.RmgInfo.USCode); var consInfo = ReimageConsInfo.GetConsInfo(projectId); var rein = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo(); memo.ReinvestInfo = rein; var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost(); memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget; if (!memo.ReopenDate.HasValue) { memo.ReopenDate = memo.ReinvestInfo.ReopenDate; } if (!memo.GBDate.HasValue) { memo.GBDate = memo.ReinvestInfo.GBDate; } var gbMemo = ReimageGBMemo.GetGBMemo(projectId); if (!memo.CompletionDate.HasValue && gbMemo != null) { memo.CompletionDate = gbMemo.ConstCompletionDate; } //if (string.IsNullOrEmpty(memo.DesignConcept)) // memo.DesignConcept = memo.ReinvestInfo.NewDesignType; var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount(); memo.WriteOff = writeoff; } else if (projectId.ToLower().IndexOf("majorlease") >= 0) { var mjrInfo = new MajorLeaseInfo().GetMajorLeaseInfo(projectId); memo.ReopenDate = mjrInfo.ReopenDate; memo.Store = StoreBasicInfo.GetStore(mjrInfo.USCode); var consInfo = new MajorLeaseConsInfo().GetConsInfo(projectId); var rein = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo(); memo.ReinvestInfo = rein; var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost(); memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget; if (!memo.ReopenDate.HasValue) { memo.ReopenDate = memo.ReinvestInfo.ReopenDate; } if (!memo.GBDate.HasValue) { memo.GBDate = memo.ReinvestInfo.GBDate; } var gbMemo = MajorLeaseGBMemo.GetGBMemo(projectId); if (!memo.CompletionDate.HasValue && gbMemo != null) { memo.CompletionDate = gbMemo.ConstCompletionDate; } //if (string.IsNullOrEmpty(memo.DesignConcept)) // memo.DesignConcept = memo.ReinvestInfo.NewDesignType; var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount(); memo.WriteOff = writeoff; } else if (projectId.ToLower().IndexOf("renewal") >= 0) { var renewalInfo = RenewalInfo.Get(projectId); memo.ReopenDate = renewalInfo.NewLeaseStartDate; memo.Store = StoreBasicInfo.GetStore(renewalInfo.USCode); var consInfo = RenewalConsInfo.Get(projectId); var rein = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo(); memo.ReinvestInfo = rein; var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost(); memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget; if (!memo.ReopenDate.HasValue) { memo.ReopenDate = memo.ReinvestInfo.ReopenDate; } if (!memo.GBDate.HasValue) { memo.GBDate = memo.ReinvestInfo.GBDate; } var gbMemo = RenewalGBMemo.GetGBMemo(projectId); if (!memo.CompletionDate.HasValue && gbMemo != null) { memo.CompletionDate = gbMemo.ConstCompletionDate; } //if (string.IsNullOrEmpty(memo.DesignConcept)) // memo.DesignConcept = memo.ReinvestInfo.NewDesignType; var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount(); memo.WriteOff = writeoff; } if (isEmptyMemo) { if (memo.ReinvestInfo != null) { if (memo.ReinvestInfo.NewMcCafe.HasValue && memo.ReinvestInfo.NewMcCafe.Value) { memo.NewMcCafe = true; } if ((memo.ReinvestInfo.NewAttachedKiosk.HasValue && memo.ReinvestInfo.NewAttachedKiosk.Value) || (memo.ReinvestInfo.NewRemoteKiosk.HasValue && memo.ReinvestInfo.NewRemoteKiosk.Value)) { memo.NewKiosk = true; } if (memo.ReinvestInfo.NewMDS.HasValue && memo.ReinvestInfo.NewMDS.Value) { memo.NewMDS = true; } if (memo.ReinvestInfo.NewTwientyFourHour.HasValue && memo.ReinvestInfo.NewTwientyFourHour.Value) { memo.Is24H = true; } //if (!string.IsNullOrEmpty(memo.ReinvestInfo.NewOperationSize)) //{ // memo.AftOperationSize = memo.ReinvestInfo.NewOperationSize; //} //if (!string.IsNullOrEmpty(memo.ReinvestInfo.EstimatedSeatNo)) //{ // memo.AftARSN = memo.ReinvestInfo.EstimatedSeatNo; //} } memo.TTMNetSales = GetTTFinanceData(memo.Store.StoreBasicInfo.StoreCode); } memo.PriceTiter = GetPriceTier(memo.Store.StoreBasicInfo.StoreCode); //if (string.IsNullOrEmpty(memo.AftARPT)) //{ // memo.AftARPT = memo.PriceTiter; //} //if (memo.Store != null) //{ // memo.OriginalOperationSize = memo.Store.StoreSTLocation.TotalArea; // memo.OriginalSeatNumber = memo.Store.StoreSTLocation.TotalSeatsNo; //} memo.YearMonthList = GetSelectYearMonth(memo.Store.StoreBasicInfo.StoreCode); if (isEmptyMemo) { SaveReopenMemo(memo); } return(memo); }