Example #1
0
        /// <summary>
        /// 获取指定用户的商品交易统计信息
        /// </summary>
        /// <param name="userid">用户id</param>
        /// <returns>商品交易统计信息</returns>
        public static Goosdstradestatisticinfo GetTradeStatistic(int userId)
        {
            Goosdstradestatisticinfo goodstradestatistic = null;
            IDataReader iDataReader = DbProvider.GetInstance().GetTradeStatistic(userId);

            //绑定新的查询数据
            if (iDataReader.Read())
            {
                goodstradestatistic = new Goosdstradestatisticinfo();
                goodstradestatistic.Userid = userId;
                goodstradestatistic.Sellerattention = TypeConverter.ObjectToInt(iDataReader["SellerAttention"]);
                goodstradestatistic.Sellertrading = TypeConverter.ObjectToInt(iDataReader["SellerTrading"]);
                goodstradestatistic.Sellerrate = TypeConverter.ObjectToInt(iDataReader["SellerRate"]);
                goodstradestatistic.Sellnumbersum = Convert.ToDecimal(iDataReader["SellNumberSum"].ToString());
                goodstradestatistic.Selltradesum = Convert.ToDecimal(iDataReader["SellTradeSum"].ToString());
                goodstradestatistic.Buyerattention = TypeConverter.ObjectToInt(iDataReader["BuyerAttention"]);
                goodstradestatistic.Buyertrading = TypeConverter.ObjectToInt(iDataReader["BuyerTrading"]);
                goodstradestatistic.Buyerrate = TypeConverter.ObjectToInt(iDataReader["BuyerRate"]);
                goodstradestatistic.Buynumbersum = Convert.ToDecimal(iDataReader["BuyNumberSum"].ToString());
                goodstradestatistic.Buytradesum = Convert.ToDecimal(iDataReader["BuyTradeSum"].ToString());
            }
            iDataReader.Close();
            return goodstradestatistic;
        }
Example #2
0
        protected override void ShowPage()
        {
            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }
            if (config.Enablemall == 0) //未启用交易服务
            {
                AddErrLine("系统未开启交易服务, 当前页面暂时无法访问!");
                return;
            }

            user = Users.GetUserInfo(userid);

            if (item == "")
                item = "tradestats";


            //当显示交易日志(不是出售中商品)
            if ((item == "selltrade" && filter != "onsell" && filter != "allgoods") || item == "buytrade")
                istradeloglist = true;

            //当为评价,交易成功或退款时,则显示评价字段信息
            if (filter == "eccredit" || filter == "success" || filter == "refund")
                isshowrate = true;


            //获取当前用户的商品数
            if (filter == "allgoods" || filter == "onsell" || item == "tradestats") 
                reccount = (filter == "allgoods") ? Goods.GetGoodsCountBySellerUid(userid, true) : Goods.GetGoodsCountBySellerUid(userid, false);
            else
            {   //获取当前用户做为卖家的交易数
                if (item == "selltrade")
                    reccount = TradeLogs.GetGoodsTradeLogCount(userid, goodsidlist, 1, filter);
                else //获取当前用户做为买家的交易数
                    reccount = TradeLogs.GetGoodsTradeLogCount(userid, goodsidlist, 2, filter);
            }

            if (item == "tradestats")
            {
                tradestatisticinfo = TradeLogs.GetTradeStatistic(user.Uid);
                return;
            }

            // 得到分页大小设置
            int pagesize = 10;
            //修正请求页数中可能的错误
            if (pageid < 1)
                pageid = 1;

            //获取总页数
            pagecount = reccount % pagesize == 0 ? reccount / pagesize : reccount / pagesize + 1;
            if (pagecount == 0)
                pagecount = 1;

            if (pageid > pagecount)
                pageid = pagecount;

              //如果不是提交...
            if (!ispost)
            {
                if (item == "selltrade" && (filter == "allgoods" || filter == "onsell"))
                {
                    if (filter == "allgoods")
                        goodslist = Goods.GetGoodsListBySellerUID(userid, true, pagesize, pageid, "lastupdate", 1);
                    else
                        goodslist = Goods.GetGoodsListBySellerUID(userid, false, pagesize, pageid, "lastupdate", 1);

                    pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "usercpmygoods.aspx?item=" + item + "&filter=" + filter , 8);
                }
                else
                {
                    if (item == "selltrade")
                        goodstradeloglist = TradeLogs.GetGoodsTradeLogList(userid, goodsidlist, 1, filter, pagesize, pageid);
                    else
                        goodstradeloglist = TradeLogs.GetGoodsTradeLogList(userid, goodsidlist, 2, filter, pagesize, pageid);

                    pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "usercpmygoods.aspx?item=" + item + "&filter=" + filter, 8);
                }
            }
            else
            {
                string operation = DNTRequest.GetString("operation");

                if (operation == "")
                    operation = "deletegoods";

                if (operation == "deletegoods")
                {
                    if (goodsidlist == "")
                    {
                        AddErrLine("你未选中任何商品");
                        return;
                    }

                    if (Goods.IsSeller(goodsidlist, userid))
                    {
                        Goods.DeleteGoods(goodsidlist, false);

                        SetUrl("usercpmygoods.aspx?item=" + item + "&filter=" + filter);
                        SetMetaRefresh();
                        AddMsgLine("操作成功. <br />(<a href=\"usercpmygoods.aspx?item=" + item + "&filter=" + filter + "\">点击这里返回</a>)<br />");
                    }
                    else
                    {
                        AddErrLine("你不是当前商品的卖家,因此无法删除该商品");
                        return;
                    }
                }
            }
        }