/// <summary>
 /// 创建新的 TransferLogs 对象。
 /// </summary>
 /// <param name="tL_ID">TL_ID 属性的初始值。</param>
 public static TransferLogs CreateTransferLogs(global::System.Int32 tL_ID)
 {
     TransferLogs transferLogs = new TransferLogs();
     transferLogs.TL_ID = tL_ID;
     return transferLogs;
 }
        public ActionResult Transfer(string TL_FromMC_CardID, string TL_ToMC_CardID, int TL_TransferMoney, string TL_Remark)
        {
            MemCardsBLL mcBll = new MemCardsBLL();
            TransferLogsBLL tfBll = new TransferLogsBLL();
            TransferLogs tf = new TransferLogs();
            MemCards mcTo = new MemCards();
            MemCards mcFrom = new MemCards();
            try
            {
                MemCards uTo = mcBll.GetExchange(TL_ToMC_CardID);
                MemCards uFrom = mcBll.GetExchange(TL_FromMC_CardID);
                Users user = Session["user"] as Users;

                using (TransactionScope ts = new TransactionScope())
                {
                    //修改转出卡号信息
                    mcTo.MC_ID = uFrom.MC_ID;
                    mcTo.MC_Point = uFrom.MC_Point - TL_TransferMoney;

                    //修改转入卡号信息
                    mcFrom.MC_ID = uTo.MC_ID;
                    mcFrom.MC_Point = uTo.MC_Point + TL_TransferMoney;

                    mcBll.Edit(mcFrom, "MC_Point");
                    mcBll.Edit(mcTo, "MC_Point");
                    mcBll.SaveChanges();

                    //转账信息表添加数据
                    tf.S_ID = user.S_ID;
                    tf.U_ID = user.U_ID;
                    tf.TL_FromMC_ID = mcBll.SelectWhere(m => m.MC_CardID == TL_FromMC_CardID).Select(m => m.MC_ID).FirstOrDefault();
                    tf.TL_FromMC_CardID = TL_FromMC_CardID;
                    tf.TL_ToMC_ID = mcBll.SelectWhere(m => m.MC_CardID == TL_ToMC_CardID).Select(m => m.MC_ID).FirstOrDefault();
                    tf.TL_ToMC_CardID = TL_ToMC_CardID;
                    tf.TL_TransferMoney = TL_TransferMoney;
                    tf.TL_Remark = TL_Remark;
                    tf.TL_CreateTime = DateTime.Now;
                    tfBll.Add(tf);
                    tfBll.SaveChanges();
                    ts.Complete();
                }
                return Json(new { result = "ok" });
            }
            catch
            {
                return Json(new { result = "error" });
            }
        }