/// <summary> /// 写入一桌的金钱交易记录,每个人一条 /// </summary> protected void LogWriteToDB(tb_tablerecord tr) { BLL_Record bll = new BLL_Record(); BLL_MoneyLog money = new BLL_MoneyLog(); //var cacheSet = new ShareCacheStruct<tb_tablerecord>(); bll.Add(tr); //cacheSet.Add(tr); var cacheSetmoneylog = new ShareCacheStruct <tb_TableMoneyLog>(); try { ForeashAllDoBase((i) => { tb_TableMoneyLog _moneylogtemp = new tb_TableMoneyLog(); if (_pos2Money.ContainsKey(i)) { _moneylogtemp.AddorReduceMoney = _pos2Money[i]; } if (_pos2Win.ContainsKey(i)) { _moneylogtemp._win = _pos2Win[i]; } _moneylogtemp.gameid = _gameid; _moneylogtemp.MatchCode = tr.MatchCode; _moneylogtemp._guid = tr._guid; _moneylogtemp.TableRecordID = tr.id; if (_pos2UserID.ContainsKey(i)) { _moneylogtemp.UserID = _pos2UserID[i]; } if (_pos2IPPort.ContainsKey(i)) { _moneylogtemp._ipport = _pos2IPPort[i]; } _moneylogtemp._pos = i; if (_pos2CardList.ContainsKey(i)) { _moneylogtemp._cardList = _pos2CardList[i]; } _moneylogtemp._isover = tr._isover; if (_pos2BullRate.ContainsKey(i)) { _moneylogtemp._bullrate = _pos2BullRate[i]; } if (_pos2Watch.ContainsKey(i)) { _moneylogtemp._isWatch = _pos2Watch[i]; } var result = money.Add(_moneylogtemp); //直接写入数据库 待测 //cacheSetmoneylog.Add(_moneylogtemp); }); } catch (Exception ex) { } }
public bool Add(tb_TableMoneyLog model) { bool result = false; if (string.IsNullOrEmpty(model.id)) { model.id = Guid.NewGuid().ToString(); } var command = Provider.CreateCommandStruct("tb_TableMoneyLog", CommandMode.Insert); command.AddParameter("AddorReduceMoney", model.AddorReduceMoney); command.AddParameter("_win", model._win); command.AddParameter("gameid", model.gameid); command.AddParameter("MatchCode", model.MatchCode); command.AddParameter("_guid", model._guid); command.AddParameter("TableRecordID", model.TableRecordID); command.AddParameter("UserID", model.UserID); command.AddParameter("_ipport", model._ipport); string cardStr = string.Empty; if (model._cardList != null) { cardStr = "[" + string.Join(",", model._cardList) + "]"; } command.AddParameter("_cardList", cardStr); command.AddParameter("_isover", model._isover); command.AddParameter("_bullrate", model._bullrate); command.AddParameter("_isWatch", model._isWatch); command.AddParameter("CreateDate", DateTime.Now); command.AddParameter("id", model.id); command.AddParameter("_pos", model._pos); try { command.Parser(); result = Provider.ExecuteQuery(CommandType.Text, command.Sql, command.Parameters) > 0; } catch (Exception ex) { result = false; } return(result); }