Esempio n. 1
0
        /// <summary>
        /// 购物车热卖推荐(推荐位补位)
        /// </summary>
        /// <returns></returns>
        public static List <RecommendProduct> QueryShoppingCartList()
        {
            string cacheKey = CommonFacade.GenerateKey("QueryShoppingCartList");

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <RecommendProduct>)HttpRuntime.Cache[cacheKey]);
            }

            var count = 4;
            var p1    = RecommendFacade.QueryRecommendProduct(0, (int)PageType.ShoppingCart, 5001, count);

            if (p1.Count < count)
            {
                var p2 = RecommendDA.QueryNewProduct(ConstValue.LanguageCode, ConstValue.CompanyCode);
                p2.ForEach(p =>
                {
                    if (p1.All(f => f.SysNo != p.SysNo))
                    {
                        p1.Add(p);
                    }
                });
            }
            List <RecommendProduct> result = p1.Take(count).ToList();

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);

            return(result);
        }
Esempio n. 2
0
        public static List <RecommendProduct> QueryGroupBuyingRecommendProductList()
        {
            string cacheKey = CommonFacade.GenerateKey("QueryGroupBuyingRecommendProductList");

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <RecommendProduct>)HttpRuntime.Cache[cacheKey]);
            }

            var count = 8;
            var p1    = RecommendFacade.QueryRecommendProduct(0, (int)PageType.GroupBuying, (int)RecommendPosition.GroupBuy_HotSalesProduct, count);
            //泰隆银行商品很少,可能有些分类下面就没有商品,这样补位 就会出现 有时能补上,有时补不上;这样还照常客户困惑和质疑;所有暂时去掉补位逻辑
            //if (p1.Count < count)
            //{
            //    Random rand = new Random();
            //    var allCategory = CategoryFacade.QueryCategoryInfosForHomePage();
            //    var c1SysNoList = allCategory.FindAll(x => x.CategoryType == CategoryType.TabStore).Select(x => x.CategoryID).ToList();
            //    int c1SysNo = c1SysNoList[rand.Next(0, c1SysNoList.Count)];
            //    var p2 = RecommendDA.QueryHotProductForC1(c1SysNo, ConstValue.LanguageCode, ConstValue.CompanyCode);
            //    p2.ForEach(p =>
            //    {
            //        if (p1.All(f => f.SysNo != p.SysNo))
            //        {
            //            p1.Add(p);
            //        }
            //    });
            //}
            List <RecommendProduct> result = p1.Take(count).ToList();

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);

            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// 获取首页所有相关Banner
        /// </summary>
        /// <returns></returns>
        public static HomBannersVM GetHomeBanners(int sliderCount = 5, int middleItemCount = 5, int bottomItemCount = 5)
        {
            PageType pageType = PageType.Home;
            int      pageID   = 0;
            string   cacheKey = CommonFacade.GenerateKey("GetBannerInfoOfHome", pageType.ToString(), pageID.ToString());

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((HomBannersVM)HttpRuntime.Cache[cacheKey]);
            }

            List <BannerInfo> bannerInfoList = RecommendDA.GetBannerInfoByPositionID(pageID, pageType, null);
            HomBannersVM      result         = new HomBannersVM();

            //首页轮播广告
            result.Sliders = bannerInfoList.Where(item => item.PositionID == BannerPosition.HomePage_Top_Slider).Take(sliderCount).ToList();

            //新闻公告下部
            result.UnderNews = bannerInfoList.FirstOrDefault(item => item.PositionID == BannerPosition.HomePage_UnderNews);

            //首页底部精选品牌
            result.Bottom = bannerInfoList.Where(item => item.PositionID == BannerPosition.HomePage_Bottom).Take(bottomItemCount).ToList();

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);
            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// 一级类别新品上架
        /// </summary>
        /// <param name="c1SysNo">前台一级类别</param>
        /// <param name="languageCode"></param>
        /// <param name="companyCode"></param>
        /// <returns></returns>
        public static List <RecommendProduct> QueryNewProductForC1(int c1SysNo, string languageCode = "zh-CN",
                                                                   string companyCode = "8601")
        {
            string cacheKey = CommonFacade.GenerateKey("QueryNewProductForC1", c1SysNo.ToString(), languageCode, companyCode);

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <RecommendProduct>)HttpRuntime.Cache[cacheKey]);
            }

            var count = 4;
            var p1    = QueryRecommendProduct(c1SysNo, (int)PageType.TabStore,
                                              (int)RecommendPosition.TabStore_NewProduct, count, languageCode, companyCode);

            if (p1.Count < count)
            {
                var p2 = RecommendDA.QueryNewProductForC1(c1SysNo, languageCode, companyCode);
                p2.ForEach(p =>
                {
                    if (p1.All(f => f.SysNo != p.SysNo))
                    {
                        p1.Add(p);
                    }
                });
            }
            List <RecommendProduct> result = p1.Take(count).ToList();

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);

            return(result);
        }
Esempio n. 5
0
        /// <summary>
        /// 发表回复
        /// </summary>
        /// <param name="replyInfo"></param>
        /// <returns></returns>
        public static bool CreateProductReviewReply(Product_ReplyDetail replyInfo, int SoSysNo)
        {
            string   cacheKey     = CommonFacade.GenerateKey("CreateProductReviewReply", replyInfo.Customer.SysNo.ToString(), replyInfo.ReviewSysNo.ToString());
            DateTime now          = DateTime.Now;
            int      nowTimePoint = now.Hour * 3600 + now.Minute * 60 + now.Second;

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                int preTimePoint = (int)HttpRuntime.Cache[cacheKey];
                if (nowTimePoint - preTimePoint < 60)
                {
                    throw new BusinessException("很抱歉,您发表评论的频率过快,请稍后再试。");
                }
            }
            else
            {
                HttpRuntime.Cache.Insert(cacheKey, 0, null, DateTime.Now.AddSeconds(CacheTime.Shortest), Cache.NoSlidingExpiration);
            }

            bool result = ReviewDA.CreateProductReviewReply(replyInfo);

            //确认不需要发邮件
            //if (result)
            //{
            //    SendMailReviewReply(replyInfo, SoSysNo);
            //}
            if (result)
            {
                now          = DateTime.Now;
                nowTimePoint = now.Hour * 3600 + now.Minute * 60 + now.Second;
                HttpRuntime.Cache[cacheKey] = nowTimePoint;
            }
            return(result);
        }
Esempio n. 6
0
        /// <summary>
        /// (已缓存)查询最近7天下单最多的前5个商品
        /// </summary>
        /// <param name="c3SysNo">前台三级类别sysno</param>
        /// <param name="languageCode"></param>
        /// <param name="companyCode"></param>
        /// <returns></returns>
        public static List <RecommendProduct> QueryWeekRankingForC3(int c3SysNo, string languageCode = "zh-CN", string companyCode = "8601")
        {
            string cacheKey = CommonFacade.GenerateKey("QueryWeekRankingForC3", c3SysNo.ToString(), languageCode, companyCode);

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <RecommendProduct>)HttpRuntime.Cache[cacheKey]);
            }

            const int count = 8;
            var       p1    = CategoryDA.QueryWeekRankingForC3(Convert.ToInt32(c3SysNo));

            if (p1.Count < 8)
            {
                var p2 = RecommendDA.QuerySuperSpecialProductForC3(Convert.ToInt32(c3SysNo), languageCode, companyCode);
                p2.ForEach(p =>
                {
                    if (p1.All(f => f.SysNo != p.SysNo))
                    {
                        p1.Add(p);
                    }
                });
            }
            List <RecommendProduct> result = p1.Take(count).ToList();

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);

            return(result);
        }
Esempio n. 7
0
        /// <summary>
        /// 获取推荐品牌
        /// </summary>
        /// <returns></returns>
        public static List <RecommendBrandInfo> GetRecommendBrands(PageType pageType, int pageID)
        {
            string cacheKey = CommonFacade.GenerateKey("GetRecommendBrands", pageType.ToString(), pageID.ToString());

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <RecommendBrandInfo>)HttpRuntime.Cache[cacheKey]);
            }
            List <RecommendBrandInfo> result = RecommendDA.GetRecommendBrands(pageType, pageID);

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);
            return(result);
        }
Esempio n. 8
0
        public static List <BannerInfo> GetBannerInfoByPositionID(int pageID, PageType pageType, BannerPosition positionID)
        {
            string cacheKey = CommonFacade.GenerateKey("GetBannerInfoByPositionID", pageType.ToString(), pageID.ToString(), positionID.ToString());

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <BannerInfo>)HttpRuntime.Cache[cacheKey]);
            }

            List <BannerInfo> bannerInfoList = RecommendDA.GetBannerInfoByPositionID(pageID, pageType, positionID);

            HttpRuntime.Cache.Insert(cacheKey, bannerInfoList, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);
            return(bannerInfoList);
        }
Esempio n. 9
0
        /// <summary>
        /// 获取指定数量,指定页面,指定位置的Topic
        /// </summary>
        /// <param name="newsType"></param>
        /// <param name="refSysNo"></param>
        /// <param name="topNum"></param>
        /// <param name="pageShowInheritance"></param>
        /// <returns></returns>
        public static List <NewsInfo> GetTopTopicList(NewsType newsType, int?refSysNo, int?pageShowInheritance, int topNum)
        {
            string cacheKey = CommonFacade.GenerateKey("GetTopTopicList", newsType.ToString(), refSysNo.HasValue ? refSysNo.ToString() : "N", pageShowInheritance.HasValue ? pageShowInheritance.ToString() : "N", topNum.ToString());

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <NewsInfo>)HttpRuntime.Cache[cacheKey]);
            }

            List <NewsInfo> result = TopicDA.GetTopTopicList(newsType, refSysNo, pageShowInheritance, topNum);

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);
            return(result);
        }
Esempio n. 10
0
        private static List <CountDownInfo> GetAllCountDown()
        {
            string cacheKey = CommonFacade.GenerateKey("GetAllCountDown");

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <CountDownInfo>)HttpRuntime.Cache[cacheKey]);
            }
            List <CountDownInfo> countdownList = CountDownDA.GetAllCountDown(ConstValue.LimitBuyEarlyShowTimeSetting);

            HttpRuntime.Cache.Insert(cacheKey, countdownList, null, DateTime.Now.AddSeconds(CacheTime.Shortest), Cache.NoSlidingExpiration);

            return(countdownList);
        }
Esempio n. 11
0
        /// <summary>
        /// 获取品牌专区所有热销商品
        /// </summary>
        /// <returns></returns>
        private static List <ProductItemInfo> GetAllHotProductList()
        {
            string cacheKey = CommonFacade.GenerateKey("GetHotProductList");

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <ProductItemInfo>)HttpRuntime.Cache[cacheKey]);
            }

            List <ProductItemInfo> allHotProducts = BrandZoneDA.GetAllHotProductList();

            HttpRuntime.Cache.Insert(cacheKey, allHotProducts, null, DateTime.Now.AddSeconds(CacheTime.Longest), Cache.NoSlidingExpiration);

            return(allHotProducts);
        }
Esempio n. 12
0
        /// <summary>
        /// 获取首页新闻公告信息
        /// </summary>
        /// <returns></returns>
        public static List <NewsInfo> GetHomePageNews(NewsType newsType, int topNum = 5)
        {
            string cacheKey = CommonFacade.GenerateKey("GetHomePageNews", newsType.ToString());

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <NewsInfo>)HttpRuntime.Cache[cacheKey]);
            }

            List <NewsInfo> entityList = TopicDA.GetNewsInfoByNewsType(newsType, topNum);

            HttpRuntime.Cache.Insert(cacheKey, entityList, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);

            return(entityList);
        }
Esempio n. 13
0
        /// <summary>
        /// 获取团购分类
        /// </summary>
        /// <returns></returns>
        public static List <GroupBuyingCategoryInfo> GetGroupBuyingCategory()
        {
            string cacheKey = CommonFacade.GenerateKey("GroupBuying_GetGroupBuyingCategory");

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <GroupBuyingCategoryInfo>)HttpRuntime.Cache[cacheKey]);
            }

            List <GroupBuyingCategoryInfo> result = GroupBuyingDA.GetGroupBuyingCategory();

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Longest), Cache.NoSlidingExpiration);

            return(result);
        }
Esempio n. 14
0
        /// <summary>
        /// (已缓存)所有的前台商品类别
        /// </summary>
        /// <returns></returns>
        public static List <CategoryInfo> QueryCategoryInfos()
        {
            string cacheKey = CommonFacade.GenerateKey("QueryCategoryInfos");

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <CategoryInfo>)HttpRuntime.Cache[cacheKey]);
            }

            List <CategoryInfo> result = CategoryDA.QueryCategories();

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Longest), Cache.NoSlidingExpiration);

            return(result);
        }
Esempio n. 15
0
        public static List <RecommendProduct> QueryWeeklyHotProduct(string languageCode = "zh-CN", string companyCode = "8601")
        {
            string cacheKey = CommonFacade.GenerateKey("QueryWeeklyHotProduct");

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <RecommendProduct>)HttpRuntime.Cache[cacheKey]);
            }

            var result = RecommendDA.QueryWeeklyHotProduct(languageCode, companyCode);

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);

            return(result);
        }
Esempio n. 16
0
        /// <summary>
        /// 所有的有效的二级域名商家
        /// </summary>
        /// <returns></returns>
        public static List <StoreDomainPage> GetAllStoreDomainHomePageList()
        {
            string cacheKey = CommonFacade.GenerateKey("GetAllStoreDomainHomePageList");

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <StoreDomainPage>)HttpRuntime.Cache[cacheKey]);
            }
            List <StoreDomainPage> result = StoreDA.GetAllStoreDomainHomePageList();

            if (result != null)
            {
                HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Middle), Cache.NoSlidingExpiration);
            }
            return(result);
        }
Esempio n. 17
0
        /// <summary>
        /// 为首页的限时抢购推荐位提供数据
        /// </summary>
        /// <returns></returns>
        public static List <CountDownInfo> GetHomepageRecommendCountDown()
        {
            string cacheKey = CommonFacade.GenerateKey("GetHomepageRecommendCountDown");

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <CountDownInfo>)HttpRuntime.Cache[cacheKey]);
            }
            List <CountDownInfo> list = GetCountDownList(1, 5).ResultList;

            if (list == null)
            {
                list = new List <CountDownInfo>();
            }

            HttpRuntime.Cache.Insert(cacheKey, list, null, DateTime.Now.AddSeconds(CacheTime.Shortest), Cache.NoSlidingExpiration);
            return(list);
        }
Esempio n. 18
0
        //热卖商品
        public static List <RecommendProduct> QueryHotSalesProductForC2(int c2SysNo, string languageCode = "zh-CN",
                                                                        string companyCode = "8601")
        {
            string cacheKey = CommonFacade.GenerateKey("QueryHotSalesProductForC2", c2SysNo.ToString(), languageCode, companyCode);

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <RecommendProduct>)HttpRuntime.Cache[cacheKey]);
            }

            var count = 6;
            var p1    = QueryRecommendProduct(c2SysNo, (int)PageType.MidCategory,
                                              (int)RecommendPosition.MidCategory_HotSalesProduct, count, languageCode, companyCode);
            List <RecommendProduct> result = p1.Take(count).ToList();

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);

            return(result);
        }
Esempio n. 19
0
        /// <summary>
        /// 新品上市
        /// </summary>
        /// <param name="MerchantSysNo"></param>
        /// <param name="C1SysNo"></param>
        /// <param name="count"></param>
        /// <param name="languageCode"></param>
        /// <param name="companyCode"></param>
        /// <returns></returns>
        public static List <RecommendProduct> QueryStoreNewRecommendProduct(
            int MerchantSysNo,
            string CategoryCode,
            int count,
            string languageCode = "zh-CN",
            string companyCode  = "8601")
        {
            string cacheKey = CommonFacade.GenerateKey("QueryStoreNewRecommendProduct", languageCode, companyCode, MerchantSysNo.ToString());

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <RecommendProduct>)HttpRuntime.Cache[cacheKey]);
            }

            List <RecommendProduct> result = StoreDA.QueryStoreNewRecommendProduct(MerchantSysNo, CategoryCode, count, languageCode, companyCode);

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);

            return(result);
        }
Esempio n. 20
0
        /// <summary>
        /// 获取推荐商品
        /// </summary>
        /// <param name="pageID">类别sysno/其他sysno</param>
        /// <param name="pageType">页面类型,如:一级类别页面,二级类别页等</param>
        /// <param name="posID">页面位置</param>
        /// <param name="count">数量</param>
        /// <param name="languageCode"></param>
        /// <param name="companyCode"></param>
        /// <returns></returns>
        public static List <RecommendProduct> QueryRecommendProduct(int pageID,
                                                                    int pageType,
                                                                    int posID,
                                                                    int count,
                                                                    string languageCode = "zh-CN",
                                                                    string companyCode  = "8601")
        {
            string cacheKey = CommonFacade.GenerateKey("QueryRecommendProduct", pageType.ToString(), pageID.ToString()
                                                       , posID.ToString(), count.ToString(), languageCode, companyCode);

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <RecommendProduct>)HttpRuntime.Cache[cacheKey]);
            }

            List <RecommendProduct> result = RecommendDA.QueryRecommendProduct(pageID, pageType, posID, count, languageCode, companyCode);

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);

            return(result);
        }
Esempio n. 21
0
        /// <summary>
        /// 发表咨询
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static bool CreateProductConsult(ConsultationInfo info)
        {
            string   cacheKey     = CommonFacade.GenerateKey("CreateProductConsult", info.CustomerSysNo.ToString(), info.ProductSysNo.ToString());
            DateTime now          = DateTime.Now;
            int      nowTimePoint = now.Hour * 3600 + now.Minute * 60 + now.Second;

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                int preTimePoint = (int)HttpRuntime.Cache[cacheKey];
                if (nowTimePoint - preTimePoint < 60)
                {
                    throw new BusinessException("很抱歉,您发表咨询的频率过快,请稍后再试。");
                }
            }
            else
            {
                HttpRuntime.Cache.Insert(cacheKey, 0, null, DateTime.Now.AddSeconds(CacheTime.Shortest), Cache.NoSlidingExpiration);
            }

            bool result = false;

            if (ConstValue.ProductConsultSwitch)
            {
                info.Status = "A";
            }
            else
            {
                info.Status = "O";
            }
            result = ConsultationDA.CreateProductConsult(info);

            if (result)
            {
                now          = DateTime.Now;
                nowTimePoint = now.Hour * 3600 + now.Minute * 60 + now.Second;
                HttpRuntime.Cache[cacheKey] = nowTimePoint;
            }
            return(result);
        }
Esempio n. 22
0
        /// <summary>
        /// 发表撮合交易回复
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static bool CreateProductMatchedTradingReply(ProductMatchedTradingReplyInfo info, int productSysNo, string productName)
        {
            string   cacheKey     = CommonFacade.GenerateKey("CreateProductMatchedTradingReply", info.CustomerSysNo.ToString(), info.MatchedTradingSysNo.ToString());
            DateTime now          = DateTime.Now;
            int      nowTimePoint = now.Hour * 3600 + now.Minute * 60 + now.Second;

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                int preTimePoint = (int)HttpRuntime.Cache[cacheKey];
                if (nowTimePoint - preTimePoint < 60)
                {
                    throw new BusinessException("很抱歉,您发表咨询的频率过快,请稍后再试。");
                }
            }
            else
            {
                HttpRuntime.Cache.Insert(cacheKey, 0, null, DateTime.Now.AddSeconds(CacheTime.Shortest), Cache.NoSlidingExpiration);
            }


            bool result = false;

            result = MatchedTradingDA.CreateProductMatchedTradingReply(info);
            //确认不需要发邮件
            //if (result)
            //{
            //    SendMailConsultReply(info, productSysNo, productName);
            //}
            if (result)
            {
                now          = DateTime.Now;
                nowTimePoint = now.Hour * 3600 + now.Minute * 60 + now.Second;
                HttpRuntime.Cache[cacheKey] = nowTimePoint;
            }

            return(result);
        }
Esempio n. 23
0
        public static List <CategoryInfo> QueryCategoryInfosForHomePage()
        {
            string cacheKey = CommonFacade.GenerateKey("QueryCategoryInfosForHomePage");

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <CategoryInfo>)HttpRuntime.Cache[cacheKey]);
            }

            List <CategoryInfo> categoryList = QueryCategoryInfos();

            List <CategoryInfo> queryList = ECommerce.Utility.SerializationUtility.DeepClone <List <CategoryInfo> >(categoryList);

            List <CategoryInfo> category1_List = queryList.FindAll(x => x.CategoryType == CategoryType.TabStore);

            category1_List.OrderBy(x => x.Priority);

            List <CategoryInfo> category2_List = queryList.FindAll(x => x.CategoryType == CategoryType.Category);
            List <CategoryInfo> category3_List = queryList.FindAll(x => x.CategoryType == CategoryType.SubCategory);

            foreach (CategoryInfo entity in category2_List)
            {
                entity.SubCategories = category3_List.FindAll(x => x.ParentSysNo == entity.CurrentSysNo);
                entity.SubCategories.OrderBy(x => x.Priority);
            }

            foreach (CategoryInfo entity in category1_List)
            {
                entity.SubCategories = category2_List.FindAll(x => x.ParentSysNo == entity.CurrentSysNo);
                entity.SubCategories.OrderBy(x => x.Priority);
            }

            HttpRuntime.Cache.Insert(cacheKey, category1_List, null, DateTime.Now.AddSeconds(CacheTime.Longest), Cache.NoSlidingExpiration);

            return(category1_List);
        }
Esempio n. 24
0
        /// <summary>
        /// 发表评论
        /// </summary>
        /// <param name="reviewInfo"></param>
        /// <returns></returns>
        public static bool CreateProductReview(Product_ReviewDetail reviewInfo)
        {
            string   cacheKey     = CommonFacade.GenerateKey("CreateProductReview", reviewInfo.CustomerInfo.SysNo.ToString(), reviewInfo.ProductSysNo.ToString());
            DateTime now          = DateTime.Now;
            int      nowTimePoint = now.Hour * 3600 + now.Minute * 60 + now.Second;

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                int preTimePoint = (int)HttpRuntime.Cache[cacheKey];
                if (nowTimePoint - preTimePoint < 60)
                {
                    throw new BusinessException("很抱歉,您发表评论的频率过快,请稍后再试。");
                }
            }
            else
            {
                HttpRuntime.Cache.Insert(cacheKey, 0, null, DateTime.Now.AddSeconds(CacheTime.Shortest), Cache.NoSlidingExpiration);
            }

            bool result = false;

            #region 二期修改不用此方法
            ////根据用户customer以及商品编号获取订单编号以及商品code
            //List<Product_TempSOinfo> tempsoinfo = ReviewDA.GetSoSysNoAndProductCode(reviewInfo.CustomerInfo.SysNo, reviewInfo.ProductSysNo);
            //if (tempsoinfo != null && tempsoinfo.Count > 0)
            //{
            //    CreateReviewPreCheck(reviewInfo);
            //    ReviewScoreCalculator(reviewInfo);
            //    //取消15天的检查
            //    //CheckCreateReviewByDays(reviewInfo.ProductSysNo, reviewInfo.CustomerInfo.SysNo);

            //    //检查当前订单号是否已评论
            //    if (reviewInfo.SOSysno != null && reviewInfo.SOSysno > 0)
            //    {
            //        Product_TempSOinfo temp = tempsoinfo.SingleOrDefault(p => p.SOSysNo == reviewInfo.SOSysno);
            //        if (temp != null)
            //        {
            //            bool isReview = ReviewDA.CheckReviewBySoSysNo(reviewInfo.SOSysno);
            //            if (isReview)
            //            {
            //                throw new BusinessException("当前订单已经参与过评论!");
            //            }
            //        }
            //        else
            //        {
            //            throw new BusinessException("须购买过此商品且订单已完成才能发表评论!");
            //        }
            //    }
            //    else
            //    {
            //        reviewInfo.SOSysno = tempsoinfo[0].SOSysNo;
            //    }
            //    //reviewInfo.SOSysno = tempsoinfo.SOSysNo;
            //    result = ReviewDA.CreateProductReview(reviewInfo);
            //}
            //else
            //{
            //    throw new BusinessException("须购买过此商品且订单已完成才能发表评论!");
            //}
            #endregion

            //根据用户customer以及商品编号获取-----该用户所有订单编号以及商品code
            List <Product_TempSOinfo> tempsoinfo = ReviewDA.GetCustomerSoSysNoAndProductCode(reviewInfo.CustomerInfo.SysNo, reviewInfo.ProductSysNo);
            if (tempsoinfo != null && tempsoinfo.Count > 0)
            {
                CreateReviewPreCheck(reviewInfo);
                ReviewScoreCalculator(reviewInfo);
                Product_TempSOinfo temp = tempsoinfo.SingleOrDefault(p => p.SOSysNo == reviewInfo.SOSysno);
                if (temp != null)
                {
                    //检查当前订单号是否已经完成两次评论
                    int num = ReviewDA.CheckReviewedBySoSysNo(temp.SOSysNo, reviewInfo.ProductSysNo);
                    if (num > 1)
                    {
                        throw new BusinessException("当前订单已经参与过两次评论!");
                    }
                    else
                    {
                        result = ReviewDA.CreateProductReview(reviewInfo);
                    }
                }
                else
                {
                    throw new BusinessException("须购买过此商品且订单已完成才能发表评论!");
                }
            }
            else
            {
                throw new BusinessException("须购买过此商品且订单已完成才能发表评论!");
            }
            if (result)
            {
                now          = DateTime.Now;
                nowTimePoint = now.Hour * 3600 + now.Minute * 60 + now.Second;
                HttpRuntime.Cache[cacheKey] = nowTimePoint;
            }

            return(result);
        }
Esempio n. 25
0
        /// <summary>
        /// 获取楼层信息
        /// </summary>
        /// <param name="pageCode"></param>
        /// <returns></returns>
        public static List <FloorEntity> GetFloorInfo(PageCodeType pageType, int pageCode)
        {
            string cacheKey = CommonFacade.GenerateKey("GetFloorInfo", pageType.ToString(), pageCode.ToString());

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <FloorEntity>)HttpRuntime.Cache[cacheKey]);
            }
            #region 获取信息

            //获取基本信息
            List <FloorEntity> floorEntitys = RecommendDA.GetFloorInfo(pageType, pageCode);

            //获取 Tab 信息
            foreach (FloorEntity entity in floorEntitys)
            {
                //获取 Tab 信息
                entity.FloorSections = RecommendDA.GetFloorSections(entity.FloorSysNo);
                List <FloorItemBase> originalItem = RecommendDA.GetFloorSectionItems(entity.FloorSysNo);

                entity.FloorSectionItems = new List <FloorItemBase>();
                //转换XML信息 to 实体
                foreach (FloorItemBase item in originalItem)
                {
                    FloorItemBase objItem = null;
                    switch (item.ItemType)
                    {
                    case FloorItemType.Product:

                        FloorItemProduct entityProduct = CreateObject <FloorItemProduct>(item.ItemValue);
                        ProductItemInfo  productInfo   = ProductFacade.GetProductShortInfoBySysNo(entityProduct.ProductSysNo);
                        if (productInfo != null && productInfo.Status == 1)
                        {
                            entityProduct.DefaultImage    = productInfo.DefaultImage;
                            entityProduct.RealPrice       = productInfo.RealPrice;
                            entityProduct.BasicPrice      = productInfo.MarketPrice;
                            entityProduct.ProductPrice    = productInfo.CurrentPrice;
                            entityProduct.PromotionTitle  = productInfo.PromotionTitle;
                            entityProduct.ProductSubTitle = productInfo.PromotionTitle;
                            entityProduct.CashRebate      = productInfo.CashRebate;
                            entityProduct.ProductTitle    = productInfo.ProductTitle;
                            objItem = entityProduct;
                        }
                        break;

                    case FloorItemType.Banner:
                        objItem = CreateObject <FloorItemBanner>(item.ItemValue);
                        break;

                    case FloorItemType.Brand:
                        objItem = CreateObject <FloorItemBrand>(item.ItemValue);
                        break;

                    case FloorItemType.TextLink:
                        objItem = CreateObject <FloorItemTextLink>(item.ItemValue);
                        break;
                    }

                    if (objItem != null)
                    {
                        objItem.CloneFloorItemBase(item);
                        entity.FloorSectionItems.Add(objItem);
                    }
                }
            }
            #endregion


            HttpRuntime.Cache.Insert(cacheKey, floorEntitys, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);

            return(floorEntitys);
        }