Ejemplo n.º 1
0
        /// <summary>
        /// 分页获取浏览商品记录
        /// </summary>
        /// <param name="par"></param>
        public List <BTP.Deploy.CustomDTO.CommodityListCDTO> GetBrowseCommdity(BrowseParameter par)
        {
            //定义返回值
            List <BTP.Deploy.CustomDTO.CommodityListCDTO> result;

            try
            {
                //调用代理方法
                result = base.Channel.GetBrowseCommdity(par);
            }
            catch
            {
                //抛异常
                throw;
            }
            finally
            {
                //关链接
                ChannelClose();
            }            //返回结果
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 分页获取浏览商品记录
        /// </summary>
        /// <param name="par"></param>
        public List <BTP.Deploy.CustomDTO.CommodityListCDTO> GetBrowseCommdityExt(BrowseParameter par)
        {
            try
            {
                string         sql = @"SELECT CommodityId 
                               FROM (
	                                select CommodityId,ROW_NUMBER() OVER(ORDER BY CommodityId desc) AS numb     
		                                from 
			                                (select distinct(CommodityId)
			                                 from UserBrowseList  
                                             where appid='" + par.appId + "' and UserId='" + par.userId + @"' 
                                             ) as y 
                                    ) 
                                    as [browse] 
                               WHERE [browse].numb > ((@pageindex)-1)*(@pagesize) AND [browse].numb<=(@pageindex)*(@pagesize)";
                SqlParameter[] pms = new SqlParameter[]
                {
                    new SqlParameter("@pageindex", SqlDbType.Int)
                    {
                        Value = par.PageIndex
                    },
                    new SqlParameter("@pagesize", SqlDbType.Int)
                    {
                        Value = par.PageSize
                    }
                };
                DataTable UserBrowseList = Jinher.AMP.BTP.Common.SQLHelper.ExecuteDataset(SQLHelper.UserBrowse, CommandType.Text, sql, pms).Tables[0];
                LogHelper.Info(string.Format("获取浏览记录个数:{0}", UserBrowseList.Rows.Count));
                List <Guid> ids = (from DataRow item in UserBrowseList.Rows select Guid.Parse(item["CommodityId"].ToString())).ToList();
                LogHelper.Info(string.Format("获取浏览记录ID个数:{0}", ids.Count));
                var commodityList = (from c in Commodity.ObjectSet()
                                     where ids.Contains(c.Id)
                                     orderby c.State, c.SubTime descending
                                     select new Jinher.AMP.BTP.Deploy.CustomDTO.CommodityListCDTO
                {
                    Id = c.Id,
                    Pic = c.PicturesPath,
                    Price = c.Price,
                    RealPrice = c.Price,
                    Intensity = 10,
                    DiscountPrice = -1,
                    State = c.State,
                    Stock = c.Stock,
                    Name = c.Name,
                    AppId = c.AppId,
                    MarketPrice = c.MarketPrice,
                    IsEnableSelfTake = c.IsEnableSelfTake,
                    ComAttribute = c.ComAttribute,
                    ComAttrType = (c.ComAttribute == "[]" || c.ComAttribute == null) ? 1 : 3
                }).ToList();

                //Jinher.AMP.BTP.ISV.Facade.CommodityFacade facade = new Jinher.AMP.BTP.ISV.Facade.CommodityFacade();
                //List<BTP.Deploy.CustomDTO.CommodityListCDTO> BTPComdty = facade.GetCommodityByIdsWithPreSell(ids, true);
                //LogHelper.Info(string.Format("获取浏览记录调用接口后个数:{0}", BTPComdty.Count));
                return(commodityList);
            }
            catch (Exception ex)
            {
                LogHelper.Error(string.Format("AppSetSV.GetBrowseCommdityExt异常:userId:{0},appId:{1}", par.userId, par.appId), ex);
                throw;
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 分页获取浏览商品记录
 /// </summary>
 /// <param name="par"></param>
 public List <BTP.Deploy.CustomDTO.CommodityListCDTO> GetBrowseCommdity(BrowseParameter par)
 {
     base.Do();
     return(this.Command.GetBrowseCommdity(par));
 }