Example #1
0
        protected override void AttachChildControls()
        {
            if (!int.TryParse(this.Page.Request.QueryString["supplierId"], out this.supplierId))
            {
                base.GotoResourceNotFound("店铺已不存在");
            }
            //店铺收藏数
            this.litSupplierFavCount = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplierFavCount");
            //店铺logo
            this.imgSupplierLogo = (HiImage)this.FindControl("imgSupplierLogo");

            this.isCollect = (System.Web.UI.WebControls.Literal) this.FindControl("isCollect");

            //店铺名称
            this.litSupplierName = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplierName");
            //店主名称
            this.litSupplierOwner = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplierOwner");
            //店铺地址
            this.litSupplierAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplierAddress");
            //开店时间
            this.litSupplierCreateTime = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplierCreateTime");

            Member member = HiContext.Current.User as Member;
            int    userId = 0;

            if (member != null)
            {
                userId = member.UserId;
            }
            AppSupplierInfo info = SupplierHelper.GetAppSupplier(supplierId, userId);

            if (info != null)
            {
                this.litSupplierFavCount.Text = info.CollectCount > 0 ? info.CollectCount.ToString() : "0";
                this.imgSupplierLogo.ImageUrl = info.Logo;
                this.litSupplierName.Text     = info.ShopName;
                this.litSupplierOwner.Text    = info.ShopOwner;
                this.isCollect.Text           = info.IsCollect.ToString();
                if (info.CreateDate.HasValue)
                {
                    this.litSupplierAddress.Text = RegionHelper.GetFullRegion(info.County, ",").Split(',')[0];
                }
                if (info.County > 0)
                {
                    this.litSupplierCreateTime.Text = info.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
                }
            }
            else
            {
                base.GotoResourceNotFound("店铺已不存在");
            }
        }
Example #2
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("店铺列表");
            this.txtTotal         = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtTotal");
            this.rptSupplierList  = (VshopTemplatedRepeater)this.FindControl("rptSupplierList");
            this.rpthistorysearch = (VshopTemplatedRepeater)this.FindControl("rpthistorysearch");

            int pageIndex;

            if (!int.TryParse(this.Page.Request.QueryString["page"], out pageIndex))
            {
                pageIndex = 1;
            }
            int pageSize;

            if (!int.TryParse(this.Page.Request.QueryString["size"], out pageSize))
            {
                pageSize = 10;
            }

            string supplierName = this.Page.Request.QueryString["keyWord"];

            SupplierQuery query = new SupplierQuery();

            query.SupplierName = supplierName;
            query.PageIndex    = pageIndex;
            query.PageSize     = pageSize;
            query.UserId       = HiContext.Current.User.UserId;

            DbQueryResult dt = SupplierHelper.GetAppSupplier(query);

            this.rptSupplierList.DataSource = dt.Data;
            this.rptSupplierList.DataBind();
            this.txtTotal.SetWhenIsNotNull(dt.TotalRecords.ToString());

            int userId = HiContext.Current.User.UserId;

            if (userId > 0 && this.rpthistorysearch != null)
            {
                this.rpthistorysearch.DataSource = HistorySearchHelp.GetSearchHistory(userId, ClientType.VShop, 6);
                this.rpthistorysearch.DataBind();
            }
        }
Example #3
0
        private SupplierListItem GetSupplierDetail(string userId, int supplierId)
        {
            SupplierListItem data = null;

            int intUserId = 0;

            Member member = GetMember(userId.ToSeesionId());

            if (member != null)
            {
                intUserId = member.UserId;
            }

            AppSupplierInfo info = SupplierHelper.GetAppSupplier(supplierId, intUserId);

            if (info != null)
            {
                data = new SupplierListItem();
                data.CollectCount = info.CollectCount;
                data.IsCollect    = info.IsCollect;
                data.SupplierId   = info.SupplierId;
                data.ShopOwner    = info.ShopOwner;
                data.Image        = Util.AppendImageHost(info.Logo);
                data.Background   = Util.AppendImageHost(info.MobileImage);
                data.SupplierName = info.ShopName;
                if (info.CreateDate.HasValue)
                {
                    data.CreateDate = info.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
                }

                if (info.County > 0)
                {
                    data.Location = RegionHelper.GetFullRegion(info.County, ",").Split(',')[0];
                }
            }

            return(data);
        }
Example #4
0
        protected override void AttachChildControls()
        {
            #region == 店铺信息
            if (!int.TryParse(this.Page.Request.QueryString["supplierId"], out this.supplierId))
            {
                base.GotoResourceNotFound("店铺已不存在");
            }
            //店铺收藏数
            this.litSupplierFavCount = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplierFavCount");
            //店铺logo
            this.imgSupplierLogo = (HiImage)this.FindControl("imgSupplierLogo");

            this.isCollect = (System.Web.UI.WebControls.Literal) this.FindControl("isCollect");

            //店铺名称
            this.litSupplierName = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplierName");
            //店主名称
            this.litSupplierOwner = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplierOwner");
            //店铺地址
            this.litSupplierAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplierAddress");
            //开店时间
            this.litSupplierCreateTime = (System.Web.UI.WebControls.Literal) this.FindControl("litSupplierCreateTime");

            Member member = HiContext.Current.User as Member;
            int    userId = 0;
            if (member != null)
            {
                userId = member.UserId;
            }
            AppSupplierInfo info = SupplierHelper.GetAppSupplier(supplierId, userId);

            if (info != null)
            {
                this.litSupplierFavCount.Text = info.CollectCount > 0 ? info.CollectCount.ToString() : "0";
                this.imgSupplierLogo.ImageUrl = info.Logo;
                this.litSupplierName.Text     = info.ShopName;
                this.litSupplierOwner.Text    = info.ShopOwner;
                //this.isCollect.Text = info.IsCollect.ToString();
                if (info.CreateDate.HasValue)
                {
                    this.litSupplierAddress.Text = RegionHelper.GetFullRegion(info.County, ",").Split(',')[0];
                }
                if (info.County > 0)
                {
                    this.litSupplierCreateTime.Text = info.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
                }
            }
            else
            {
                base.GotoResourceNotFound("店铺已不存在");
            }
            #endregion
            this.imgUrl     = (HiImage)this.FindControl("imgUrl");
            this.litContent = (System.Web.UI.WebControls.Literal) this.FindControl("litContent");
            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            int.TryParse(this.Page.Request.QueryString["SupplierId"], out this.supplierId);
            int.TryParse(this.Page.Request.QueryString["TopicId"], out this.TopicId);
            int.TryParse(this.Page.Request.QueryString["brandid"], out this.brandid);
            int.TryParse(this.Page.Request.QueryString["importsourceid"], out this.importsourceid);
            this.keyWord = this.Page.Request.QueryString["keyWord"];
            if (!string.IsNullOrWhiteSpace(this.keyWord))
            {
                this.keyWord = this.keyWord.Trim();
                if (HiContext.Current.User.UserId > 0)
                {
                    HistorySearchHelp.NewSearchHistory(this.keyWord.Trim(), HiContext.Current.User.UserId, Entities.ClientType.VShop);
                }
            }
            this.rptProducts           = (VshopTemplatedRepeater)this.FindControl("rptProducts");
            this.rptCategories         = (VshopTemplatedRepeater)this.FindControl("rptCategories");
            this.txtTotalPages         = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtTotal");
            this.litSiblingsCategories = (System.Web.UI.WebControls.Literal) this.FindControl("litSiblingsCategories");
            string text = this.Page.Request.QueryString["sort"];
            if (string.IsNullOrWhiteSpace(text))
            {
                text = "DisplaySequence";
            }
            string text2 = this.Page.Request.QueryString["order"];
            if (string.IsNullOrWhiteSpace(text2))
            {
                text2 = "desc";
            }
            int pageNumber;
            if (!int.TryParse(this.Page.Request.QueryString["page"], out pageNumber))
            {
                pageNumber = 1;
            }
            int maxNum;
            if (!int.TryParse(this.Page.Request.QueryString["size"], out maxNum))
            {
                maxNum = 8;
            }
            //获取其他分类

            System.Collections.Generic.IList <CategoryInfo> maxSubCategories = CategoryBrowser.GetMaxSubCategories(this.categoryId, 1000);
            this.rptCategories.DataSource = maxSubCategories;
            this.rptCategories.DataBind();

            IList <CategoryInfo> siblingsCategories = CategoryBrowser.GetSiblingsCategories(this.categoryId, 1000);
            //<li><a class="link" href="/Vshop/ProductList.aspx?categoryId=8000036">进口零食</a></li>
            StringBuilder stringBuilderCategories = new StringBuilder();
            foreach (CategoryInfo item in siblingsCategories)
            {
                stringBuilderCategories.AppendFormat("<li><a class=\"link\" href=\"/Vshop/ProductList.aspx?categoryId={0}\">{1}</a></li>", item.CategoryId, item.Name);
            }
            this.litSiblingsCategories.Text = stringBuilderCategories.ToString();
            int num;

            ProductBrowseQuery query = new ProductBrowseQuery();
            if (this.categoryId > 0)
            {
                query.StrCategoryId = this.categoryId.ToString();
            }

            if (this.supplierId > 0)
            {
                query.supplierid = this.supplierId;
            }

            if (this.brandid > 0)
            {
                query.StrBrandId = this.brandid.ToString();
            }

            if (this.importsourceid > 0)
            {
                query.StrImportsourceId = this.importsourceid.ToString();
            }


            if (!string.IsNullOrWhiteSpace(this.keyWord))
            {
                query.Keywords = this.keyWord;
            }

            query.PageIndex = pageNumber;
            query.PageSize  = maxNum;
            query.SortBy    = text;

            if (text2.ToLower() == "desc")
            {
                query.SortOrder = EcShop.Core.Enums.SortAction.Desc;
            }
            else
            {
                query.SortOrder = EcShop.Core.Enums.SortAction.Asc;
            }
            DbQueryResult dr = ProductBrowser.GetCurrBrowseProductList(query);

            //this.rptProducts.DataSource = ProductBrowser.GetProducts(null, new int?(this.categoryId), new int?(this.supplierId), this.keyWord, pageNumber, maxNum, out num, text, true, text2, true, new int?(this.brandid), new int?(this.importsourceid));

            this.rptProducts.DataSource = dr.Data;
            this.rptProducts.DataBind();
            this.txtTotalPages.SetWhenIsNotNull(dr.TotalRecords.ToString());

            PageTitle.AddSiteNameTitle("店内搜索");
        }
Example #5
0
        public IHttpActionResult GetSupplierList(string userId, string accessToken, int channel, int platform, string ver, int pageIndex, int pageSize, string supplierName)
        {
            Logger.WriterLogger("Supplier.GetSupplierList, Params: " + string.Format("userId={0}&accessToken={1}&channel={2}&platform={3}&ver={4}&pageIndex={5}&pageSize={6}&supplierName={7}", userId, accessToken, channel, platform, ver, pageIndex, pageSize, supplierName), LoggerType.Info);

            // 保存访问信息
            base.SaveVisitInfo(userId, channel, platform, ver);

            // 验证令牌
            int accessTookenCode = VerifyAccessToken(accessToken);

            if (accessTookenCode > 0)
            {
                return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), "Supplier.GetRecommendSupplier"));
            }

            Member member = GetMember(userId.ToSeesionId());

            int referUserId;

            if (member != null)
            {
                referUserId = member.UserId;
            }

            else
            {
                referUserId = 0;
            }
            List <SupplierListItem> items = new List <SupplierListItem>();


            SupplierQuery query = new SupplierQuery();

            query.UserId       = referUserId;
            query.SupplierName = supplierName;
            query.PageIndex    = pageIndex;
            query.PageSize     = pageSize;
            DbQueryResult dr = SupplierHelper.GetAppSupplier(query);

            DataTable dt = dr.Data as DataTable;

            if (dt != null)
            {
                SupplierListItem item = null;

                foreach (DataRow current in dt.Rows)
                {
                    item = new SupplierListItem();


                    if (current["SupplierId"] != DBNull.Value)
                    {
                        item.SupplierId = (int)current["SupplierId"];
                    }

                    if (current["ShopName"] != DBNull.Value)
                    {
                        item.SupplierName = (string)current["ShopName"];
                    }

                    if (current["ShopOwner"] != DBNull.Value)
                    {
                        item.ShopOwner = (string)current["ShopOwner"];
                    }

                    item.CreateDate = "";
                    if (current["CreateDate"] != DBNull.Value)
                    {
                        item.CreateDate = ((DateTime)current["CreateDate"]).ToString("yyyy-MM-dd HH:mm:ss");
                    }

                    if (current["County"] != DBNull.Value)
                    {
                        int countyId = (int)current["County"];
                        if (countyId > 0)
                        {
                            item.Location = RegionHelper.GetFullRegion(countyId, ",").Split(',')[0];
                        }
                    }

                    if (current["Logo"] != DBNull.Value)
                    {
                        item.Image = Util.AppendImageHost((string)current["Logo"]);
                    }

                    if (current["MobileImage"] != DBNull.Value)
                    {
                        item.Background = Util.AppendImageHost((string)current["MobileImage"]);
                    }


                    if (current["CollectCount"] != DBNull.Value)
                    {
                        item.CollectCount = (int)current["CollectCount"];
                    }

                    if (current["IsCollect"] != DBNull.Value)
                    {
                        item.IsCollect = (int)current["IsCollect"];
                    }

                    items.Add(item);
                }
            }

            ListResult <SupplierListItem> data = new ListResult <SupplierListItem>();

            data.TotalNumOfRecords = dr.TotalRecords;
            data.Results           = items;

            return(base.JsonActionResult(new StandardResult <ListResult <SupplierListItem> >()
            {
                code = 0,
                msg = "商家列表",
                data = data
            }));
        }