Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
        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();
            }
        }
Esempio n. 3
0
        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();
            }
        }