Exemple #1
0
        public DbQueryResult SearchPdInStoreList(StoreEntityQuery query)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("   TopRegionId={0} and StoreId in(", query.RegionId);
            stringBuilder.Append("SELECT distinct (sp.StoreId) FROM [Hishop_Products] p");
            stringBuilder.Append(" inner join Hishop_StoreProducts sp on p.ProductId=sp.ProductId");
            stringBuilder.Append(" inner join Hishop_Stores s on s.StoreId=sp.StoreId");
            stringBuilder.Append(" where  s.StoreId IN(SELECT StoreId FROM Hishop_StoreSKUs where ProductID = p.ProductId) ");
            if (!string.IsNullOrWhiteSpace(query.Key))
            {
                string[] array = Regex.Split(query.Key.Trim(), "\\s+");
                stringBuilder.AppendFormat(" AND (p.ProductName LIKE '%{0}%'", DataHelper.CleanSearchString(array[0]));
                for (int i = 1; i < array.Length && i <= 4; i++)
                {
                    stringBuilder.AppendFormat(" AND p.ProductName LIKE '%{0}%'", DataHelper.CleanSearchString(array[i]));
                }
                stringBuilder.Append(")");
            }
            if (query.CategoryId > 0 && !string.IsNullOrEmpty(query.MainCategoryPath))
            {
                string text = $"{query.MainCategoryPath}|";
                stringBuilder.Append(" and (MainCategoryPath like '" + text + "%' or ExtendCategoryPath like '" + text + "%' or ExtendCategoryPath1 like '" + text + "%'");
                stringBuilder.Append(" or ExtendCategoryPath2 like '" + text + "%' or ExtendCategoryPath3 like '" + text + "%'or ExtendCategoryPath4 like '" + text + "%')");
            }
            if (query.ProductType > ProductType.All)
            {
                stringBuilder.Append(" and ProductType=" + query.ProductType.GetHashCode());
            }
            stringBuilder.Append(" and (s.CloseStatus=1 or (s.CloseStatus=0 and (getdate()<s.CloseBeginTime or s.CloseEndTime<GETDATE()))) and s.[State]=1 and sp.SaleStatus=1");
            stringBuilder.AppendFormat(" and (IsAboveSelf=1 or IsSupportExpress=1 or (IsStoreDelive=1 and (dbo.GetDistance({0},{1},Latitude,Longitude)<(ServeRadius*1000) or dbo.IsInDeliveryScope(s.StoreId,'{2}')=1)))", query.Position.Latitude, query.Position.Longitude, query.AreaId);
            stringBuilder.AppendFormat(" )");
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, $"dbo.GetDistance({query.Position.Latitude},{query.Position.Longitude},Latitude,Longitude)", SortAction.Asc, query.IsCount, "Hishop_Stores s", "s.StoreId", stringBuilder.ToString(), $"StoreId,StoreImages,StoreName,Latitude,Longitude,FullRegionPath,[address],dbo.GetDistance({query.Position.Latitude},{query.Position.Longitude},Latitude,Longitude)as Distance,IsAboveSelf,IsSupportExpress,IsStoreDelive,isnull(MinOrderPrice,-1) MinOrderPrice,isnull(StoreFreight,0) as StoreFreight,(select COUNT(1) from Hishop_StoreProducts where storeid=s.StoreId and SaleStatus=1) as OnSaleNum "));
        }
Exemple #2
0
        public List <StoreBaseEntity> GetStoreRecommendByProductId(StoreEntityQuery query)
        {
            List <StoreBaseEntity> list          = new List <StoreBaseEntity>();
            StringBuilder          stringBuilder = new StringBuilder("select top 10  s.StoreId,s.StoreName");

            stringBuilder.AppendFormat(",dbo.GetDistance({0},{1},Latitude,Longitude) as Distance", query.Position.Latitude, query.Position.Longitude);
            stringBuilder.AppendFormat(" from Hishop_Stores s  where  (CloseStatus=1 or (CloseStatus=0 and (getdate()<CloseBeginTime or CloseEndTime<GETDATE())))");
            stringBuilder.AppendFormat(" AND [State]=1 and s.TopRegionId={0} and s.StoreId in (select distinct StoreId from  dbo.Hishop_StoreSKUs where ProductId={1} and Stock>0)", query.RegionId, query.ProductId);
            if (query.StoreId > 0)
            {
                stringBuilder.AppendFormat(" and s.StoreId <>{0}", query.StoreId);
            }
            stringBuilder.AppendFormat(" and (IsAboveSelf=1 or IsSupportExpress=1 or (IsStoreDelive=1 and (dbo.GetDistance({0},{1},Latitude,Longitude)<(ServeRadius*1000) or dbo.IsInDeliveryScope(StoreId,'{2}')=1)))", query.Position.Latitude, query.Position.Longitude, query.AreaId);
            stringBuilder.AppendFormat("  order by dbo.GetDistance({0},{1},Latitude,Longitude)", query.Position.Latitude, query.Position.Longitude);
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(stringBuilder.ToString());

            using (IDataReader dataReader = base.database.ExecuteReader(sqlStringCommand))
            {
                while (dataReader.Read())
                {
                    list.Add(new StoreBaseEntity
                    {
                        StoreId   = ((IDataRecord)dataReader)["StoreId"].ToInt(0),
                        StoreName = ((IDataRecord)dataReader)["StoreName"].ToString(),
                        Distance  = ((IDataRecord)dataReader)["Distance"].ToString()
                    });
                }
            }
            return(list);
        }
        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);
        }
Exemple #4
0
        public List <StoreBaseEntity> GetRecomStoreByCountdownProductId(StoreEntityQuery query)
        {
            List <StoreBaseEntity> list          = new List <StoreBaseEntity>();
            StringBuilder          stringBuilder = new StringBuilder("select top 10  s.StoreId,s.StoreName");

            stringBuilder.AppendFormat(",dbo.GetDistance({0},{1},Latitude,Longitude) as Distance", query.Position.Latitude, query.Position.Longitude);
            stringBuilder.AppendFormat(" from Hishop_Stores s  where  (CloseStatus=1 or (CloseStatus=0 and (getdate()<CloseBeginTime or CloseEndTime<GETDATE())))");
            stringBuilder.AppendFormat(" AND [State]=1 and s.TopRegionId={0} and s.StoreId in (select distinct StoreId from  dbo.Hishop_StoreSKUs where ProductId={1} and Stock>0)", query.RegionId, query.ProductId);
            stringBuilder.AppendFormat(" and exists(select * from Hishop_CountDownSku cds inner join Hishop_StoreSKUs ssk on cds.SkuId=ssk.SkuId where cds.CountDownId={0}  and ssk.StoreId=s.StoreId and (case when cds.TotalCount<=ssk.Stock then cds.TotalCount else ssk.Stock end)>(select isnull(SUM(Quantity),0) from Hishop_OrderItems where SkuId=cds.SkuId AND OrderId in(select OrderId from Hishop_Orders where ParentOrderId<>'-1' AND CountDownBuyId={0} AND StoreId=s.StoreId and OrderStatus<>4)))", query.ActivityId);
            stringBuilder.AppendFormat(" and (IsAboveSelf=1 or IsSupportExpress=1 or (IsStoreDelive=1 and (dbo.GetDistance({0},{1},Latitude,Longitude)<(ServeRadius*1000) or dbo.IsInDeliveryScope(StoreId,'{2}')=1)))", query.Position.Latitude, query.Position.Longitude, query.AreaId);
            stringBuilder.AppendFormat(" and StoreId<>{0} and StoreId in ({1})", query.StoreId, query.Key);
            stringBuilder.AppendFormat("  order by dbo.GetDistance({0},{1},Latitude,Longitude)", query.Position.Latitude, query.Position.Longitude);
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(stringBuilder.ToString());

            using (IDataReader dataReader = base.database.ExecuteReader(sqlStringCommand))
            {
                while (dataReader.Read())
                {
                    list.Add(new StoreBaseEntity
                    {
                        StoreId   = ((IDataRecord)dataReader)["StoreId"].ToInt(0),
                        StoreName = ((IDataRecord)dataReader)["StoreName"].ToString(),
                        Distance  = ((IDataRecord)dataReader)["Distance"].ToString()
                    });
                }
            }
            return(list);
        }
        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);
        }
Exemple #6
0
        public List <int> GetAllStoresForOrderPromotions(StoreEntityQuery query)
        {
            List <int>    list          = new List <int>();
            StringBuilder stringBuilder = new StringBuilder("select StoreId from vw_Hishop_StoreForPromotion vs");

            stringBuilder.AppendFormat(" where 0=0");
            if (!string.IsNullOrEmpty(query.Key))
            {
                stringBuilder.AppendFormat(" and StoreName like '%{0}%'", query.Key);
            }
            if (query.TagId > 0)
            {
                stringBuilder.AppendFormat(" and StoreId in(select StoreId from  Hishop_StoreTagRelations  where TagId ={0})", query.TagId);
            }
            if (query.RegionId > 0)
            {
                stringBuilder.AppendFormat(" and [FullRegionPath] like '%,{0}%'", query.RegionId);
            }
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(stringBuilder.ToString());

            using (IDataReader dataReader = base.database.ExecuteReader(sqlStringCommand))
            {
                while (dataReader.Read())
                {
                    list.Add((int)((IDataRecord)dataReader)["StoreId"]);
                }
            }
            return(list);
        }
Exemple #7
0
        public DbQueryResult GetStoreRecommend(StoreEntityQuery query)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("  TopRegionId={0} and (CloseStatus=1 or (CloseStatus=0 and (getdate()<CloseBeginTime or CloseEndTime<GETDATE()))) AND [State]=1", query.RegionId);
            if (query.TagId > 0)
            {
                stringBuilder.AppendFormat(" and s.StoreId in(SELECT[StoreId]  FROM[dbo].[Hishop_StoreTagRelations] where TagId = {0})", query.TagId);
            }
            stringBuilder.AppendFormat(" and (IsAboveSelf=1 or IsSupportExpress=1 or (IsStoreDelive=1 and (dbo.GetDistance({0},{1},Latitude,Longitude)<(ServeRadius*1000) or dbo.IsInDeliveryScope(StoreId,'{2}')=1)))", query.Position.Latitude, query.Position.Longitude, query.FullAreaPath);
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, $"dbo.GetDistance({query.Position.Latitude},{query.Position.Longitude},Latitude,Longitude)", SortAction.Asc, query.IsCount, "Hishop_Stores s", "StoreId", stringBuilder.ToString(), string.Format("StoreId,StoreName,StoreImages,Latitude,Longitude,FullRegionPath,[address],dbo.GetDistance({0},{1},Latitude,Longitude)as Distance,IsAboveSelf,IsSupportExpress,IsStoreDelive,isnull(MinOrderPrice,-1) MinOrderPrice,isnull(StoreFreight,0) as StoreFreight,(select COUNT(1) from Hishop_StoreProducts sp inner join Hishop_Products ps on sp.ProductId=ps.ProductId where storeid=s.StoreId and sp.SaleStatus=1 {2}) as OnSaleNum ", query.Position.Latitude, query.Position.Longitude, (query.ProductType > ProductType.All) ? ("and ProductType=" + query.ProductType.GetHashCode()) : "")));
        }
        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));
        }
        private void GetEnableStores(HttpContext context)
        {
            StoreEntityQuery query = new StoreEntityQuery
            {
                TagId    = context.Request.QueryString["tagId"].ToInt(0),
                RegionId = context.Request.QueryString["regionId"].ToInt(0),
                Key      = context.Request.QueryString["key"].ToString()
            };
            List <int> allStoresForOrderPromotions = StoreListHelper.GetAllStoresForOrderPromotions(query);
            string     s = base.SerializeObjectToJson(allStoresForOrderPromotions);

            context.Response.Write(s);
            context.Response.End();
        }
        private void SearchInStoreList(HttpContext context)
        {
            PageModel <StoreEntity> pageModel        = new PageModel <StoreEntity>();
            StoreEntityQuery        storeEntityQuery = new StoreEntityQuery();

            storeEntityQuery.Key = DataHelper.CleanSearchString(Globals.UrlDecode(context.Request["Key"].ToNullString()).Trim());
            int num = context.Request["categoryId"].ToInt(0);

            if (num > 0)
            {
                storeEntityQuery.CategoryId       = num;
                storeEntityQuery.MainCategoryPath = CatalogHelper.GetCategory(num).Path;
            }
            if (!string.IsNullOrEmpty(context.Request["pageIndex"]))
            {
                storeEntityQuery.PageIndex = int.Parse(context.Request["pageIndex"]);
            }
            if (!string.IsNullOrEmpty(context.Request["pageSize"]))
            {
                storeEntityQuery.PageSize = int.Parse(context.Request["pageSize"]);
            }
            storeEntityQuery.RegionId = WebHelper.GetCookie("UserCoordinateCookie", "CityRegionId").ToInt(0);
            storeEntityQuery.AreaId   = WebHelper.GetCookie("UserCoordinateCookie", "RegionId").ToInt(0);
            string[] array = WebHelper.GetCookie("UserCoordinateCookie", "NewCoordinate").Split(',');
            storeEntityQuery.Position    = new PositionInfo(array[0].ToDouble(0), array[1].ToDouble(0));
            storeEntityQuery.ProductType = ProductType.All;
            pageModel = StoreListHelper.SearchPdInStoreList(storeEntityQuery);
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            foreach (StoreEntity model in pageModel.Models)
            {
                foreach (StoreProductEntity product in model.ProductList)
                {
                    if (string.IsNullOrEmpty(product.ThumbnailUrl220))
                    {
                        product.ThumbnailUrl220 = masterSettings.DefaultProductThumbnail4;
                    }
                    else
                    {
                        product.ThumbnailUrl220 = Globals.FullPath(product.ThumbnailUrl220);
                    }
                    product.SalePrice = product.SalePrice.F2ToString("f2").ToDecimal(0);
                }
            }
            string s = JsonConvert.SerializeObject(pageModel);

            context.Response.ContentType = "text/json";
            context.Response.Write(s);
        }
        private void GetStoreListNew(HttpContext context)
        {
            PageModel <StoreEntity> value = new PageModel <StoreEntity>();
            StoreEntityQuery        storeQueryFromCookie = DepotHandler.GetStoreQueryFromCookie(context);

            if (storeQueryFromCookie != null)
            {
                storeQueryFromCookie.ProductType = ProductType.All;
                value = StoreListHelper.GetStoreRecommend(storeQueryFromCookie);
            }
            string s = JsonConvert.SerializeObject(value);

            context.Response.ContentType = "text/json";
            context.Response.Write(s);
        }
        private void GetStores(HttpContext context)
        {
            StoreEntityQuery query = new StoreEntityQuery
            {
                TagId     = context.Request.QueryString["tagId"].ToInt(0),
                RegionId  = context.Request.QueryString["regionId"].ToInt(0),
                PageIndex = context.Request.QueryString["pageIndex"].ToInt(0),
                PageSize  = context.Request.QueryString["pageSize"].ToInt(0),
                Key       = context.Request.QueryString["key"]
            };
            PageModel <StoreForPromotion> storesForOrderPromotions = StoreListHelper.GetStoresForOrderPromotions(query);
            string s = base.SerializeObjectToJson(storesForOrderPromotions);

            context.Response.Write(s);
            context.Response.End();
        }
Exemple #13
0
        private void GetEnableStores(HttpContext context)
        {
            int productId          = context.Request.QueryString["productId"].ToInt(0);
            StoreEntityQuery query = new StoreEntityQuery
            {
                ProductId  = productId,
                TagId      = context.Request.QueryString["tagId"].ToInt(0),
                RegionId   = context.Request.QueryString["regionId"].ToInt(0),
                Key        = context.Request.QueryString["key"].ToString(),
                ActivityId = context.Request.QueryString["activityId"].ToInt(0)
            };
            List <int> allStoresForCountDowns = StoreListHelper.GetAllStoresForCountDowns(query);
            string     s = base.SerializeObjectToJson(allStoresForCountDowns);

            context.Response.Write(s);
            context.Response.End();
        }
        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));
        }
Exemple #15
0
        public DbQueryResult GetStoresForCountDowns(StoreEntityQuery query)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("  1=1", query.ProductId);
            if (!string.IsNullOrEmpty(query.Key))
            {
                stringBuilder.AppendFormat(" and StoreName like '%{0}%'", query.Key);
            }
            if (query.TagId > 0)
            {
                stringBuilder.AppendFormat(" and StoreId in(select StoreId from  Hishop_StoreTagRelations  where TagId ={0})", query.TagId);
            }
            if (query.RegionId > 0)
            {
                stringBuilder.AppendFormat(" and [FullRegionPath] like '%,{0}%'", query.RegionId);
            }
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, $"dbo.PromotionStatus(vs.StoreId,{query.ProductId},{query.ActivityId})", SortAction.Asc, query.IsCount, "vw_Hishop_StoreForPromotion vs", "StoreId", stringBuilder.ToString(), $"StoreId,StoreName,[address],dbo.PromotionStatus(vs.StoreId,{query.ProductId},{query.ActivityId}) as PromotionStatus "));
        }
        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);
        }
        protected override void AttachChildControls()
        {
            base.CheckOpenMultStore();
            StoreEntityQuery storeEntityQuery = null;
            string           cookie           = WebHelper.GetCookie("UserCoordinateCookie");

            if (!string.IsNullOrEmpty(cookie))
            {
                storeEntityQuery          = new StoreEntityQuery();
                storeEntityQuery.RegionId = WebHelper.GetCookie("UserCoordinateCookie", "CityRegionId").ToInt(0);
                storeEntityQuery.AreaId   = WebHelper.GetCookie("UserCoordinateCookie", "RegionId").ToInt(0);
                if (storeEntityQuery.RegionId == 0 || storeEntityQuery.AreaId == 0)
                {
                    this.Page.Response.Redirect("StoreList?from");
                }
            }
            else
            {
                this.Page.Response.Redirect("StoreList?from");
            }
        }
        private void GetRecomStoreByProductId(HttpContext context)
        {
            List <StoreBaseEntity> source = new List <StoreBaseEntity>();
            StoreEntityQuery       query  = DepotHandler.GetStoreQueryFromCookie(context);

            if (query != null)
            {
                source = StoreListHelper.GetStoreRecommendByProductId(query);
            }
            var value = (from a in source
                         select new
            {
                a.StoreId,
                a.StoreName,
                a.Distance,
                query.ProductId
            }).ToList();
            string s = JsonConvert.SerializeObject(value);

            context.Response.ContentType = "text/json";
            context.Response.Write(s);
        }
        private static StoreEntityQuery GetStoreQueryFromCookie(HttpContext context)
        {
            StoreEntityQuery storeEntityQuery = null;
            string           cookie           = WebHelper.GetCookie("UserCoordinateCookie");

            if (!string.IsNullOrEmpty(cookie) || !string.IsNullOrEmpty(context.Request["positionJson"]))
            {
                storeEntityQuery = new StoreEntityQuery();
                if (!string.IsNullOrEmpty(context.Request["pageIndex"]))
                {
                    storeEntityQuery.PageIndex = int.Parse(context.Request["pageIndex"]);
                }
                if (!string.IsNullOrEmpty(context.Request["pageSize"]))
                {
                    storeEntityQuery.PageSize = int.Parse(context.Request["pageSize"]);
                }
                if (!string.IsNullOrEmpty(cookie))
                {
                    storeEntityQuery.RegionId     = WebHelper.GetCookie("UserCoordinateCookie", "CityRegionId").ToInt(0);
                    storeEntityQuery.FullAreaPath = WebHelper.GetCookie("UserCoordinateCookie", "FullRegionPath");
                    string[] array = WebHelper.GetCookie("UserCoordinateCookie", "NewCoordinate").Split(',');
                    storeEntityQuery.Position = new PositionInfo(array[0].ToDouble(0), array[1].ToDouble(0));
                }
                else
                {
                    StoreEntityQuery storeEntityQuery2 = JsonConvert.DeserializeObject <StoreEntityQuery>(context.Request["positionJson"]);
                    storeEntityQuery.RegionId     = storeEntityQuery2.RegionId;
                    storeEntityQuery.FullAreaPath = storeEntityQuery2.FullAreaPath;
                    storeEntityQuery.Position     = storeEntityQuery2.Position;
                }
                storeEntityQuery.TagId      = context.Request["tagId"].ToInt(0);
                storeEntityQuery.ProductId  = context.Request["productId"].ToInt(0);
                storeEntityQuery.ActivityId = context.Request["activityId"].ToInt(0);
                storeEntityQuery.StoreId    = context.Request["storeId"].ToInt(0);
            }
            return(storeEntityQuery);
        }
        public static List <int> GetAllStoresForCountDowns(StoreEntityQuery query)
        {
            StoreProductDao storeProductDao = new StoreProductDao();

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

            return(storeProductDao.GetAllStoresForOrderPromotions(query));
        }
        private void SetControlsValue(CountDownInfo countDownInfo)
        {
            this.skuSubmitOrder.CountDownId   = countDownInfo.CountDownId;
            this.skuSubmitOrder.CountDownInfo = countDownInfo;
            this.skuSubmitOrder.OrderBusiness = 2;
            HtmlInputHidden htmlInputHidden = this.hdCountDownId;
            int             num             = countDownInfo.CountDownId;

            htmlInputHidden.Value    = num.ToString();
            this.hiddenIsLogin.Value = HiContext.Current.UserId.ToString();
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            this.hidRecommend.Value = (masterSettings.Store_IsRecommend ? "1" : "0");
            StoreProductQuery storeProductQuery = new StoreProductQuery
            {
                ProductId   = countDownInfo.ProductId,
                StoreId     = this.storeId,
                CountDownId = this.countDownId
            };
            string cookie = WebHelper.GetCookie("UserCoordinateCookie", "NewCoordinate");

            if (!string.IsNullOrEmpty(cookie))
            {
                string[] array = cookie.Split(',');
                storeProductQuery.Position        = new PositionInfo(array[0].ToDouble(0), array[1].ToDouble(0));
                storeProductQuery.Position.CityId = WebHelper.GetCookie("UserCoordinateCookie", "CityRegionId").ToInt(0);
                storeProductQuery.Position.AreaId = WebHelper.GetCookie("UserCoordinateCookie", "RegionId").ToInt(0);
                StoreEntityQuery storeEntityQuery = new StoreEntityQuery();
                storeEntityQuery.Position     = new PositionInfo(array[0].ToDouble(0), array[1].ToDouble(0));
                storeEntityQuery.RegionId     = WebHelper.GetCookie("UserCoordinateCookie", "CityRegionId").ToInt(0);
                storeEntityQuery.FullAreaPath = WebHelper.GetCookie("UserCoordinateCookie", "FullRegionPath");
                this.hidLanLng.Value          = JsonConvert.SerializeObject(storeEntityQuery);
            }
            else
            {
                storeProductQuery.Position        = new PositionInfo(0.0, 0.0);
                storeProductQuery.Position.CityId = 0;
                storeProductQuery.Position.AreaId = 0;
            }
            this.hidStoreId.Value = this.storeId.ToString();
            HtmlInputHidden htmlInputHidden2 = this.hidStoreType;

            num = countDownInfo.StoreType;
            htmlInputHidden2.Value = num.ToString();
            ProductModel storeProduct = ProductBrowser.GetStoreProduct(storeProductQuery);

            if (storeProduct == null || storeProduct.SaleStatus == ProductSaleStatus.Delete)
            {
                this.ShowWapMessage("抢购商品已不存在", "Default.aspx");
            }
            else
            {
                if (!storeProduct.SaleStatus.Equals(ProductSaleStatus.OnSale))
                {
                    this.hidden_IsOver.Value = "pullOff";
                }
                this.litShortDescription.Text    = storeProduct.ShortDescription;
                this.divShortDescription.Visible = !string.IsNullOrEmpty(storeProduct.ShortDescription);
                if (!countDownInfo.IsJoin)
                {
                    this.hidden_IsOver.Value = "nojoin";
                }
                else if (countDownInfo.StartDate > DateTime.Now)
                {
                    this.hidden_IsOver.Value = "AboutToBegin";
                }
                else if (countDownInfo.EndDate < DateTime.Now)
                {
                    this.hidden_IsOver.Value = "over";
                }
                else if (!countDownInfo.IsRunning)
                {
                    this.hidden_IsOver.Value = "true";
                }
                if (storeProduct.SaleStatus != ProductSaleStatus.OnSale)
                {
                    this.ShowWapMessage("此商品已下架", "Default.aspx");
                }
                if (this.expandAttr != null)
                {
                    this.expandAttr.ProductId = storeProduct.ProductId;
                }
                this.skuSubmitOrder.ProductInfo = storeProduct;
                this.litProdcutName.SetWhenIsNotNull(storeProduct.ProductName);
                Literal control = this.litminCount;
                num = countDownInfo.MaxCount;
                control.SetWhenIsNotNull(num.ToString());
                storeProduct.ImgUrlList.ForEach(delegate(string i)
                {
                    Literal literal4 = this.litPdImgSlides;
                    literal4.Text   += $"<img src=\"{i}\" />";
                });
                if (this.litDescription != null && !string.IsNullOrWhiteSpace(storeProduct.Description))
                {
                    Regex regex = new Regex("<script[^>]*?>.*?</script>", RegexOptions.IgnoreCase);
                    this.litDescription.Text = regex.Replace(storeProduct.Description, "").Replace("src", "data-url");
                }
                this.litprice.SetWhenIsNotNull(PromoteHelper.GetCountDownSalePrice(this.countDownId).F2ToString("f2"));
                this.litLeftSeconds.SetWhenIsNotNull(Math.Ceiling((countDownInfo.EndDate - DateTime.Now).TotalSeconds).ToString());
                this.litcontent.SetWhenIsNotNull(countDownInfo.Content);
                HtmlInputControl control2 = this.litGroupBuyId;
                num = countDownInfo.CountDownId;
                control2.SetWhenIsNotNull(num.ToString());
                if (storeProduct.MarketPrice > decimal.Zero)
                {
                    this.salePrice.SetWhenIsNotNull(storeProduct.MarketPrice.F2ToString("f2"));
                }
                else
                {
                    this.salePrice.Text = storeProduct.MaxSalePrice.F2ToString("f2");
                }
                HtmlInputControl control3 = this.txtProductId;
                num = countDownInfo.ProductId;
                control3.SetWhenIsNotNull(num.ToString());
                Literal control4 = this.litConsultationsCount;
                num = storeProduct.ConsultationCount;
                control4.SetWhenIsNotNull(num.ToString());
                Literal control5 = this.litReviewsCount;
                num = storeProduct.ReviewCount;
                control5.SetWhenIsNotNull(num.ToString());
                this.litGroupbuyDescription.SetWhenIsNotNull(countDownInfo.Content);
                Literal control6 = this.litMaxCount;
                num = countDownInfo.MaxCount;
                control6.SetWhenIsNotNull(num.ToString());
                this.nowTime = (HtmlInputHidden)this.FindControl("nowTime");
                HtmlInputHidden control7 = this.nowTime;
                DateTime        dateTime = DateTime.Now;
                control7.SetWhenIsNotNull(dateTime.ToString("yyyy/MM/dd HH:mm:ss", DateTimeFormatInfo.InvariantInfo));
                HtmlInputHidden control8 = this.startTime;
                dateTime = countDownInfo.StartDate;
                control8.SetWhenIsNotNull(dateTime.ToString("yyyy/MM/dd HH:mm:ss"));
                HtmlInputHidden control9 = this.endTime;
                dateTime = countDownInfo.EndDate;
                control9.SetWhenIsNotNull(dateTime.ToString("yyyy/MM/dd HH:mm:ss"));
                HtmlInputHidden control10 = this.groupBuyMaxCount;
                num = countDownInfo.MaxCount;
                control10.SetWhenIsNotNull(num.ToString());
                if (storeProduct.StoreInfo.IsInServiceArea)
                {
                    this.ltlStoreName      = (Literal)this.FindControl("ltlStoreName");
                    this.ltlStoreName.Text = storeProduct.StoreInfo.StoreName;
                    this.ltlDistance       = (Literal)this.FindControl("ltlDistance");
                    this.ltlDistance.Text  = storeProduct.StoreInfo.Distance;
                    this.ltlDelivery       = (Literal)this.FindControl("ltlDelivery");
                    this.ltlDelivery.Text  = storeProduct.StoreInfo.Delivery.DeliveryList.Aggregate(string.Empty, (string t, string n) => "<li>" + t + "</li><li>" + n + "</li>");
                    this.ltlDeliveryDetail = (Literal)this.FindControl("ltlDeliveryDetail");
                    if (storeProduct.StoreInfo.Delivery.IsStoreDelive)
                    {
                        if (storeProduct.StoreInfo.Delivery.MinOrderPrice > decimal.Zero)
                        {
                            Literal literal = this.ltlDeliveryDetail;
                            num          = storeProduct.StoreInfo.Delivery.MinOrderPrice.ToInt(0);
                            literal.Text = $"¥<em>{num.ToString()}</em>起送";
                            if (storeProduct.StoreInfo.Delivery.StoreFreight > decimal.Zero)
                            {
                                Literal literal2 = this.ltlDeliveryDetail;
                                string  text     = literal2.Text;
                                num           = storeProduct.StoreInfo.Delivery.StoreFreight.ToInt(0);
                                literal2.Text = text + $",配送费¥<em>{num.ToString()}</em>";
                            }
                            else
                            {
                                Literal literal3 = this.ltlDeliveryDetail;
                                literal3.Text += string.Format(",免配送费");
                            }
                        }
                        else if (storeProduct.StoreInfo.Delivery.StoreFreight > decimal.Zero)
                        {
                            this.ltlDeliveryDetail.Text = $"配送费¥<em>{storeProduct.StoreInfo.Delivery.StoreFreight.ToInt(0)}</em>";
                        }
                        else
                        {
                            this.ltlDeliveryDetail.Text = string.Format("免配送费");
                        }
                    }
                    this.ltlStoreAddress      = (Literal)this.FindControl("ltlStoreAddress");
                    this.ltlStoreAddress.Text = storeProduct.StoreInfo.AddressSimply;
                    this.hidLngLat.Value      = $"{storeProduct.StoreInfo.Position.Longitude},{storeProduct.StoreInfo.Position.Latitude}";
                    this.hidStoreName.Value   = storeProduct.StoreInfo.StoreName;
                    this.hidQQMapKey.Value    = masterSettings.QQMapAPIKey;
                }
                if (storeProduct.ExStatus == DetailException.Nomal)
                {
                    this.hidNoData.Value = "0";
                }
                else
                {
                    this.hidNoData.Value = "1";
                }
                this.litUnit.SetWhenIsNotNull(string.IsNullOrEmpty(storeProduct.Unit) ? "件" : storeProduct.Unit);
                this.SetWXShare(countDownInfo, storeProduct);
                this.ProcessException(storeProduct);
            }
        }