Exemplo n.º 1
0
        /// <summary>
        /// 根据角色名称获取用户-简单用户对象
        /// </summary>
        /// <param name="storeCode">Store US Code</param>
        /// <param name="roleCodes">RoleCode组合</param>
        /// <returns>UserCode,RoleCode</returns>
        public static Dictionary <string, string> GetStoreEmployeesRoleCodeByMultiRoles(string storeCode, string[] roleCodes)
        {
            var db = PrepareDb();
            Dictionary <string, string> result = new Dictionary <string, string>();
            var storeEntry = new StoreBasicInfo();
            //获取Store的Region/Market/City的Code
            var store = StoreBasicInfo.GetStore(storeCode);

            foreach (var roleCode in roleCodes)
            {
                string rc = roleCode.Trim();
                switch (rc)
                {
                case "Asset_Rep":
                    var reps = GetStoreAssetRepByStoreCode(storeCode);
                    foreach (var rep in reps)
                    {
                        result.Add(rep.Code, rc);
                    }
                    break;

                case "Asset_Mgr":
                    var repMgrs = GetStoreAssetRepMgrByStoreCode(storeCode);
                    foreach (var repMgr in repMgrs)
                    {
                        result.Add(repMgr.Code, rc);
                    }
                    break;

                default:
                    RoleCode roleEnum;
                    if (Enum.TryParse(rc, out roleEnum))
                    {
                        var users = GetStoreEmployeesByRole(storeCode, roleEnum);
                        foreach (var user in users)
                        {
                            result.Add(user.Code, rc);
                        }
                    }
                    break;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取资产代表
        /// </summary>
        /// <param name="storeCode">店Code</param>
        /// <returns></returns>
        public List <ProjectTeamMember> GetAssetRepsByStoreCode(string storeCode, string currentUserCode, string roleCode)
        {
            var db = GetDb();
            List <ProjectTeamMember> result = new List <ProjectTeamMember>();

            //获取Store的Region/Market/City的Code
            var store = StoreBasicInfo.GetStore(storeCode);
            var user  = db.Employee.Where(e => e.Code.Equals(store.StoreDevelop.AssetRepEid) && e.Status).Select(p => new ProjectTeamMember
            {
                UserAccount  = p.Code,
                UserNameENUS = p.NameENUS,
                UserNameZHCN = p.NameZHCN
            }).FirstOrDefault();

            if (user != null)
            {
                result.Add(user);
            }

            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据角色名称获取用户-简单用户对象
        /// </summary>
        /// <param name="storeCode">Store US Code</param>
        /// <param name="roleCodes">RoleCode组合</param>
        /// <param name="userCode"></param>
        /// <returns></returns>
        public static List <SimpleEmployee> GetStoreEmployeesByMultiRoles(string storeCode, string[] roleCodes, string userCode)
        {
            var db = PrepareDb();
            List <SimpleEmployee> result = new List <SimpleEmployee>();
            var storeEntry = new StoreBasicInfo();
            //获取Store的Region/Market/City的Code
            var store = StoreBasicInfo.GetStore(storeCode);

            foreach (var roleCode in roleCodes)
            {
                string rc = roleCode.Trim();
                switch (rc)
                {
                case "Asset Rep":
                    var reps = GetStoreAssetRepByStoreCode(storeCode);
                    result.AddRange(reps);
                    break;

                case "Asset Mgr":
                    var repMgrs = GetStoreAssetRepMgrByStoreCode(storeCode);
                    result.AddRange(repMgrs);
                    break;

                case "Asset Actor":
                    var repActors = GetStoreAssetActorsByStoreCode(storeCode, userCode);
                    result.AddRange(repActors);
                    break;

                default:
                    RoleCode roleEnum;
                    if (Enum.TryParse(rc, out roleEnum))
                    {
                        var users = GetStoreEmployeesByRole(storeCode, roleEnum);
                        result.AddRange(users);
                    }
                    break;
                }
            }
            return(result);
        }
Exemplo n.º 4
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.º 5
0
        public static RenewalGBMemo 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 RenewalGBMemo();

            memo.ProjectId = projectId;

            var rnInfo = RenewalInfo.Get(projectId);

            memo.Info   = rnInfo;
            memo.UsCode = rnInfo.USCode;

            memo.Store = StoreBasicInfo.GetStore(memo.UsCode);

            if (memo.Id == Guid.Empty)
            {
                memo.IsClosed      = (memo.Store.StoreBasicInfo.statusName == "Closed");
                memo.IsInOperation = false;
                var consInfo = new RenewalConsInfo();
                memo.ReinvestInfo = consInfo.GetReinvestmentBasicInfo(projectId);
                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.Renewal_GBMemo);

                if (projectInfo != null)
                {
                    if (ClientCookie.UserCode.Equals(rnInfo.PMAccount))
                    {
                        var isFlowFlinshed =
                            TaskWork.Any(e =>
                                         e.RefID == projectId && e.TypeCode == FlowCode.Renewal_GBMemo &&
                                         e.Status == TaskWorkStatus.K2ProcessApproved && e.ProcInstID == memo.ProcInstID);
                        var isExistTask = TaskWork.Any(e => e.RefID == projectId &&
                                                       e.TypeCode == FlowCode.Renewal_GBMemo &&
                                                       e.Status == TaskWorkStatus.UnFinish &&
                                                       e.ReceiverAccount == ClientCookie.UserCode &&
                                                       (e.ActivityName == WFMajorLeaseLegalReview.Act_Originator || e.ActivityName == WFMajorLeaseLegalReview.Act_Start));
                        memo.IsShowEdit   = isFlowFlinshed;
                        memo.IsShowRecall = !isFlowFlinshed && !isExistTask;
                    }
                }
            }
            //if (ClientCookie.UserCode.Equals(rnInfo.PMAccount))
            //    memo.IsShowSave = ProjectInfo.IsFlowSavable(projectId, FlowCode.Renewal_GBMemo);
            PopulateAppUsers(memo);
            return(memo);
        }
Exemplo n.º 6
0
        public static ReimageGBMemo 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 ReimageGBMemo();

            memo.ProjectId = projectId;

            string usCode  = "";
            var    rmgInfo = ReimageInfo.GetReimageInfo(projectId);

            memo.rmgInfo = rmgInfo;
            usCode       = rmgInfo.USCode;

            memo.Store = StoreBasicInfo.GetStore(usCode);
            var consInfo = new ReimageConsInfo();

            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.Reimage_GBMemo);

                if (projectInfo != null)
                {
                    if (ClientCookie.UserCode.Equals(rmgInfo.PMAccount))
                    //if (reimageInfo != null)
                    {
                        var isExistTask = TaskWork.Any(e => e.RefID == projectId &&
                                                       e.TypeCode == FlowCode.Reimage_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(rmgInfo.PMAccount))
            {
                memo.IsShowSave = ProjectInfo.IsFlowSavable(projectId, FlowCode.Reimage_GBMemo);
            }
            PopulateAppUsers(memo);
            return(memo);
        }
Exemplo n.º 7
0
        public Dictionary <string, string> GetPrintTemplateFields()
        {
            var project            = ProjectInfo.Get(this.ProjectId, FlowCode.TempClosure_ClosurePackage);
            var storeBasic         = StoreBasicInfo.FirstOrDefault(s => s.StoreCode == project.USCode);
            var storeContract      = StoreContractInfo.Get(storeBasic.StoreCode);
            var assetMgr           = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetManager);
            var assetActor         = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetActor);
            var assetRep           = ProjectUsers.FirstOrDefault(pu => pu.ProjectId == ProjectId && pu.RoleCode == ProjectUserRoleCode.AssetRep);
            var tempClosurePackage = TempClosurePackage.Get(ProjectId);
            var tempClosure        = TempClosureInfo.Get(ProjectId);
            Dictionary <string, string> templateFileds = new Dictionary <string, string>();

            templateFileds.Add("WorkflowName", SystemCode.Instance.GetCodeName(FlowCode.TempClosure, ClientCookie.Language));
            templateFileds.Add("ProjectID", ProjectId);
            templateFileds.Add("USCode", storeBasic.StoreCode);
            templateFileds.Add("Region", storeBasic.Region);
            templateFileds.Add("StoreNameEN", storeBasic.NameENUS);
            templateFileds.Add("Market", storeBasic.Market);
            templateFileds.Add("City", storeBasic.CityZHCN);
            templateFileds.Add("StoreNameCN", storeBasic.NameZHCN);
            templateFileds.Add("StoreAge", Math.Floor((DateTime.Now - storeBasic.OpenDate).TotalDays / 365D).ToString());
            templateFileds.Add("OpenDate", storeBasic.OpenDate.ToString("yyyy-MM-dd"));
            var storeInfo = StoreBasicInfo.GetStore(project.USCode);

            if (storeInfo.StoreContractInfo != null)
            {
                templateFileds.Add("CurrentLeaseENDYear", storeContract.EndYear);
            }
            else
            {
                templateFileds.Add("CurrentLeaseENDYear", "");
            }

            if (assetMgr != null)
            {
                templateFileds.Add("AssetsManager", assetMgr.UserNameENUS);
            }
            else
            {
                templateFileds.Add("AssetsManager", "");
            }

            templateFileds.Add("AssetsActor", assetActor.UserNameENUS);
            templateFileds.Add("AssetsRep", assetRep.UserNameENUS);
            templateFileds.Add("Address", storeBasic.AddressZHCN);
            templateFileds.Add("CloseDate", storeBasic.CloseDate.HasValue ? (storeBasic.CloseDate.Value.Year != 1900 ? storeBasic.CloseDate.Value.ToString("yyyy-MM-dd") : "") : "");
            templateFileds.Add("ClosureDate", tempClosure.ActualTempClosureDate.ToString("yyyy-MM-dd"));
            templateFileds.Add("LeaseExpireDate", tempClosure.LeaseExpireDate.HasValue ? tempClosure.LeaseExpireDate.Value.ToString("yyyy-MM-dd") : "");
            templateFileds.Add("ReOpenDate", tempClosure.ActualReopenDate.ToString("yyyy-MM-dd"));
            templateFileds.Add("RentFreeTerm", string.IsNullOrEmpty(tempClosurePackage.RentReliefClause) ? "否" : "是");
            templateFileds.Add("RentFreeStartDate", tempClosurePackage.RentReliefStartDate.HasValue ? tempClosurePackage.RentReliefStartDate.Value.ToString("yyyy-MM-dd") : "");
            templateFileds.Add("RentFreeEndDate", tempClosurePackage.RentReliefEndDate.HasValue ? tempClosurePackage.RentReliefEndDate.Value.ToString("yyyy-MM-dd") : "");
            templateFileds.Add("FreeRentTerm", tempClosurePackage.RentReliefClause);
            templateFileds.Add("LandlordName", tempClosure.LandlordName);
            if (tempClosurePackage.RentRelief.HasValue)
            {
                templateFileds.Add("ReliefRent", tempClosurePackage.RentRelief.Value ? "是" : "否");
            }
            else
            {
                templateFileds.Add("ReliefRent", "");
            }

            return(templateFileds);
        }
Exemplo n.º 8
0
        public Dictionary <string, string> GetPrintTemplateFields()
        {
            var returnDic = new Dictionary <string, string>();

            var            closureInfoEntity = ClosureInfo.GetByProjectId(this.ProjectId);
            var            storeInfo         = StoreBasicInfo.GetStore(closureInfoEntity.USCode);
            StoreBasicInfo store             = storeInfo.StoreBasicInfo;

            returnDic.Add("WorkflowName", SystemCode.Instance.GetCodeName(FlowCode.Closure, ClientCookie.Language));
            returnDic.Add("ProjectID", ProjectId);
            returnDic.Add("USCode", string.IsNullOrEmpty(closureInfoEntity.USCode) ? " " : closureInfoEntity.USCode);
            returnDic.Add("Region", string.IsNullOrEmpty(store.RegionENUS) ? " " : store.RegionENUS);
            returnDic.Add("StoreNameEN", string.IsNullOrEmpty(store.NameENUS) ? " " : store.NameENUS);
            returnDic.Add("Market", string.IsNullOrEmpty(store.MarketENUS) ? " " : store.MarketENUS);
            returnDic.Add("StoreNameCN", string.IsNullOrEmpty(store.NameZHCN) ? " " : store.NameZHCN);
            returnDic.Add("City", string.IsNullOrEmpty(store.CityENUS) ? " " : store.CityENUS);
            returnDic.Add("Address", string.IsNullOrEmpty(store.AddressZHCN) ? " " : store.AddressZHCN);
            returnDic.Add("StoreAge", (DateTime.Now.Year - store.OpenDate.Year).ToString());
            returnDic.Add("OpenDate", store.OpenDate.ToString("yyyy-MM-dd"));
            returnDic.Add("CurrentLeaseENDYear", storeInfo.StoreContractInfo.EndYear);
            returnDic.Add("AssetsManager", storeInfo.StoreDevelop.AssetMgrName);
            returnDic.Add("AssetsActor", storeInfo.StoreDevelop.AssetRepName);
            returnDic.Add("AssetsRep", closureInfoEntity.AssetActorNameENUS);
            returnDic.Add("ClosureType", string.IsNullOrEmpty(closureInfoEntity.ClosureTypeNameENUS) ? " " : closureInfoEntity.ClosureTypeNameENUS);
            returnDic.Add("LandlordName", string.IsNullOrEmpty(closureInfoEntity.LandlordName) ? " " : closureInfoEntity.LandlordName);
            if (storeInfo.StoreContractInfo != null)
            {
                returnDic.Add("LeaseExpireDate", storeInfo.StoreContractInfo.EndDate.Value.ToString("yyyy-MM-dd"));
            }
            else
            {
                returnDic.Add("LeaseExpireDate", " ");
            }
            if (closureInfoEntity.ActualCloseDate != null)
            {
                string closureDate = closureInfoEntity.ActualCloseDate.Value.ToString("yyyy-MM-dd");
                returnDic.Add("ClosureDate", string.IsNullOrEmpty(closureDate) ? " " : closureDate);
                returnDic.Add("CloseDate", string.IsNullOrEmpty(closureDate) ? " " : closureDate);
            }
            var packageInfo = ClosurePackage.Get(this.ProjectId);

            returnDic.Add("OriginalCFNPV", packageInfo.OriginalCFNPV.HasValue ? DataConverter.ToMoney(packageInfo.OriginalCFNPV.Value) : " ");

            var closureToolEntity = ClosureTool.Get(this.ProjectId);

            if (closureToolEntity != null)
            {
                returnDic.Add("TotalOneOffCosts", closureToolEntity.TotalOneOffCosts.HasValue ? DataConverter.ToMoney(closureToolEntity.TotalOneOffCosts.Value) : string.Empty);
                returnDic.Add("Compensation", closureToolEntity.Compensation.HasValue ? DataConverter.ToMoney(closureToolEntity.Compensation.Value).ToString() : " ");
            }
            returnDic.Add("NetOperatingIncome",
                          packageInfo.NetOperatingIncome.HasValue ? DataConverter.ToMoney(packageInfo.NetOperatingIncome.Value) : " ");
            returnDic.Add("Relocation", closureInfoEntity.RelocationNameENUS);
            returnDic.Add("RelocatedPipelineID",
                          packageInfo.RelocationPipelineID.HasValue ? packageInfo.RelocationPipelineID.ToString() : " ");
            returnDic.Add("PipelineName", packageInfo.PipelineName);
            returnDic.Add("NewSiteNetCFNPV", packageInfo.NewSiteNetCFNPV.HasValue ? DataConverter.ToMoney(packageInfo.NewSiteNetCFNPV.Value) : " ");
            returnDic.Add("OtherCFNPV", packageInfo.OtherCFNPV.HasValue ? DataConverter.ToMoney(packageInfo.OtherCFNPV.Value) : string.Empty);
            returnDic.Add("NetGain", packageInfo.NetGain.HasValue ? DataConverter.ToMoney(packageInfo.NetGain.Value) : " ");
            returnDic.Add("ReasonDescription", string.IsNullOrEmpty(packageInfo.ReasonDescriptionForNegativeNetGain) ? " " : packageInfo.ReasonDescriptionForNegativeNetGain);

            return(returnDic);
        }
Exemplo n.º 9
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.º 10
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);
        }