コード例 #1
0
        public ActionResult Cashback(int id)
        {
            string cardId = Request.Form["CardId"];
            string recash = Request.Form["Recash"];
            string point = Request.Form["Point"];
            string gavePoint = Request.Form["GavePoint"];
            try
            {
                ConsumeOrders cos = new ConsumeOrders();
                MemCardsBLL mcll = new MemCardsBLL();
                ConsumeOrdersBLL coll = new ConsumeOrdersBLL();
                cos.CO_GavePoint = Convert.ToInt32(gavePoint);
                cos.CO_Recash = (float)Convert.ToDouble(recash);
                cos.MC_CardID = cardId;
                MemCards mc = mcll.SelectWhere(m => m.MC_CardID == cardId).FirstOrDefault();

                using (TransactionScope ts = new TransactionScope())
                {
                    //添加消费记录
                    coll.Add(cos);
                    coll.SaveChanges();
                    //更新用户卡信息
                    mc.MC_Point = Convert.ToInt32(point);
                    mcll.SaveChanges();
                    ts.Complete();
                }
                return Json(new { result = "ok", data = point });
            }
            catch
            {
                return Json(new { result = "error", data = "系统异常,兑换失败!" });
            }
        }
コード例 #2
0
ファイル: MPMS.Designer.cs プロジェクト: JoiWilliam/OAProject
 /// <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;
 }