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 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.Closure, USCode, NodeCode.Start, ClientCookie.UserCode, pushOrNot); var closureInfo = new ClosureInfo(); closureInfo.Id = Guid.NewGuid(); closureInfo.ProjectId = ProjectId; closureInfo.USCode = USCode; closureInfo.ActualCloseDate = CloseDate; closureInfo.ClosureTypeCode = ClosureTypeCode; closureInfo.ClosureReasonCode = ClosureReasonCode; closureInfo.ClosureReasonRemark = ClosureReasonRemark; closureInfo.RelocationCode = RelocationCode; closureInfo.CreateDate = DateTime.Now; closureInfo.CreateUserAccount = ClientCookie.UserCode; closureInfo.CreateUserNameENUS = ClientCookie.UserNameENUS; closureInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN; closureInfo.Add(); var closurePackage = new ClosurePackage(); closurePackage.Id = Guid.NewGuid(); closurePackage.ProjectId = ProjectId; closurePackage.RelocationPipelineID = RelocatedPipelineID; closurePackage.IsHistory = false; closurePackage.CreateUserAccount = ClientCookie.UserCode; closurePackage.CreateTime = DateTime.Now; closurePackage.Add(); var closureConsInvtChecking = new ClosureConsInvtChecking(); closureConsInvtChecking.Id = Guid.NewGuid(); closureConsInvtChecking.ProjectId = ProjectId; closureConsInvtChecking.IsHistory = false; closureConsInvtChecking.CreateTime = DateTime.Now; closureConsInvtChecking.TotalActual = Closure_WO_Total_Act; closureConsInvtChecking.ClosingCostActual = Closure_ClosingCost_Act; closureConsInvtChecking.Add(); var closureMemo = new ClosureMemo(); closureMemo.Id = Guid.NewGuid(); closureMemo.ProjectId = ProjectId; closureMemo.CreateTime = DateTime.Now; closureMemo.ClosureNature = ClosureNatureType.Permanent; closureMemo.Status = true; closureMemo.Compensation = Closure_Compensation_Act; closureMemo.Add(); } else { ProjectId = projectInfo.ProjectId; projectInfo.IsPushed = pushOrNot; projectInfo.Update(); var closureInfo = ClosureInfo.FirstOrDefault(i => i.ProjectId == ProjectId); if (closureInfo != null) { closureInfo.ActualCloseDate = CloseDate; closureInfo.ClosureTypeCode = ClosureTypeCode; closureInfo.ClosureReasonCode = ClosureReasonCode; closureInfo.ClosureReasonRemark = ClosureReasonRemark; closureInfo.RelocationCode = RelocationCode; closureInfo.Update(); } else { closureInfo = new ClosureInfo(); closureInfo.Id = Guid.NewGuid(); closureInfo.ProjectId = ProjectId; closureInfo.USCode = USCode; closureInfo.ActualCloseDate = CloseDate; closureInfo.ClosureTypeCode = ClosureTypeCode; closureInfo.ClosureReasonCode = ClosureReasonCode; closureInfo.ClosureReasonRemark = ClosureReasonRemark; closureInfo.RelocationCode = RelocationCode; closureInfo.CreateDate = DateTime.Now; closureInfo.CreateUserAccount = ClientCookie.UserCode; closureInfo.CreateUserNameENUS = ClientCookie.UserNameENUS; closureInfo.CreateUserNameZHCN = ClientCookie.UserNameZHCN; closureInfo.Add(); } var closurePackage = ClosurePackage.Get(ProjectId); if (closurePackage != null) { closurePackage.RelocationPipelineID = RelocatedPipelineID; closurePackage.Update(); } else { closurePackage = new ClosurePackage(); closurePackage.Id = Guid.NewGuid(); closurePackage.ProjectId = ProjectId; closurePackage.RelocationPipelineID = RelocatedPipelineID; closurePackage.IsHistory = false; closurePackage.CreateUserAccount = ClientCookie.UserCode; closurePackage.CreateTime = DateTime.Now; closurePackage.Add(); } var closureConsInvtChecking = ClosureConsInvtChecking.Get(ProjectId); if (closureConsInvtChecking != null) { closureConsInvtChecking.TotalActual = Closure_WO_Total_Act; closureConsInvtChecking.ClosingCostActual = Closure_ClosingCost_Act; closureConsInvtChecking.Update(); } else { closureConsInvtChecking = new ClosureConsInvtChecking(); closureConsInvtChecking.Id = Guid.NewGuid(); closureConsInvtChecking.ProjectId = ProjectId; closureConsInvtChecking.IsHistory = false; closureConsInvtChecking.CreateTime = DateTime.Now; closureConsInvtChecking.TotalActual = Closure_WO_Total_Act; closureConsInvtChecking.ClosingCostActual = Closure_ClosingCost_Act; closureConsInvtChecking.Add(); } var closureMemo = ClosureMemo.FirstOrDefault(i => i.ProjectId == ProjectId); if (closureMemo != null) { closureMemo.Compensation = Closure_Compensation_Act; closureMemo.Update(); } else { closureMemo = new ClosureMemo(); closureMemo.Id = Guid.NewGuid(); closureMemo.ProjectId = ProjectId; closureMemo.CreateTime = DateTime.Now; closureMemo.ClosureNature = ClosureNatureType.Permanent; closureMemo.Status = true; closureMemo.Compensation = Closure_Compensation_Act; closureMemo.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 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(); } }