private bool LoadBHMatchBHData_Join(BangHuiMatchType type, int seasonID, List <BHMatchBHData> BHMatchBHDataList_Join, bool lastSeason = false) { bool result; if (null == BHMatchBHDataList_Join) { result = false; } else { BHMatchBHDataList_Join.Clear(); try { KuaFuData <BHMatchBHData> bhData = null; string strSql = string.Format("SELECT * FROM t_banghui_match_bh_season WHERE `type`={0} AND `season`={1}", (int)type, seasonID); if (type == BangHuiMatchType.BHMT_Begin) { strSql += string.Format(" ORDER BY `group` ASC", new object[0]); } MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false); while (sdr != null && sdr.Read()) { int bhid = Convert.ToInt32(sdr["bhid"]); if (type == BangHuiMatchType.BHMT_Begin && this.BHMatchBHDataDict_Gold.TryGetValue(bhid, out bhData)) { TimeUtil.AgeByNow(ref bhData.Age); if (!lastSeason) { bhData.V.cur_win = Convert.ToInt32(sdr["win"]); bhData.V.group = Convert.ToInt32(sdr["group"]); bhData.V.cur_score = 0; } BHMatchBHDataList_Join.Add(bhData.V); } if (type == BangHuiMatchType.Rookie && this.BHMatchBHDataDict_Rookie.TryGetValue(bhid, out bhData)) { TimeUtil.AgeByNow(ref bhData.Age); if (!lastSeason) { bhData.V.cur_win = Convert.ToInt32(sdr["win"]); bhData.V.group = 0; bhData.V.cur_score = Convert.ToInt32(sdr["score"]); } BHMatchBHDataList_Join.Add(bhData.V); } } if (sdr != null) { sdr.Close(); } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); return(false); } result = true; } return(result); }
private bool LoadBHMatchBHData_LastSeason(BangHuiMatchType type, int seasonID) { try { KuaFuData <BHMatchBHData> bhData = null; string strSql = string.Format("SELECT * FROM t_banghui_match_bh_season where `type`={0} and `season`={1}", (int)type, seasonID); MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false); while (sdr != null && sdr.Read()) { int bhid = Convert.ToInt32(sdr["bhid"]); if (type == BangHuiMatchType.BHMT_Begin && this.BHMatchBHDataDict_Gold.TryGetValue(bhid, out bhData)) { TimeUtil.AgeByNow(ref bhData.Age); bhData.V.last_win = Convert.ToInt32(sdr["win"]); bhData.V.last_score = 0; } if (type == BangHuiMatchType.Rookie && this.BHMatchBHDataDict_Rookie.TryGetValue(bhid, out bhData)) { TimeUtil.AgeByNow(ref bhData.Age); bhData.V.last_win = Convert.ToInt32(sdr["win"]); bhData.V.last_score = Convert.ToInt32(sdr["score"]); } } if (sdr != null) { sdr.Close(); } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); return(false); } return(true); }
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); }
private bool LoadBHMatchBHData(BangHuiMatchType type, Dictionary <int, KuaFuData <BHMatchBHData> > BHMatchBHDataDict) { bool result; if (null == BHMatchBHDataDict) { result = false; } else { BHMatchBHDataDict.Clear(); try { string strSql = string.Format("SELECT * FROM t_banghui_match_bh where `type`={0}", (int)type); MySqlDataReader sdr = DbHelperMySQL.ExecuteReader(strSql, false); while (sdr != null && sdr.Read()) { KuaFuData <BHMatchBHData> bhData = new KuaFuData <BHMatchBHData>(); bhData.V.type = (int)type; bhData.V.bhid = Convert.ToInt32(sdr["bhid"]); bhData.V.bhname = (sdr["bhname"] as string); bhData.V.zoneid_bh = Convert.ToInt32(sdr["zoneid_bh"]); bhData.V.rid = Convert.ToInt32(sdr["rid"]); bhData.V.rname = (sdr["rname"] as string); bhData.V.zoneid_r = Convert.ToInt32(sdr["zoneid_r"]); bhData.V.hist_play = Convert.ToInt32(sdr["play"]); bhData.V.hist_champion = Convert.ToInt32(sdr["champion"]); bhData.V.hist_bullshit = Convert.ToInt32(sdr["bullshit"]); bhData.V.best_record = Convert.ToInt32(sdr["bestrecord"]); string strGetWin = string.Format("select sum(win) totalwin from t_banghui_match_bh_season where `type`={0} and bhid={1}", (int)type, bhData.V.bhid); bhData.V.hist_win = Convert.ToInt32(DbHelperMySQL.GetSingle(strGetWin)); string strGetScore = string.Format("select sum(score) totalscore from t_banghui_match_bh_season where `type`={0} and bhid={1}", (int)type, bhData.V.bhid); bhData.V.hist_score = Convert.ToInt32(DbHelperMySQL.GetSingle(strGetScore)); bhData.V.hist_kill = Convert.ToInt32(sdr["kill"]); TimeUtil.AgeByNow(ref bhData.Age); BHMatchBHDataDict[bhData.V.bhid] = bhData; } if (sdr != null) { sdr.Close(); } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); return(false); } result = true; } return(result); }