Exemplo n.º 1
0
        public void GenerateConsInvtCheckingTask(bool isScheduled = false)
        {
            var rbdInfo = RebuildInfo.Search(e => e.ProjectId.Equals(ProjectId)).AsNoTracking().FirstOrDefault();

            if (rbdInfo == null)
            {
                throw new Exception("Could not find the Rebuild Info, please check it!");
            }
            var taskUrl = string.Format(@"/Rebuild/Main#/ConsInvtChecking?projectId={0}", ProjectId);
            var task    = rbdInfo.GenerateTaskWork(WorkflowCode, WorkflowCode, WorkflowCode, taskUrl);

            task.ActivityName = NodeCode.Start;
            task.ActionName   = SetTaskActionName(ProjectId);
            if (!isScheduled)
            {
                TaskWork.Add(task);
            }
            else
            {
                if (rbdInfo.ConstCompletionDate.HasValue)
                {
                    ScheduleLog.GenerateTaskSchedule(rbdInfo.ConstCompletionDate.Value.AddDays(60), task, ClientCookie.UserCode, ProjectId, FlowCode.Rebuild_ConsInvtChecking, rbdInfo.USCode);
                }
            }
        }
Exemplo n.º 2
0
        public override void GenerateDefaultWorkflowInfo(string projectId)
        {
            var entity = new RebuildConsInfo();

            entity.ProjectId          = projectId;
            entity.Id                 = Guid.NewGuid();
            entity.CreateTime         = DateTime.Now;
            entity.CreateUserAccount  = ClientCookie.UserCode;
            entity.CreateUserNameENUS = ClientCookie.UserNameENUS;
            entity.CreateUserNameZHCN = ClientCookie.UserNameZHCN;
            entity.IsHistory          = false;

            var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == projectId);

            if (rbdInfo != null)
            {
                entity.ReinBasicInfo = new ReinvestmentBasicInfo
                {
                    GBDate             = rbdInfo.GBDate,
                    ReopenDate         = rbdInfo.ReopenDate,
                    ConsCompletionDate = rbdInfo.ConstCompletionDate
                };
            }
            Add(entity);
        }
Exemplo n.º 3
0
        public static void PopulateAppUsers(GBMemo entity)
        {
            var approvedUsers = ApproveDialogUser.GetApproveDialogUser(entity.Id.ToString());

            entity.AppUsers = new ApproveUsers();
            if (approvedUsers != null)
            {
                var simp = new SimpleEmployee
                {
                    Code = approvedUsers.ConstructionManagerCode
                };
                entity.AppUsers.ConstructionManager = simp;
            }
            else
            {
                var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == entity.ProjectId);
                if (rbdInfo != null)
                {
                    var simp = new SimpleEmployee
                    {
                        Code = rbdInfo.CMAccount
                    };
                    entity.AppUsers.ConstructionManager = simp;
                }
            }
        }
Exemplo n.º 4
0
        private int?StartProcess(TaskWork task)
        {
            CreateUserAccount = LastUpdateUserAccount;
            var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId.Equals(ProjectId));

            if (rbdInfo == null)
            {
                throw new Exception("Could not find the Rebuild Info, please check it!");
            }
            var processDataFields = SetWorkflowDataFields(task);

            return(K2FxContext.Current.StartProcess(WorkflowProcessCode, CreateUserAccount, processDataFields));
        }
Exemplo n.º 5
0
        public void Save(string action = "")
        {
            using (var scope = new TransactionScope())
            {
                if (Id == Guid.Empty)
                {
                    Id                 = Guid.NewGuid();
                    CreateTime         = DateTime.Now;
                    LastUpdateTime     = DateTime.Now;
                    CreateUserAccount  = ClientCookie.UserCode;
                    CreateUserNameZHCN = ClientCookie.UserNameZHCN;
                    CreateUserNameENUS = ClientCookie.UserNameENUS;
                    IsHistory          = false;
                    Add(this);
                }
                else
                {
                    LastUpdateTime = DateTime.Now;
                    Update(this);
                }
                if (ReinBasicInfo != null)
                {
                    ReinBasicInfo.ConsInfoID = Id;
                    ReinBasicInfo.Save();
                    var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == ProjectId);
                    if (rbdInfo != null)
                    {
                        rbdInfo.GBDate              = ReinBasicInfo.GBDate;
                        rbdInfo.ReopenDate          = ReinBasicInfo.ReopenDate;
                        rbdInfo.ConstCompletionDate = ReinBasicInfo.ConsCompletionDate;
                        rbdInfo.Update();
                    }
                }

                if (ReinCost != null)
                {
                    ReinCost.ConsInfoID = Id;
                    ReinCost.SaveByRebuild();
                }

                if (WriteOff != null)
                {
                    WriteOff.ConsInfoID = Id;
                    WriteOff.SaveByRebuild();
                }

                SaveApproveUsers(action);
                SaveComments(action);
                scope.Complete();
            }
        }
Exemplo n.º 6
0
        public override string Edit()
        {
            var taskUrl = string.Format("/Rebuild/Main#/LegalReview?projectId={0}", ProjectId);

            using (var scope = new TransactionScope())
            {
                var rbdInfo = RebuildInfo.Search(e => e.ProjectId.Equals(ProjectId)).FirstOrDefault();
                if (rbdInfo == null)
                {
                    throw new Exception("Could not find the Rebuild Info, please check it!");
                }
                TaskWork.Cancel(t => t.RefID == ProjectId && t.Status == TaskWorkStatus.UnFinish && t.TypeCode == this.WorkflowCode);//取消老的流程实例的所有未完成任务
                var task = rbdInfo.GenerateTaskWork(WorkflowCode,
                                                    "RebuildLegalReview",
                                                    "RebuildLegalReview",
                                                    taskUrl);
                task.ActivityName = NodeCode.Start;
                task.ActionName   = SetTaskActionName(ProjectId);
                TaskWork.Add(task);

                var package = RebuildPackage.GetRebuildPackageInfo(ProjectId);
                if (package != null)
                {
                    package.ProjectId = ProjectId;
                    package.CompleteActorPackageTask(rbdInfo.AssetActorAccount);
                }

                IsHistory = true;
                Update(this);

                ProjectInfo.Reset(ProjectId, WorkflowCode);

                Mapper.CreateMap <RebuildLegalReview, RebuildLegalReview>();
                var newLeaseLR = Mapper.Map <RebuildLegalReview>(this);
                newLeaseLR.Id         = Guid.Empty;
                newLeaseLR.ProcInstID = null;
                newLeaseLR.IsHistory  = false;
                newLeaseLR.Comments   = null;
                newLeaseLR.Save("Edit");

                CopyAttachment(Id.ToString(), newLeaseLR.Id.ToString());
                CopyAppUsers(Id.ToString(), newLeaseLR.Id.ToString());
                scope.Complete();
            }

            return(taskUrl);
        }
Exemplo n.º 7
0
        public override string Edit()
        {
            var taskUrl = string.Format("/Rebuild/Main#/ConsInfo?projectId={0}", ProjectId);

            using (var scope = new TransactionScope())
            {
                var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId.Equals(ProjectId));
                if (rbdInfo == null)
                {
                    throw new Exception("Could not find the Rebuild Info, please check it!");
                }
                var task = rbdInfo.GenerateTaskWork(FlowCode.Rebuild_ConsInfo, WorkflowCode, WorkflowCode, taskUrl);
                task.ActivityName = NodeCode.Start;
                task.ActionName   = SetTaskActionName(ProjectId);
                TaskWork.Add(task);

                var package = RebuildPackage.GetRebuildPackageInfo(ProjectId);
                if (package != null)
                {
                    package.ProjectId = ProjectId;
                    package.CompleteActorPackageTask(rbdInfo.AssetActorAccount);
                }

                IsHistory = true;
                Update(this);

                ProjectInfo.Reset(ProjectId, FlowCode.Rebuild_ConsInfo);

                Mapper.CreateMap <RebuildConsInfo, RebuildConsInfo>();
                var form = Mapper.Map <RebuildConsInfo>(this);
                form.Id         = Guid.Empty;
                form.ProcInstID = null;
                form.IsHistory  = false;
                form.Comments   = null;
                form.Save("Edit");

                CopyAttachment(Id.ToString(), form.Id.ToString());
                CopyAppUsers(Id.ToString(), form.Id.ToString());
                CopyReinvestmentBasicInfo(ReinBasicInfo, Id);
                CopyReinvestmentCost(ReinCost, Id);
                CopyWriteOffAmount(WriteOff, Id);
                scope.Complete();
            }

            return(taskUrl);
        }
Exemplo n.º 8
0
        public override string Edit()
        {
            var taskUrl = string.Format("/Rebuild/Main#/GBMemo?projectId={0}", ProjectId);

            using (var scope = new TransactionScope())
            {
                var rbdInfo = RebuildInfo.Search(e => e.ProjectId.Equals(ProjectId)).FirstOrDefault();
                if (rbdInfo == null)
                {
                    throw new Exception("Could not find the Rebuild Info, please check it!");
                }
                var task = rbdInfo.GenerateTaskWork(WorkflowCode, "Rebuild GBMemo", "Rebuild GBMemo", taskUrl);
                task.ActivityName = NodeCode.Start;
                task.ActionName   = SetTaskActionName(ProjectId);
                TaskWork.Add(task);
                ProjectInfo.Reset(ProjectId, WorkflowCode);

                if (IsInOperation)
                {
                    ProjectInfo.Reset(ProjectId, FlowCode.Rebuild_ReopenMemo);
                    ProjectInfo.Reset(ProjectId, FlowCode.Rebuild_TempClosureMemo);
                }
                else
                {
                    CompleteNotFinishTask();
                }

                CompleteNotifyTask(ProjectId);
                IsHistory = true;
                Update(this);

                Mapper.CreateMap <GBMemo, GBMemo>();
                var entity = Mapper.Map <GBMemo>(this);
                entity.Id         = Guid.Empty;
                entity.ProcInstID = null;
                entity.IsHistory  = false;
                entity.Comments   = null;
                entity.Save("Edit");

                CopyAppUsers(Id.ToString(), entity.Id.ToString());

                scope.Complete();
            }

            return(taskUrl);
        }
Exemplo n.º 9
0
        public RebuildConsInvtChecking GetConsInvtChecking(string strProjectId, string entityId = "")
        {
            ProjectId = strProjectId;
            RebuildConsInvtChecking entity = null;

            if (string.IsNullOrEmpty(entityId))
            {
                entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault();
            }
            else
            {
                entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault();
            }

            var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == strProjectId);

            UsCode = rbdInfo.USCode;
            if (entity != null)
            {
                entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId);
                entity.ApprovalType     = entity.GetApprovalType();

                entity.IsShowEdit   = ProjectInfo.IsFlowEditable(strProjectId, FlowCode.Rebuild_ConsInvtChecking);
                entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, FlowCode.Rebuild_ConsInvtChecking);
            }
            else
            {
                entity = new RebuildConsInvtChecking();
                entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId);
                entity.ProjectId        = strProjectId;
            }
            if (ClientCookie.UserCode.Equals(rbdInfo.PMAccount))
            {
                entity.IsShowSave = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.Rebuild_ConsInvtChecking);
            }
            PopulateAppUsers(entity);
            return(entity);
        }
Exemplo n.º 10
0
        public static GBMemo GetGBMemo(string projectId)
        {
            var memo = FirstOrDefault(e => e.ProjectId.Equals(projectId) && !e.IsHistory);

            if (memo == null)
            {
                memo = new GBMemo();
            }

            memo.ProjectId = projectId;
            string usCode = "";

            if (projectId.ToLower().IndexOf("rebuild") >= 0)
            {
                var rbdInfo = new RebuildInfo();
                rbdInfo   = rbdInfo.GetRebuildInfo(projectId);
                memo.Info = rbdInfo;
                usCode    = rbdInfo.USCode;
            }
            if (projectId.ToLower().IndexOf("reimage") >= 0)
            {
                var reimageInfo = ReimageInfo.GetReimageInfo(projectId);
                memo.rmgInfo = reimageInfo;
                usCode       = reimageInfo.USCode;
            }
            memo.Store = StoreBasicInfo.GetStore(usCode);

            if (memo.Store.Hour24Count == 24)
            {
                memo.Is24Hour = true;
            }
            else
            {
                memo.Is24Hour = false;
            }
            return(memo);
        }
Exemplo n.º 11
0
        public RebuildConsInfo GetConsInfo(string strProjectId, string entityId = "")
        {
            RebuildConsInfo entity = null;

            if (string.IsNullOrEmpty(entityId))
            {
                entity = Search(e => e.ProjectId.Equals(strProjectId) && !e.IsHistory).FirstOrDefault();
            }
            else
            {
                entity = Search(e => e.Id.ToString().Equals(entityId)).FirstOrDefault();
            }

            if (entity != null)
            {
                entity.IsProjectFreezed = CheckIfFreezeProject(strProjectId);
                entity.ReinCost         = ReinvestmentCost.GetByConsInfoId(entity.Id);
                entity.ReinBasicInfo    = ReinvestmentBasicInfo.GetByConsInfoId(entity.Id);
                var attachmentReinCost = Attachment.FirstOrDefault(e => e.RefTableID == entity.Id.ToString() && e.TypeCode == "ReinCost");
                if (entity.ReinCost != null && attachmentReinCost != null)
                {
                    entity.ReinCost.ReinCostUser = attachmentReinCost.CreatorNameENUS;
                    entity.ReinCost.ReinCostTime = attachmentReinCost.CreateTime;
                }

                if (entity.ReinBasicInfo == null)
                {
                    var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == strProjectId);
                    if (rbdInfo != null)
                    {
                        entity.ReinBasicInfo = new ReinvestmentBasicInfo
                        {
                            GBDate             = rbdInfo.GBDate,
                            ReopenDate         = rbdInfo.ReopenDate,
                            ConsCompletionDate = rbdInfo.ConstCompletionDate
                        };
                    }
                }
                entity.WriteOff = WriteOffAmount.GetByConsInfoId(entity.Id);
                var attachmentWriteOff = Attachment.FirstOrDefault(e => e.RefTableID == entity.Id.ToString() && e.TypeCode == "WriteOff");
                if (entity.WriteOff != null && attachmentWriteOff != null)
                {
                    entity.WriteOff.WriteOffUser = attachmentWriteOff.CreatorNameENUS;
                    entity.WriteOff.WriteOffTime = attachmentWriteOff.CreateTime;
                }

                entity.IsShowEdit   = ProjectInfo.IsFlowEditable(strProjectId, FlowCode.Rebuild_ConsInfo);
                entity.IsShowRecall = ProjectInfo.IsFlowRecallable(strProjectId, FlowCode.Rebuild_ConsInfo);
                entity.IsShowSave   = ProjectInfo.IsFlowSavable(strProjectId, FlowCode.Rebuild_ConsInfo);
            }
            else
            {
                var rbdInfo = RebuildInfo.FirstOrDefault(e => e.ProjectId == strProjectId);
                if (rbdInfo != null)
                {
                    entity = new RebuildConsInfo
                    {
                        ReinBasicInfo =
                            new ReinvestmentBasicInfo
                        {
                            GBDate     = rbdInfo.GBDate,
                            ReopenDate = rbdInfo.ReopenDate
                        },
                        IsProjectFreezed = CheckIfFreezeProject(strProjectId),
                        ProjectId        = strProjectId
                    };
                }
            }
            PopulateAppUsers(entity);
            return(entity);
        }
Exemplo n.º 12
0
        public static TempClosureMemo GetTempClosureMemo(string projectId)
        {
            var memo = FirstOrDefault(e => e.ProjectId.Equals(projectId));

            if (memo == null)
            {
                memo           = new TempClosureMemo();
                memo.ProjectId = projectId;
                var eac = new EstimatedVsActualConstruction();
                if (projectId.ToLower().IndexOf("rebuild") >= 0)
                {
                    var rbdInfo = new RebuildInfo();
                    rbdInfo = rbdInfo.GetRebuildInfo(projectId);
                    var store = StoreBasicInfo.GetStore(rbdInfo.USCode);
                    eac = eac.GetEAC(rbdInfo.Id);
                    if (rbdInfo != null)
                    {
                        memo.ClosureDate = rbdInfo.TempClosureDate;
                    }
                    if (store != null)
                    {
                        memo.RegionCode     = store.StoreBasicInfo.RegionCode;
                        memo.RegionNameENUS = store.StoreBasicInfo.RegionENUS;
                        memo.RegionNameZHCN = store.StoreBasicInfo.RegionZHCN;

                        memo.MarketCode     = store.StoreBasicInfo.MarketCode;
                        memo.MarketNameENUS = store.StoreBasicInfo.MarketENUS;
                        memo.MarketNameZHCN = store.StoreBasicInfo.MarketZHCN;

                        memo.ProvinceNameENUS = store.StoreBasicInfo.ProvinceENUS;
                        memo.ProvinceNameZHCN = store.StoreBasicInfo.ProvinceZHCN;

                        memo.CityCode     = store.StoreBasicInfo.CityCode;
                        memo.CityNameENUS = store.StoreBasicInfo.CityENUS;
                        memo.CityNameZHCN = store.StoreBasicInfo.CityZHCN;

                        memo.StoreNameENUS = store.StoreBasicInfo.NameENUS;
                        memo.StoreNameZHCN = store.StoreBasicInfo.NameZHCN;

                        memo.StoreAddressENUS = store.StoreBasicInfo.AddressENUS;
                        memo.StoreAddressZHCN = store.StoreBasicInfo.AddressZHCN;

                        memo.USCode   = store.StoreBasicInfo.StoreCode;
                        memo.OpenDate = store.StoreBasicInfo.OpenDate;
                    }
                }
                else if (projectId.ToLower().IndexOf("reimage") >= 0)
                {
                    var rmgInfo = ReimageInfo.GetReimageInfo(projectId);
                    var store   = StoreBasicInfo.GetStore(rmgInfo.USCode);
                    eac = eac.GetEAC(rmgInfo.Id);
                    memo.ClosureDate = DateTime.Now;
                    if (store != null)
                    {
                        memo.RegionCode     = store.StoreBasicInfo.RegionCode;
                        memo.RegionNameENUS = store.StoreBasicInfo.RegionENUS;
                        memo.RegionNameZHCN = store.StoreBasicInfo.RegionZHCN;

                        memo.MarketCode     = store.StoreBasicInfo.MarketCode;
                        memo.MarketNameENUS = store.StoreBasicInfo.MarketENUS;
                        memo.MarketNameZHCN = store.StoreBasicInfo.MarketZHCN;

                        memo.ProvinceNameENUS = store.StoreBasicInfo.ProvinceENUS;
                        memo.ProvinceNameZHCN = store.StoreBasicInfo.ProvinceZHCN;

                        memo.CityCode     = store.StoreBasicInfo.CityCode;
                        memo.CityNameENUS = store.StoreBasicInfo.CityENUS;
                        memo.CityNameZHCN = store.StoreBasicInfo.CityZHCN;

                        memo.StoreNameENUS = store.StoreBasicInfo.NameENUS;
                        memo.StoreNameZHCN = store.StoreBasicInfo.NameZHCN;

                        memo.StoreAddressENUS = store.StoreBasicInfo.AddressENUS;
                        memo.StoreAddressZHCN = store.StoreBasicInfo.AddressZHCN;

                        memo.USCode   = store.StoreBasicInfo.StoreCode;
                        memo.OpenDate = store.StoreBasicInfo.OpenDate;
                    }
                }
                memo.Save();
            }
            return(memo);
        }
Exemplo n.º 13
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();
            }
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
0
        public override void Finish(TaskWorkStatus status, TaskWork task)
        {
            using (var scope = new TransactionScope())
            {
                switch (status)
                {
                case TaskWorkStatus.K2ProcessApproved:
                    RebuildInfo rbdInfo = RebuildInfo.Search(e => e.ProjectId.Equals(ProjectId)).FirstOrDefault();
                    ProjectInfo.FinishNode(ProjectId, FlowCode.Rebuild_GBMemo, NodeCode.Finish, ProjectStatus.Finished);
                    if (IsInOperation)
                    {
                        //CompleteNotFinishTask();
                        ProjectInfo.FinishNode(ProjectId, FlowCode.Rebuild_ReopenMemo, NodeCode.Finish, ProjectStatus.Finished);
                        ProjectInfo.FinishNode(ProjectId, FlowCode.Rebuild_TempClosureMemo, NodeCode.Finish, ProjectStatus.Finished);
                    }
                    else
                    {
                        var taskUrlReopen = string.Format(@"/Rebuild/Main#/ReopenMemo?projectId={0}", ProjectId);
                        var taskReopen    = rbdInfo.GenerateTaskWork(FlowCode.Rebuild_ReopenMemo, "Reopen Memo",
                                                                     "Reopen Memo", taskUrlReopen);
                        taskReopen.ActivityName = NodeCode.Start;
                        taskReopen.ActionName   = SetTaskActionName(ProjectId);
                        //TaskWork.Add(taskReopen);
                        if (rbdInfo.ReopenDate.HasValue)
                        {
                            ScheduleLog.GenerateTaskSchedule(rbdInfo.ReopenDate.Value.AddDays(-7), taskReopen, ClientCookie.UserCode, ProjectId, FlowCode.Rebuild_ReopenMemo, rbdInfo.USCode);
                        }

                        ProjectInfo.Reset(ProjectId, FlowCode.Rebuild_ReopenMemo);

                        var taskUrlClosure = string.Format(@"/Rebuild/Main#/TempClosureMemo?projectId={0}",
                                                           ProjectId);
                        var taskClosure = rbdInfo.GenerateTaskWork(FlowCode.Rebuild_TempClosureMemo,
                                                                   "TempClosure Memo", "TempClosure Memo", taskUrlClosure);
                        taskClosure.ActivityName = NodeCode.Start;
                        taskClosure.ActionName   = SetTaskActionName(ProjectId);
                        TaskWork.Add(taskClosure);
                        ProjectInfo.Reset(ProjectId, FlowCode.Rebuild_TempClosureMemo);
                    }

                    var consCheckingTask = TaskWork.FirstOrDefault(e => e.RefID == ProjectId && e.TypeCode == FlowCode.Rebuild_ConsInvtChecking && e.Status == TaskWorkStatus.UnFinish);
                    var checkingProj     = ProjectInfo.FirstOrDefault(e => e.ProjectId == ProjectId && e.FlowCode == FlowCode.Rebuild_ConsInvtChecking);
                    if (consCheckingTask == null && checkingProj != null &&
                        checkingProj.Status != ProjectStatus.Finished)
                    {
                        var consInvtChecking = new RebuildConsInvtChecking();
                        consInvtChecking.ProjectId = task.RefID;
                        consInvtChecking.GenerateConsInvtCheckingTask(true);
                    }

                    ProjectInfo.CompleteMainIfEnable(ProjectId);
                    var pmTaskUrl = string.Format(@"/Rebuild/Main#/GBMemo/Process/Notify?projectId={0}", ProjectId);
                    var pmTask    = rbdInfo.GenerateTaskWork(WorkflowCode, "Rebuild GBMemo", "Rebuild GBMemo",
                                                             pmTaskUrl);
                    pmTask.ActivityName = "Notify";
                    pmTask.ActionName   = "Notify";
                    TaskWork.Add(pmTask);
                    break;

                case TaskWorkStatus.K2ProcessDeclined:
                    ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.Rebuild, ProjectStatus.Rejected);
                    ProjectInfo.UpdateProjectStatus(ProjectId, FlowCode.Rebuild_GBMemo, ProjectStatus.Rejected);
                    break;
                }
                scope.Complete();
            }
        }
Exemplo n.º 16
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);
        }