コード例 #1
0
ファイル: PointDetailDao.cs プロジェクト: ZhangVic/asp1110git
 public bool AddPointDetail(PointDetailInfo point)
 {
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO Hishop_PointDetails (OrderId,UserId, TradeDate, TradeType, Increased, Reduced, Points, Remark)VALUES(@OrderId,@UserId, @TradeDate, @TradeType, @Increased, @Reduced, @Points, @Remark)");
     this.database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, point.OrderId);
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, point.UserId);
     this.database.AddInParameter(sqlStringCommand, "TradeDate", DbType.DateTime, point.TradeDate);
     this.database.AddInParameter(sqlStringCommand, "TradeType", DbType.Int32, (int) point.TradeType);
     this.database.AddInParameter(sqlStringCommand, "Increased", DbType.Int32, point.Increased.HasValue ? point.Increased.Value : 0);
     this.database.AddInParameter(sqlStringCommand, "Reduced", DbType.Int32, point.Reduced.HasValue ? point.Reduced.Value : 0);
     this.database.AddInParameter(sqlStringCommand, "Points", DbType.Int32, point.Points);
     this.database.AddInParameter(sqlStringCommand, "Remark", DbType.String, point.Remark);
     return (this.database.ExecuteNonQuery(sqlStringCommand) > 0);
 }
コード例 #2
0
ファイル: OrderHelper.cs プロジェクト: ZhangVic/asp1110git
 private static void UpdateUserAccount(OrderInfo order)
 {
     MemberInfo member = new MemberDao().GetMember(order.UserId);
     if (member != null)
     {
         MemberDao dao = new MemberDao();
         PointDetailInfo point = new PointDetailInfo {
             OrderId = order.OrderId,
             UserId = member.UserId,
             TradeDate = DateTime.Now,
             TradeType = PointTradeType.Bounty,
             Increased = new int?(order.Points),
             Points = order.Points + member.Points
         };
         if ((point.Points > 0x7fffffff) || (point.Points < 0))
         {
             point.Points = 0x7fffffff;
         }
         PointDetailDao dao2 = new PointDetailDao();
         dao2.AddPointDetail(point);
         member.Expenditure += order.GetTotal();
         member.OrderNumber++;
         dao.Update(member);
         int historyPoint = dao2.GetHistoryPoint(member.UserId);
         List<MemberGradeInfo> memberGrades = new MemberGradeDao().GetMemberGrades() as List<MemberGradeInfo>;
         foreach (MemberGradeInfo info3 in from item in memberGrades
             orderby item.Points descending
             select item)
         {
             if (member.GradeId == info3.GradeId)
             {
                 break;
             }
             if (info3.Points <= historyPoint)
             {
                 member.GradeId = info3.GradeId;
                 dao.Update(member);
                 break;
             }
         }
     }
 }
コード例 #3
0
 public static bool UserPayOrder(OrderInfo order)
 {
     OrderDao dao = new OrderDao();
     order.OrderStatus = OrderStatus.BuyerAlreadyPaid;
     order.PayDate = new DateTime?(DateTime.Now);
     bool flag = dao.UpdateOrder(order, null);
     if (flag)
     {
         dao.UpdatePayOrderStock(order.OrderId);
         foreach (LineItemInfo info in order.LineItems.Values)
         {
             ProductDao dao2 = new ProductDao();
             ProductInfo productDetails = dao2.GetProductDetails(info.ProductId);
             productDetails.SaleCounts += info.Quantity;
             productDetails.ShowSaleCounts += info.Quantity;
             dao2.UpdateProduct(productDetails, null);
         }
         MemberInfo member = GetMember(order.UserId);
         if (member == null)
         {
             return flag;
         }
         MemberDao dao3 = new MemberDao();
         PointDetailInfo point = new PointDetailInfo {
             OrderId = order.OrderId,
             UserId = member.UserId,
             TradeDate = DateTime.Now,
             TradeType = PointTradeType.Bounty,
             Increased = new int?(order.Points),
             Points = order.Points + member.Points
         };
         if ((point.Points > 0x7fffffff) || (point.Points < 0))
         {
             point.Points = 0x7fffffff;
         }
         PointDetailDao dao4 = new PointDetailDao();
         dao4.AddPointDetail(point);
         member.Expenditure += order.GetTotal();
         member.OrderNumber++;
         dao3.Update(member);
         Messenger.OrderPayment(member, order.OrderId, order.GetTotal());
         int historyPoint = dao4.GetHistoryPoint(member.UserId);
         List<MemberGradeInfo> memberGrades = new MemberGradeDao().GetMemberGrades() as List<MemberGradeInfo>;
         foreach (MemberGradeInfo info5 in from item in memberGrades
             orderby item.Points descending
             select item)
         {
             if (member.GradeId == info5.GradeId)
             {
                 return flag;
             }
             if (info5.Points <= historyPoint)
             {
                 member.GradeId = info5.GradeId;
                 dao3.Update(member);
                 return flag;
             }
         }
     }
     return flag;
 }
コード例 #4
0
ファイル: OrderHelper.cs プロジェクト: ZhangVic/asp1110git
        private static void ReducedPoint(OrderInfo order, MemberInfo member)
        {
            PointDetailInfo info = new PointDetailInfo();
              info.OrderId = order.OrderId;
                info.UserId = member.UserId;
                info.TradeDate = DateTime.Now;
                info.TradeType = PointTradeType.Refund;
                info.Reduced = new int?(order.Points);
                info.Points = member.Points - info.Reduced.Value;

            //info = new PointDetailInfo {
            //    OrderId = order.OrderId,
            //    UserId = member.UserId,
            //    TradeDate = DateTime.Now,
            //    TradeType = PointTradeType.Refund,
            //    Reduced = new int?(order.Points),
            //    Points = member.Points - info.Reduced.Value
            //};
            new PointDetailDao().AddPointDetail(info);
        }