Ejemplo n.º 1
0
 /// <summary>
 /// 从IDataReader创建OrderProductInfo
 /// </summary>
 public static OrderProductInfo BuildOrderProductFromReader(IDataReader reader)
 {
     OrderProductInfo orderProductInfo = new OrderProductInfo();
     orderProductInfo.RecordId = TypeHelper.ObjectToInt(reader["recordid"]);
     orderProductInfo.Oid = TypeHelper.ObjectToInt(reader["oid"]);
     orderProductInfo.Uid = TypeHelper.ObjectToInt(reader["uid"]);
     orderProductInfo.Sid = reader["sid"].ToString();
     orderProductInfo.Pid = TypeHelper.ObjectToInt(reader["pid"]);
     orderProductInfo.PSN = reader["psn"].ToString();
     orderProductInfo.CateId = TypeHelper.ObjectToInt(reader["cateid"]);
     orderProductInfo.BrandId = TypeHelper.ObjectToInt(reader["brandid"]);
     orderProductInfo.Name = reader["name"].ToString();
     orderProductInfo.ShowImg = reader["showimg"].ToString();
     orderProductInfo.DiscountPrice = TypeHelper.ObjectToDecimal(reader["discountprice"]);
     orderProductInfo.ShopPrice = TypeHelper.ObjectToDecimal(reader["shopprice"]);
     orderProductInfo.CostPrice = TypeHelper.ObjectToDecimal(reader["costprice"]);
     orderProductInfo.MarketPrice = TypeHelper.ObjectToDecimal(reader["marketprice"]);
     orderProductInfo.Weight = TypeHelper.ObjectToInt(reader["weight"]);
     orderProductInfo.IsReview = TypeHelper.ObjectToInt(reader["isreview"]);
     orderProductInfo.RealCount = TypeHelper.ObjectToInt(reader["realcount"]);
     orderProductInfo.BuyCount = TypeHelper.ObjectToInt(reader["buycount"]);
     orderProductInfo.SendCount = TypeHelper.ObjectToInt(reader["sendcount"]);
     orderProductInfo.Type = TypeHelper.ObjectToInt(reader["type"]);
     orderProductInfo.PayCredits = TypeHelper.ObjectToInt(reader["paycredits"]);
     orderProductInfo.CouponTypeId = TypeHelper.ObjectToInt(reader["coupontypeid"]);
     orderProductInfo.ExtCode1 = TypeHelper.ObjectToInt(reader["extcode1"]);
     orderProductInfo.ExtCode2 = TypeHelper.ObjectToInt(reader["extcode2"]);
     orderProductInfo.ExtCode3 = TypeHelper.ObjectToInt(reader["extcode3"]);
     orderProductInfo.ExtCode4 = TypeHelper.ObjectToInt(reader["extcode4"]);
     orderProductInfo.ExtCode5 = TypeHelper.ObjectToInt(reader["extcode5"]);
     orderProductInfo.AddTime = TypeHelper.ObjectToDateTime(reader["addtime"]);
     return orderProductInfo;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 发放评价商品积分
        /// </summary>
        /// <param name="partUserInfo">用户信息</param>
        /// <param name="orderProductInfo">订单商品</param>
        /// <param name="reviewTime">评价时间</param>
        public static int SendReviewProductCredits(ref PartUserInfo partUserInfo, OrderProductInfo orderProductInfo, DateTime reviewTime)
        {
            if (_creditconfiginfo.ReviewProductPayCredits > 0 || _creditconfiginfo.ReviewProductRankCredits > 0)
            {
                int surplusPayCredits = GetDaySurplusPayCredits(partUserInfo.Uid, reviewTime.Date);
                int surplusRankCredits = GetDaySurplusRankCredits(partUserInfo.Uid, reviewTime.Date);
                if (surplusPayCredits == 0 && surplusRankCredits == 0)
                    return 0;

                int payCredits = 0;
                int rankCredits = 0;
                if (surplusPayCredits > 0)
                    payCredits = surplusPayCredits < _creditconfiginfo.ReviewProductPayCredits ? surplusPayCredits : _creditconfiginfo.ReviewProductPayCredits;
                else if (surplusPayCredits == -1)
                    payCredits = _creditconfiginfo.ReviewProductPayCredits;
                if (surplusRankCredits > 0)
                    rankCredits = surplusRankCredits < _creditconfiginfo.ReviewProductRankCredits ? surplusRankCredits : _creditconfiginfo.ReviewProductRankCredits;
                else if (surplusRankCredits == -1)
                    rankCredits = _creditconfiginfo.ReviewProductRankCredits;

                partUserInfo.PayCredits += payCredits;
                partUserInfo.RankCredits += rankCredits;

                int userRid = UserRanks.GetUserRankByCredits(partUserInfo.RankCredits).UserRid;
                if (userRid != partUserInfo.UserRid)
                    partUserInfo.UserRid = userRid;
                else
                    userRid = 0;

                CreditLogInfo creditLogInfo = new CreditLogInfo();
                creditLogInfo.Uid = partUserInfo.Uid;
                creditLogInfo.PayCredits = payCredits;
                creditLogInfo.RankCredits = rankCredits;
                creditLogInfo.Action = (int)CreditAction.ReviewProduct;
                creditLogInfo.ActionCode = orderProductInfo.Oid;
                creditLogInfo.ActionTime = reviewTime;
                creditLogInfo.ActionDes = "评价商品:" + orderProductInfo.Name;
                creditLogInfo.Operator = 0;

                SendCredits(userRid, creditLogInfo);

                return payCredits;
            }
            return 0;
        }