Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
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();
        }
Exemplo n.º 6
0
 protected override void AttachChildControls()
 {
     base.CheckOpenMultStore();
     this.literlitNoMatchSwitchal = (Literal)this.FindControl("litNoMatchSwitch");
     this.litTag = (Literal)this.FindControl("litTag");
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["TagId"]))
     {
         StoreTagInfo storeTagInfo = (from t in StoreListHelper.GetTagsList()
                                      where t.TagId == this.Page.Request.QueryString["TagId"].ToInt(0)
                                      select t).FirstOrDefault();
         if (storeTagInfo != null)
         {
             this.litTag.Text = (from t in StoreListHelper.GetTagsList()
                                 where t.TagId == this.Page.Request.QueryString["TagId"].ToInt(0)
                                 select t).FirstOrDefault().TagName;
         }
     }
 }
Exemplo n.º 7
0
        protected override void AttachChildControls()
        {
            base.CheckOpenMultStore();
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            MemberInfo   user           = HiContext.Current.User;

            if (user.UserId != 0 && user.IsReferral() && string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralUserId"]))
            {
                string text = HttpContext.Current.Request.Url.ToString();
                text = ((text.IndexOf("?") <= -1) ? (text + "?ReferralUserId=" + HiContext.Current.UserId) : (text + "&ReferralUserId=" + HiContext.Current.UserId));
                this.Page.Response.Redirect(text);
            }
            else
            {
                this.literlitNoMatchSwitchal = (Literal)this.FindControl("litNoMatchSwitch");
                this.litAddr             = (Literal)this.FindControl("litAddr");
                this.hdQQMapKey          = (HtmlInputHidden)this.FindControl("hdQQMapKey");
                this.hidIsReloadPosition = (HtmlInputHidden)this.FindControl("hidIsReloadPosition");
                this.hdQQMapKey.Value    = (string.IsNullOrEmpty(masterSettings.QQMapAPIKey) ? "SYJBZ-DSLR3-IWX3Q-3XNTM-ELURH-23FTP" : masterSettings.QQMapAPIKey);
                string cookie  = WebHelper.GetCookie("UserCoordinateCookie");
                string cookie2 = WebHelper.GetCookie("UserCoordinateTimeCookie");
                this.litAddr.Text = HttpUtility.UrlDecode(WebHelper.GetCookie("UserCoordinateCookie", "Address").ToNullString());
                if (string.IsNullOrEmpty(cookie) || string.IsNullOrEmpty(cookie2))
                {
                    this.litAddr.Text = "<img src=\"/templates/common/images/icon/ani_loading.png\" class=\"iconzhuan\" />";
                    this.hidIsReloadPosition.Value = "1";
                }
                this.litBanner = (Literal)this.FindControl("litBanner");
                this.literlitNoMatchSwitchal.Text = masterSettings.Store_PositionNoMatchTo;
                if (this.Page.Request.Url.Query.ToLower().Contains("from"))
                {
                    Dictionary <string, string> bannerList = StoreListHelper.GetBannerList();
                    foreach (string key in bannerList.Keys)
                    {
                        Literal literal = this.litBanner;
                        literal.Text += string.Format("<a href='{1}'><img src='{0}'  style=\"width:750px;height:280px\"></a>", key, bannerList[key]);
                    }
                    this.rptTags            = (WapTemplatedRepeater)this.FindControl("rptTags");
                    this.rptTags.DataSource = StoreListHelper.GetTagsList();
                    this.rptTags.DataBind();
                }
            }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        public static ProductModel GetStoreProduct(StoreProductQuery query)
        {
            ProductBrowseDao productBrowseDao = new ProductBrowseDao();

            productBrowseDao.AddVistiCounts(query.ProductId);
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            ProductModel result         = productBrowseDao.GetProductModel(query);

            if (string.IsNullOrEmpty(result.SubmitOrderImg))
            {
                result.SubmitOrderImg = masterSettings.DefaultProductThumbnail4;
            }
            if (result.StoreInfo != null && !string.IsNullOrEmpty(result.StoreInfo.FullRegionPath))
            {
                string tempAllRegions = result.StoreInfo.FullRegionPath + ",";
                Dictionary <string, string> regionName = RegionHelper.GetRegionName(tempAllRegions);
                result.StoreInfo.AddressSimply = StoreListHelper.ProcessAddress(regionName, result.StoreInfo.FullRegionPath, result.StoreInfo.Address);
            }
            if (result.ImgUrlList != null && result.ImgUrlList.Count > 0)
            {
                string[] array = new string[result.ImgUrlList.Count];
                Array.Copy(result.ImgUrlList.ToArray(), array, result.ImgUrlList.Count);
                result.ImgUrlList = new List <string>();
                array.ForEach(delegate(string t)
                {
                    if (!string.IsNullOrEmpty(t))
                    {
                        result.ImgUrlList.Add(t);
                    }
                });
            }
            else
            {
                result.ImgUrlList = new List <string>
                {
                    masterSettings.DefaultProductImage
                };
            }
            if (result.ImgUrlList.Count == 0)
            {
                result.ImgUrlList = new List <string>
                {
                    masterSettings.DefaultProductImage
                };
            }
            MemberInfo user = HiContext.Current.User;

            if (user.UserId != 0)
            {
                int gradeId = user.GradeId;
                if (query.CountDownId == 0)
                {
                    MemberGradeInfo memberGrade = MemberHelper.GetMemberGrade(gradeId);
                    if (memberGrade != null)
                    {
                        result.GradeName    = memberGrade.Name;
                        result.MinSalePrice = (decimal)memberGrade.Discount * result.MinSalePrice / 100m;
                        result.MaxSalePrice = (decimal)memberGrade.Discount * result.MaxSalePrice / 100m;
                    }
                    result.Skus.ForEach(delegate(SKUItem sk)
                    {
                        sk.SalePrice = (decimal)memberGrade.Discount * sk.SalePrice / 100m;
                    });
                }
                result.IsFavorite = ProductBrowser.ExistsProduct(result.ProductId, user.UserId, result.StoreId);
                if (user != null && user.IsReferral() && (!(masterSettings.SubMemberDeduct <= decimal.Zero) || result.SubMemberDeduct.HasValue))
                {
                    if (!result.SubMemberDeduct.HasValue)
                    {
                        goto IL_0381;
                    }
                    decimal?subMemberDeduct = result.SubMemberDeduct;
                    if (!(subMemberDeduct.GetValueOrDefault() <= default(decimal)) || !subMemberDeduct.HasValue)
                    {
                        goto IL_0381;
                    }
                }
                goto IL_03b9;
            }
            goto IL_0445;
IL_0445:
            if (result.StoreInfo == null)
            {
                result.ExStatus = DetailException.StopService;
            }
            else if (!result.StoreInfo.IsOpen && result.StoreInfo.CloseEndTime.HasValue && result.StoreInfo.CloseStartTime.HasValue && result.StoreInfo.CloseEndTime.Value > DateTime.Now && result.StoreInfo.CloseStartTime.Value < DateTime.Now)
            {
                result.ExStatus = DetailException.StopService;
            }
            else if (result.Stock == 0)
            {
                result.ExStatus = DetailException.NoStock;
            }
            else if (!result.StoreInfo.IsInServiceArea)
            {
                result.ExStatus = DetailException.OverServiceArea;
            }
            else if (!masterSettings.Store_IsOrderInClosingTime)
            {
                DateTime dateTime = DateTime.Now;
                string   str      = dateTime.ToString("yyyy-MM-dd");
                dateTime = result.StoreInfo.OpenStartTime;
                DateTime value = (str + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                dateTime = DateTime.Now;
                string str2 = dateTime.ToString("yyyy-MM-dd");
                dateTime = result.StoreInfo.OpenEndTime;
                DateTime dateTime2 = (str2 + " " + dateTime.ToString("HH:mm")).ToDateTime().Value;
                if (dateTime2 <= value)
                {
                    dateTime2 = dateTime2.AddDays(1.0);
                }
                if (DateTime.Now < value || DateTime.Now > dateTime2)
                {
                    result.ExStatus = DetailException.IsNotWorkTime;
                }
            }
            BrowsedProductQueue.EnQueue(query.ProductId);
            return(result);

IL_0381:
            int num;

            if (HiContext.Current.SiteSettings.OpenReferral == 1 && HiContext.Current.SiteSettings.ShowDeductInProductPage && user.Referral != null)
            {
                num = (user.Referral.IsRepeled ? 1 : 0);
                goto IL_03ba;
            }
            goto IL_03b9;
IL_03ba:
            if (num != 0)
            {
                result.ProductReduce = "";
            }
            else
            {
                decimal d = result.SubMemberDeduct.HasValue ? result.SubMemberDeduct.Value : masterSettings.SubMemberDeduct;
                result.ProductReduce = (result.MinSalePrice * d / 100m).F2ToString("f2");
            }
            goto IL_0445;
IL_03b9:
            num = 1;
            goto IL_03ba;
        }