Example #1
0
        /// <summary>
        /// 获取供货商收藏列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public DbQueryResult GetSupplierCollect(SupplierCollectQuery query)
        {
            string strtable = "(select S.*, C.Id,C.UserId,(select count(C1.Id) from  Ecshop_SupplierCollect C1 where C1.SupplierId=C.SupplierId) as CollectCount from Ecshop_SupplierCollect C inner join  Ecshop_Supplier S on S.SupplierId=C.SupplierId) as SupplierCollectTable ";

            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat(" UserId = {0}", query.UserId);
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, strtable, "Id", stringBuilder.ToString(), "*"));
        }
Example #2
0
        protected override void AttachChildControls()
        {
            string url = this.Page.Request.QueryString["returnUrl"];

            if (!string.IsNullOrWhiteSpace(this.Page.Request.QueryString["returnUrl"]))
            {
                this.Page.Response.Redirect(url);
            }
            Member member = HiContext.Current.User as Member;

            if (member == null)
            {
                this.Page.Response.Redirect("/Vshop/Login.aspx");
            }

            this.rptSupplier     = (VshopTemplatedRepeater)this.FindControl("rptSupplier");
            this.litProFavCount  = (System.Web.UI.WebControls.Literal) this.FindControl("litProFavCount");
            this.litSuppFavCount = (System.Web.UI.WebControls.Literal) this.FindControl("litSuppFavCount");
            this.txtTotal        = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtTotal");

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


            SupplierCollectQuery query = new SupplierCollectQuery();

            query.UserId    = member.UserId;
            query.PageIndex = pageIndex;
            query.PageSize  = pageSize;

            DbQueryResult dbResult = SupplierHelper.GetSupplierCollect(query);

            this.rptSupplier.DataSource = dbResult.Data;
            this.rptSupplier.DataBind();

            this.litProFavCount.Text  = ProductBrowser.GetUserFavoriteCount(member.UserId).ToString();
            this.litSuppFavCount.Text = dbResult.TotalRecords.ToString();
            this.txtTotal.SetWhenIsNotNull(dbResult.TotalRecords.ToString());

            PageTitle.AddSiteNameTitle("我的收藏");
        }
Example #3
0
        public IHttpActionResult MySupplierCollect(string userId, string accessToken, int channel, int platform, string ver, int pageIndex, int pageSize)
        {
            Logger.WriterLogger("Supplier.MySupplierCollect, Params: " + string.Format("userId={0}&accessToken={1}&channel={2}&platform={3}&ver={4}&pageIndex={5}&pageSize={6}", userId, accessToken, channel, platform, ver, pageIndex, pageSize), LoggerType.Info);

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

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

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

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

            if (member != null)
            {
                List <SupplierCollectItem> items = new List <SupplierCollectItem>();

                SupplierCollectQuery query = new SupplierCollectQuery();
                query.UserId    = member.UserId;
                query.PageIndex = pageIndex;
                query.PageSize  = pageSize;

                DbQueryResult dbResult = SupplierHelper.GetSupplierCollect(query);

                DataTable dt = dbResult.Data as DataTable;

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

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


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

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

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

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

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

                        if (current["County"] != DBNull.Value)
                        {
                            int countyId = (int)current["County"];
                            if (countyId > 0)
                            {
                                item.Province = RegionHelper.GetFullRegion(countyId, ",").Split(',')[0];
                            }
                        }
                        if (current["Logo"] != DBNull.Value)
                        {
                            item.Logo = 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"];
                        }

                        items.Add(item);
                    }
                }


                SupplierCollectResult data = new SupplierCollectResult();
                data.SupplierCollectCount = dbResult.TotalRecords;
                data.ProductCollectCount  = ProductBrowser.GetUserFavoriteCount(member.UserId);
                data.Results = items;

                return(base.JsonActionResult(new StandardResult <SupplierCollectResult>()
                {
                    code = 0,
                    msg = "店铺收藏列表",
                    data = data
                }));
            }


            else
            {
                return(base.JsonFaultResult(new CommonException(40201).GetMessage(), "Supplier.MySupplierCollect"));
            }
        }
Example #4
0
 /// <summary>
 /// 获取供货商收藏列表
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public static DbQueryResult GetSupplierCollect(SupplierCollectQuery query)
 {
     return(new SupplierDao().GetSupplierCollect(query));
 }