Example #1
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("店铺列表");

            this.rptHotSupplierList = (VshopTemplatedRepeater)this.FindControl("rptHotSupplierList");
            this.rptRecSupplierList = (VshopTemplatedRepeater)this.FindControl("rptRecSupplierList");
            this.rpthistorysearch   = (VshopTemplatedRepeater)this.FindControl("rpthistorysearch");
            this.rptAllSupplierList = (VshopTemplatedRepeater)this.FindControl("rptAllSupplierList");

            int    referUserId;
            Member member = HiContext.Current.User as Member;

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

            //热卖
            DataTable hotdt = SupplierConfigHelper.GetConfigSupplier(ClientType.App, SupplierCfgType.Hot, referUserId);

            this.rptHotSupplierList.DataSource = hotdt;
            this.rptHotSupplierList.DataBind();
            //推荐
            DataTable recdt = SupplierConfigHelper.GetConfigSupplier(ClientType.App, SupplierCfgType.Recommend, referUserId);

            this.rptRecSupplierList.DataSource = recdt;
            this.rptRecSupplierList.DataBind();
            //所有
            DataTable recdtAll = SupplierConfigHelper.GetConfigSupplier(ClientType.App, 0, referUserId);

            if (recdtAll != null && recdtAll.Rows.Count > 0)
            {
                rptAllSupplierList.DataSource = recdtAll;
                rptAllSupplierList.DataBind();
            }

            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 #2
0
        private ListResult <SupplierListItem> GetRecommendSupplier(int userid)
        {
            List <SupplierListItem> items = new List <SupplierListItem>();



            DataTable dt = SupplierConfigHelper.GetConfigSupplier(ClientType.App, SupplierCfgType.Recommend, userid);

            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 = items.Count;;
            data.Results           = items;

            return(data);
        }
Example #3
0
        public IHttpActionResult GetRecommendSupplier(string userId, string accessToken, int channel, int platform, string ver)
        {
            Logger.WriterLogger("Supplier.GetRecommendSupplier, Params: " + string.Format("userId={0}&accessToken={1}&channel={2}&platform={3}&ver={4}", userId, accessToken, channel, platform, ver), 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>();



            DataTable dt = SupplierConfigHelper.GetConfigSupplier(ClientType.App, SupplierCfgType.Recommend, referUserId);

            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);
                }
            }

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