Esempio n. 1
0
        public static GBMemo GetGBMemo(string projectId, string entityId = "")
        {
            var memo = (string.IsNullOrEmpty(entityId) ?
                        FirstOrDefault(e => e.ProjectId.Equals(projectId) && !e.IsHistory)
                : FirstOrDefault(e => e.Id.ToString().Equals(entityId))) ?? new GBMemo();

            memo.ProjectId = projectId;

            var rbdInfo = new RebuildInfo();

            rbdInfo     = rbdInfo.GetRebuildInfo(projectId);
            memo.Info   = rbdInfo;
            memo.UsCode = rbdInfo.USCode;

            memo.Store = StoreBasicInfo.GetStore(memo.UsCode);
            var consInfo = new RebuildConsInfo();

            memo.ReinvestInfo = consInfo.GetReinvestmentBasicInfo(projectId);

            if (memo.Id == Guid.Empty)
            {
                memo.IsClosed      = (memo.Store.StoreBasicInfo.statusName == "Closed");
                memo.IsInOperation = false;

                if (memo.ReinvestInfo != null)
                {
                    if ((memo.ReinvestInfo.NewAttachedKiosk.HasValue && memo.ReinvestInfo.NewAttachedKiosk.Value) ||
                        (memo.ReinvestInfo.NewRemoteKiosk.HasValue && memo.ReinvestInfo.NewRemoteKiosk.Value))
                    {
                        memo.IsKiosk = true;
                    }
                    memo.IsMcCafe = memo.ReinvestInfo.NewMcCafe.HasValue && memo.ReinvestInfo.NewMcCafe.Value;
                    memo.IsMDS    = memo.ReinvestInfo.NewMDS.HasValue && memo.ReinvestInfo.NewMDS.Value;
                    memo.Is24Hour = memo.ReinvestInfo.NewTwientyFourHour.HasValue &&
                                    memo.ReinvestInfo.NewTwientyFourHour.Value;
                    memo.GBDate = memo.ReinvestInfo.GBDate;
                    memo.ConstCompletionDate = memo.ReinvestInfo.ConsCompletionDate;
                    memo.ReopenDate          = memo.ReinvestInfo.ReopenDate;
                }
                memo.Save();
            }
            else
            {
                var projectInfo = ProjectInfo.FirstOrDefault(e => e.ProjectId == projectId &&
                                                             e.FlowCode == FlowCode.Rebuild_GBMemo);
                if (projectInfo != null)
                {
                    //var rebuildInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == projectId);
                    if (rbdInfo != null &&
                        ClientCookie.UserCode.Equals(rbdInfo.PMAccount))
                    {
                        var isExistTask = TaskWork.Any(e => e.RefID == projectId &&
                                                       e.TypeCode == FlowCode.Rebuild_GBMemo &&
                                                       e.Status == TaskWorkStatus.UnFinish &&
                                                       e.ReceiverAccount == ClientCookie.UserCode &&
                                                       e.ActivityName == WorkflowActOriginator);
                        memo.IsShowEdit   = projectInfo.Status == ProjectStatus.Finished && !isExistTask;
                        memo.IsShowRecall = CheckIfShowRecallByPojectStatus(projectInfo.Status) && !isExistTask;
                    }
                }
            }
            if (ClientCookie.UserCode.Equals(rbdInfo.PMAccount))
            {
                memo.IsShowSave = ProjectInfo.IsFlowSavable(projectId, FlowCode.Rebuild_GBMemo);
            }
            PopulateAppUsers(memo);
            return(memo);
        }
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.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();
            }
        }
Esempio n. 3
0
        public static ReopenMemo GetReopenMemo(string projectId)
        {
            var  memo        = FirstOrDefault(e => e.ProjectId.Equals(projectId));
            bool isEmptyMemo = false;

            if (memo == null)
            {
                memo        = new ReopenMemo();
                isEmptyMemo = true;
            }

            memo.ProjectId = projectId;
            if (projectId.ToLower().IndexOf("rebuild") >= 0)
            {
                var rbdInfo = new RebuildInfo();
                memo.RbdInfo = rbdInfo.GetRebuildInfo(projectId);
                memo.Store   = StoreBasicInfo.GetStore(memo.RbdInfo.USCode);
                var consInfo = new RebuildConsInfo();
                consInfo = consInfo.GetConsInfo(projectId);
                var rein = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo();
                memo.ReinvestInfo = rein;
                var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost();
                memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget;
                if (!memo.ReopenDate.HasValue)
                {
                    memo.ReopenDate = memo.ReinvestInfo.ReopenDate;
                }
                if (!memo.GBDate.HasValue)
                {
                    memo.GBDate = memo.ReinvestInfo.GBDate;
                }
                var gbMemo = GBMemo.GetGBMemo(projectId);
                if (!memo.CompletionDate.HasValue && gbMemo != null)
                {
                    memo.CompletionDate = gbMemo.ConstCompletionDate;
                }
                //if (string.IsNullOrEmpty(memo.DesignConcept))
                //    memo.DesignConcept = memo.ReinvestInfo.NewDesignType;

                var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount();
                memo.WriteOff = writeoff;
            }
            else if (projectId.ToLower().IndexOf("reimage") >= 0)
            {
                memo.RmgInfo = ReimageInfo.GetReimageInfo(projectId);
                memo.Store   = StoreBasicInfo.GetStore(memo.RmgInfo.USCode);
                var consInfo = ReimageConsInfo.GetConsInfo(projectId);
                var rein     = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo();
                memo.ReinvestInfo = rein;
                var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost();
                memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget;
                if (!memo.ReopenDate.HasValue)
                {
                    memo.ReopenDate = memo.ReinvestInfo.ReopenDate;
                }
                if (!memo.GBDate.HasValue)
                {
                    memo.GBDate = memo.ReinvestInfo.GBDate;
                }
                var gbMemo = ReimageGBMemo.GetGBMemo(projectId);
                if (!memo.CompletionDate.HasValue && gbMemo != null)
                {
                    memo.CompletionDate = gbMemo.ConstCompletionDate;
                }
                //if (string.IsNullOrEmpty(memo.DesignConcept))
                //    memo.DesignConcept = memo.ReinvestInfo.NewDesignType;
                var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount();
                memo.WriteOff = writeoff;
            }
            else if (projectId.ToLower().IndexOf("majorlease") >= 0)
            {
                var mjrInfo = new MajorLeaseInfo().GetMajorLeaseInfo(projectId);
                memo.ReopenDate = mjrInfo.ReopenDate;
                memo.Store      = StoreBasicInfo.GetStore(mjrInfo.USCode);
                var consInfo = new MajorLeaseConsInfo().GetConsInfo(projectId);
                var rein     = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo();
                memo.ReinvestInfo = rein;
                var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost();
                memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget;
                if (!memo.ReopenDate.HasValue)
                {
                    memo.ReopenDate = memo.ReinvestInfo.ReopenDate;
                }
                if (!memo.GBDate.HasValue)
                {
                    memo.GBDate = memo.ReinvestInfo.GBDate;
                }
                var gbMemo = MajorLeaseGBMemo.GetGBMemo(projectId);
                if (!memo.CompletionDate.HasValue && gbMemo != null)
                {
                    memo.CompletionDate = gbMemo.ConstCompletionDate;
                }
                //if (string.IsNullOrEmpty(memo.DesignConcept))
                //    memo.DesignConcept = memo.ReinvestInfo.NewDesignType;
                var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount();
                memo.WriteOff = writeoff;
            }
            else if (projectId.ToLower().IndexOf("renewal") >= 0)
            {
                var renewalInfo = RenewalInfo.Get(projectId);
                memo.ReopenDate = renewalInfo.NewLeaseStartDate;
                memo.Store      = StoreBasicInfo.GetStore(renewalInfo.USCode);
                var consInfo = RenewalConsInfo.Get(projectId);
                var rein     = ReinvestmentBasicInfo.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentBasicInfo();
                memo.ReinvestInfo = rein;
                var recos = ReinvestmentCost.GetByConsInfoId(consInfo.Id) ?? new ReinvestmentCost();
                memo.TotalReinvestmentBudget = recos.TotalReinvestmentBudget;
                if (!memo.ReopenDate.HasValue)
                {
                    memo.ReopenDate = memo.ReinvestInfo.ReopenDate;
                }
                if (!memo.GBDate.HasValue)
                {
                    memo.GBDate = memo.ReinvestInfo.GBDate;
                }
                var gbMemo = RenewalGBMemo.GetGBMemo(projectId);
                if (!memo.CompletionDate.HasValue && gbMemo != null)
                {
                    memo.CompletionDate = gbMemo.ConstCompletionDate;
                }
                //if (string.IsNullOrEmpty(memo.DesignConcept))
                //    memo.DesignConcept = memo.ReinvestInfo.NewDesignType;
                var writeoff = WriteOffAmount.GetByConsInfoId(consInfo.Id) ?? new WriteOffAmount();
                memo.WriteOff = writeoff;
            }
            if (isEmptyMemo)
            {
                if (memo.ReinvestInfo != null)
                {
                    if (memo.ReinvestInfo.NewMcCafe.HasValue && memo.ReinvestInfo.NewMcCafe.Value)
                    {
                        memo.NewMcCafe = true;
                    }
                    if ((memo.ReinvestInfo.NewAttachedKiosk.HasValue && memo.ReinvestInfo.NewAttachedKiosk.Value) ||
                        (memo.ReinvestInfo.NewRemoteKiosk.HasValue && memo.ReinvestInfo.NewRemoteKiosk.Value))
                    {
                        memo.NewKiosk = true;
                    }
                    if (memo.ReinvestInfo.NewMDS.HasValue && memo.ReinvestInfo.NewMDS.Value)
                    {
                        memo.NewMDS = true;
                    }
                    if (memo.ReinvestInfo.NewTwientyFourHour.HasValue && memo.ReinvestInfo.NewTwientyFourHour.Value)
                    {
                        memo.Is24H = true;
                    }
                    //if (!string.IsNullOrEmpty(memo.ReinvestInfo.NewOperationSize))
                    //{
                    //    memo.AftOperationSize = memo.ReinvestInfo.NewOperationSize;
                    //}
                    //if (!string.IsNullOrEmpty(memo.ReinvestInfo.EstimatedSeatNo))
                    //{
                    //    memo.AftARSN = memo.ReinvestInfo.EstimatedSeatNo;
                    //}
                }
                memo.TTMNetSales = GetTTFinanceData(memo.Store.StoreBasicInfo.StoreCode);
            }
            memo.PriceTiter = GetPriceTier(memo.Store.StoreBasicInfo.StoreCode);
            //if (string.IsNullOrEmpty(memo.AftARPT))
            //{
            //    memo.AftARPT = memo.PriceTiter;
            //}
            //if (memo.Store != null)
            //{
            //    memo.OriginalOperationSize = memo.Store.StoreSTLocation.TotalArea;
            //    memo.OriginalSeatNumber = memo.Store.StoreSTLocation.TotalSeatsNo;
            //}
            memo.YearMonthList = GetSelectYearMonth(memo.Store.StoreBasicInfo.StoreCode);
            if (isEmptyMemo)
            {
                SaveReopenMemo(memo);
            }
            return(memo);
        }