예제 #1
0
        public static PageModel <StoreForPromotion> GetStoresForOrderPromotions(StoreEntityQuery query)
        {
            PageModel <StoreForPromotion> pageModel = new PageModel <StoreForPromotion>();
            StoreProductDao storeProductDao         = new StoreProductDao();

            if (query.PageSize == 0)
            {
                query.PageSize = 10;
            }
            if (query.PageIndex == 0)
            {
                query.PageIndex = 1;
            }
            DbQueryResult storesForOrderPromotions = storeProductDao.GetStoresForOrderPromotions(query);
            DataTable     data = storesForOrderPromotions.Data;

            pageModel.Total = storesForOrderPromotions.TotalRecords;
            List <StoreForPromotion> list = new List <StoreForPromotion>();

            foreach (DataRow row in data.Rows)
            {
                list.Add(new StoreForPromotion
                {
                    Status    = (int)row["PromotionStatus"],
                    StoreId   = (int)row["StoreId"],
                    StoreName = row["StoreName"].ToString(),
                    Address   = row["address"].ToString()
                });
            }
            StoreListHelper.ProcessTags(list);
            pageModel.Models = list;
            return(pageModel);
        }
예제 #2
0
        private static Dictionary <int, List <StoreProductEntity> > GetStoreProduct4Search(string storeIds, string key, int categoryId, string mainCategoryPath, ProductType productType)
        {
            Dictionary <int, List <StoreProductEntity> > result = new Dictionary <int, List <StoreProductEntity> >();

            if (string.IsNullOrEmpty(key) && categoryId == 0)
            {
                return(result);
            }
            if (string.IsNullOrEmpty(storeIds))
            {
                return(result);
            }
            if (storeIds.EndsWith(","))
            {
                storeIds = storeIds.Remove(storeIds.LastIndexOf(','));
            }
            List <StoreProductEntity> list            = new List <StoreProductEntity>();
            StoreProductDao           storeProductDao = new StoreProductDao();

            list = storeProductDao.GetProduct4Search(storeIds, key, categoryId, mainCategoryPath, productType);
            if (list != null)
            {
                result = (from t in list
                          group t by t.StoreId).ToDictionary((IGrouping <int, StoreProductEntity> t) => t.Key, (IGrouping <int, StoreProductEntity> t) => t.ToList());
            }
            return(result);
        }
예제 #3
0
        public static PageModel <StoreEntity> SearchPdInStoreList(StoreEntityQuery query)
        {
            PageModel <StoreEntity> pageModel = new PageModel <StoreEntity>();

            if (query.Position.Latitude == 0.0 || query.Position.Longitude == 0.0 || (string.IsNullOrEmpty(query.Key) && query.CategoryId == 0))
            {
                return(pageModel);
            }
            StoreProductDao storeProductDao = new StoreProductDao();

            query.Key = DataHelper.CleanSearchString(query.Key);
            DbQueryResult dbQueryResult = storeProductDao.SearchPdInStoreList(query);
            DataTable     data          = dbQueryResult.Data;

            pageModel.Total = dbQueryResult.TotalRecords;
            string                      tempAllRegions = default(string);
            string                      storeIds       = default(string);
            List <StoreEntity>          list           = StoreListHelper.AdapterDs2Store(data, out tempAllRegions, out storeIds);
            Dictionary <string, string> regionDic      = RegionHelper.GetRegionName(tempAllRegions);
            Dictionary <int, List <StoreProductEntity> > pdRecommDic = StoreListHelper.GetStoreProduct4Search(storeIds, query.Key, query.CategoryId, query.MainCategoryPath, query.ProductType);

            list.ForEach(delegate(StoreEntity item)
            {
                item.AddressSimply = StoreListHelper.ProcessAddress(regionDic, item.FullRegionPath, item.Address);
                item.ProductList   = (pdRecommDic.ContainsKey(item.StoreId) ? pdRecommDic[item.StoreId] : new List <StoreProductEntity>());
            });
            pageModel.Models = list;
            return(pageModel);
        }
예제 #4
0
        public static Dictionary <int, List <StoreProductEntity> > GetStoreProductRecommend(string storeIds, ProductType productType = ProductType.All)
        {
            Dictionary <int, List <StoreProductEntity> > result = new Dictionary <int, List <StoreProductEntity> >();

            if (string.IsNullOrEmpty(storeIds))
            {
                return(result);
            }
            if (storeIds.EndsWith(","))
            {
                storeIds = storeIds.Remove(storeIds.LastIndexOf(','));
            }
            List <StoreProductEntity> list            = new List <StoreProductEntity>();
            StoreProductDao           storeProductDao = new StoreProductDao();

            list = storeProductDao.GetProductRecommend(storeIds, productType);
            list.ForEach(delegate(StoreProductEntity t)
            {
                if (string.IsNullOrEmpty(t.ThumbnailUrl220))
                {
                    t.ThumbnailUrl220 = SettingsManager.GetMasterSettings().DefaultProductImage;
                }
                t.ThumbnailUrl220 = Globals.FullPath(t.ThumbnailUrl220);
            });
            if (list != null)
            {
                result = (from t in list
                          group t by t.StoreId).ToDictionary((IGrouping <int, StoreProductEntity> t) => t.Key, (IGrouping <int, StoreProductEntity> t) => t.ToList());
            }
            return(result);
        }
예제 #5
0
        public static List <StoreProductEntity> GetStoreProductRecommend(int storeId)
        {
            List <StoreProductEntity> list            = new List <StoreProductEntity>();
            StoreProductDao           storeProductDao = new StoreProductDao();

            return(storeProductDao.GetProductRecommend(storeId));
        }
예제 #6
0
        public static List <StoreBaseEntity> GetStoreRecommendByProductId(StoreEntityQuery query)
        {
            List <StoreBaseEntity> result = new List <StoreBaseEntity>();

            if (query.Position.Latitude == 0.0 || query.Position.Longitude == 0.0)
            {
                return(result);
            }
            StoreProductDao storeProductDao = new StoreProductDao();

            return(storeProductDao.GetStoreRecommendByProductId(query));
        }
예제 #7
0
        public static List <StoreBaseEntity> GetRecomStoreByCountdownProductId(StoreEntityQuery query)
        {
            List <StoreBaseEntity> result = new List <StoreBaseEntity>();

            if (query.Position.Latitude == 0.0 || query.Position.Longitude == 0.0)
            {
                return(result);
            }
            List <StoreBase>     activityStores = StoreActivityHelper.GetActivityStores(query.ActivityId, 2, query.TagId);
            IEnumerable <string> source         = from t in activityStores
                                                  select t.StoreId.ToString();

            Func <string, string, string> func = (string t, string n) => t + "," + n;
            string          text2           = query.Key = source.Aggregate(func);
            StoreProductDao storeProductDao = new StoreProductDao();

            return(storeProductDao.GetRecomStoreByCountdownProductId(query));
        }
예제 #8
0
        public static PageModel <StoreEntity> GetStoreRecommend(StoreEntityQuery query)
        {
            PageModel <StoreEntity> pageModel = new PageModel <StoreEntity>();

            if (query.Position.Latitude == 0.0 || query.Position.Longitude == 0.0)
            {
                return(pageModel);
            }
            StoreProductDao storeProductDao = new StoreProductDao();
            DbQueryResult   storeRecommend  = storeProductDao.GetStoreRecommend(query);
            DataTable       data            = storeRecommend.Data;

            pageModel.Total = storeRecommend.TotalRecords;
            string                      tempAllRegions = default(string);
            string                      storeIds       = default(string);
            List <StoreEntity>          list           = StoreListHelper.AdapterDs2Store(data, out tempAllRegions, out storeIds);
            Dictionary <string, string> regionDic      = RegionHelper.GetRegionName(tempAllRegions);
            Dictionary <int, List <StoreProductEntity> > pdRecommDic = StoreListHelper.GetStoreProductRecommend(storeIds, query.ProductType);
            MemberInfo memberInfo = null;
            int        gradeId    = 0;

            if (HiContext.Current != null && HiContext.Current.UserId > 0)
            {
                memberInfo = HiContext.Current.User;
            }
            if (memberInfo != null)
            {
                gradeId = memberInfo.GradeId;
            }
            Dictionary <int, List <StoreActivityEntity> > activitityDic = PromoteHelper.GetStoreActivityEntity(storeIds, gradeId);

            list.ForEach(delegate(StoreEntity item)
            {
                item.AddressSimply = StoreListHelper.ProcessAddress(regionDic, item.FullRegionPath, item.Address);
                item.ProductList   = (pdRecommDic.ContainsKey(item.StoreId) ? pdRecommDic[item.StoreId] : new List <StoreProductEntity>());
                item.Activity      = PromoteHelper.ProcessActivity(activitityDic, item.StoreId);
                item.StoreImages   = Globals.FullPath(item.StoreImages.Split(',')[0]);
            });
            pageModel.Models = list;
            return(pageModel);
        }
예제 #9
0
        public static List <int> GetAllStoresForCountDowns(StoreEntityQuery query)
        {
            StoreProductDao storeProductDao = new StoreProductDao();

            return(storeProductDao.GetAllStoresForCountDowns(query));
        }
예제 #10
0
        public static List <int> GetAllStoresForOrderPromotions(StoreEntityQuery query)
        {
            StoreProductDao storeProductDao = new StoreProductDao();

            return(storeProductDao.GetAllStoresForOrderPromotions(query));
        }