Пример #1
0
 public void FastConsume(string idorm, int uid, float money)
 {
     MemCards member = db.MemCards.Where(m => m.MC_CardID == idorm || m.MC_Mobile == idorm).ToList().FirstOrDefault();
     member.MC_Point += (int)(money / member.CardLevels.CL_Point);
     member.MC_TotalMoney += (float)(Math.Round((float)(member.CardLevels.CL_Percent * money), 2));
     member.MC_TotalCount++;
     ConsumeOrders order = new ConsumeOrders()
     {
         S_ID = member.S_ID,
         U_ID = uid,
         CO_OrderCode = GetOrderCode(),
         CO_OrderType = 5,
         MC_ID = member.MC_ID,
         MC_CardID = member.MC_CardID,
         EG_ID = 0,
         CO_TotalMoney = money,
         CO_DiscountMoney = (float)(Math.Round((float)(member.CardLevels.CL_Percent * money), 2)),
         CO_GavePoint = (int)(money / member.CardLevels.CL_Point),
         CO_Recash = 0,
         CO_Remark = string.Empty,
         CO_CreateTime = DateTime.Now
     };
     using (TransactionScope ts = new TransactionScope())
     {
         db.ConsumeOrders.AddObject(order);
         db.SaveChanges();
         ts.Complete();
     }
 }
Пример #2
0
 /// <summary>
 /// 创建新的 ConsumeOrders 对象。
 /// </summary>
 /// <param name="cO_ID">CO_ID 属性的初始值。</param>
 public static ConsumeOrders CreateConsumeOrders(global::System.Int32 cO_ID)
 {
     ConsumeOrders consumeOrders = new ConsumeOrders();
     consumeOrders.CO_ID = cO_ID;
     return consumeOrders;
 }
Пример #3
0
 /// <summary>
 /// 用于向 ConsumeOrders EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToConsumeOrders(ConsumeOrders consumeOrders)
 {
     base.AddObject("ConsumeOrders", consumeOrders);
 }
Пример #4
0
 public void SubstracPoint(string idorm, int uid, int point, string remark)
 {
     MemCards member = db.MemCards.Where(m => m.MC_CardID == idorm || m.MC_Mobile == idorm).ToList().FirstOrDefault();
     member.MC_Point -= point;
     ConsumeOrders order = new ConsumeOrders()
     {
         S_ID = member.S_ID,
         U_ID = uid,
         CO_OrderCode = GetOrderCode(),
         CO_OrderType = 3,
         MC_ID = member.MC_ID,
         MC_CardID = member.MC_CardID,
         EG_ID = 0,
         CO_TotalMoney = 0,
         CO_DiscountMoney = 0,
         CO_GavePoint = point,
         CO_Recash = 0,
         CO_Remark = remark,
         CO_CreateTime = DateTime.Now
     };
     using (TransactionScope ts = new TransactionScope())
     {
         db.ConsumeOrders.AddObject(order);
         db.SaveChanges();
         ts.Complete();
     }
 }