Exemplo n.º 1
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;
 }
Exemplo n.º 2
0
 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;
             }
         }
     }
 }