public void Update(FreezeFunds freezeFund)
 {
     string sql = string.Format(@"UPDATE {0} SET {1}=@{1},{2}=@{2} WHERE {3}=@{3}",
         FreezeFunds.TABLENAME, FreezeFunds.AMOUNT, FreezeFunds.STATUS, FreezeFunds.FREEZEID);
     base.ExecuteNonQuery(sql, new SqlParameter(FreezeFunds.AMOUNT, freezeFund.Amount),
         new SqlParameter(FreezeFunds.STATUS, freezeFund.Status),
         new SqlParameter(FreezeFunds.FREEZEID, freezeFund.FreezeId));
 }
 public void Insert(FreezeFunds freezeFund)
 {
     string sql = string.Format(@"INSERT INTO {0} ({1},{2},{3}) VALUES (@{1},@{2},@{3}) SELECT SCOPE_IDENTITY()",
         FreezeFunds.TABLENAME, FreezeFunds.USERID, FreezeFunds.AMOUNT, FreezeFunds.STATUS);
     object id = base.ExecuteScalar(sql, new SqlParameter(FreezeFunds.USERID, freezeFund.UserId),
     new SqlParameter(FreezeFunds.AMOUNT, freezeFund.Amount),
     new SqlParameter(FreezeFunds.STATUS, (int)freezeFund.Status));
     freezeFund.FreezeId = Convert.ToInt32(id);
 }
 /// <summary>
 /// 添加用户冻结资金,如果存在则累加,否则新增
 /// </summary>
 /// <param name="user">The user.</param>
 /// <param name="amount">The amount.</param>
 private void AddFreezeFunds(User user, decimal amount)
 {
     var freezeFund = DaFreezeFunds.GetFreezeFundsByUser(user.UserId, BetStatus.Valid);
     if (freezeFund != null)
     {
         freezeFund.Amount += amount;
         DaFreezeFunds.Update(freezeFund);
     }
     else
     {
         freezeFund = new FreezeFunds
         {
             UserId = user.UserId,
             Amount = amount,
             Status = BetStatus.Valid
         };
         DaFreezeFunds.Insert(freezeFund);
     }
 }