private bool LoadBHMatchPKInfoList(BangHuiMatchType type, KuaFuData <List <BangHuiMatchPKInfo> > BHMatchPKInfoList_Gold) { bool result; if (null == BHMatchPKInfoList_Gold) { result = false; } else { BHMatchPKInfoList_Gold.V.Clear(); try { KuaFuData <BHMatchBHData> bhData = null; string strSql = string.Format("SELECT * FROM t_banghui_match_pk_log WHERE `type`={0} ORDER BY `season` DESC, `round` DESC LIMIT {1}", (int)type, 80); MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false); while (sdr != null && sdr.Read()) { BangHuiMatchPKInfo pkInfo = new BangHuiMatchPKInfo(); pkInfo.type = Convert.ToByte(sdr["type"]); pkInfo.season = Convert.ToInt32(sdr["season"]); pkInfo.round = Convert.ToByte(sdr["round"]); pkInfo.bhid1 = Convert.ToInt32(sdr["bhid1"]); pkInfo.bhid2 = Convert.ToInt32(sdr["bhid2"]); pkInfo.result = Convert.ToByte(sdr["result"]); pkInfo.zoneid1 = Convert.ToInt32(sdr["zoneid1"]); pkInfo.zoneid2 = Convert.ToInt32(sdr["zoneid2"]); if (this.BHMatchBHDataDict_Gold.TryGetValue(pkInfo.bhid1, out bhData)) { pkInfo.bhname1 = KuaFuServerManager.FormatName(bhData.V.zoneid_bh, bhData.V.bhname); } if (this.BHMatchBHDataDict_Gold.TryGetValue(pkInfo.bhid2, out bhData)) { pkInfo.bhname2 = KuaFuServerManager.FormatName(bhData.V.zoneid_bh, bhData.V.bhname); } BHMatchPKInfoList_Gold.V.Add(pkInfo); } TimeUtil.AgeByNow(ref BHMatchPKInfoList_Gold.Age); if (sdr != null) { sdr.Close(); } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); return(false); } result = true; } return(result); }
public void SaveBHMatchPKInfo(BangHuiMatchPKInfo pkinfo) { string sql = string.Format("INSERT INTO t_banghui_match_pk_log(`type`, season, round, bhid1, zoneid1, bhid2, zoneid2, result, logtime) VALUES({0},{1},{2},{3},{4},{5},{6},{7},'{8}') ON DUPLICATE KEY UPDATE result={7};", new object[] { pkinfo.type, pkinfo.season, pkinfo.round, pkinfo.bhid1, pkinfo.zoneid1, pkinfo.bhid2, pkinfo.zoneid2, pkinfo.result, TimeUtil.NowDataTimeString("yyyy-MM-dd HH:mm:ss") }); this.ExecuteSqlNoQuery(sql); }