void InitInfo() { if (Request.QueryString["GameServerId"] != null) { int serverId = TypeConverter.ToInt32(Request.QueryString["GameServerId"]); m_Server = Dictionaries.Instance.GetGameServerById(serverId); if (m_Server != null) { this.gameServerSiteValue.NavigateUrl = TypeConverter.ToString(m_Server[GameServerFields.Url]); this.gameServerSiteValue.Text = this.gameServerSiteValue.NavigateUrl; m_GS = GameServerStatistic.GetGameServerStatisticByGameServerid(serverId); bxPopBuyers.Visible = m_GS == null || m_GS.TopBuyers.Count > 0; bxPopSellers.Visible = m_GS == null || m_GS.TopSellers.Count > 0; DataBind(); return; } } err.Visible = true; info.Visible = false; err.Text = CommonResources.GameServerInfoUnavailable; }
static GameServerStatistic GetGSFromList(List<GameServerStatistic> list, int id) { GameServerStatistic gs = list.Where(p => p.m_GameServerId == id).FirstOrDefault(); if (gs == null) { gs = new GameServerStatistic(id); gs.m_SellingOffersCount = 0; gs.m_BuyingOffersCount = 0; gs.m_Money = 0; gs.m_SellingActiveCount = 0; list.Add(gs); } return gs; }
public static GameServerStatistic GetGameServerStatisticByGameServerid(int gameServerId) { GameServerStatistic gs = new GameServerStatistic(gameServerId); try { DataTable[] ds = Statistics.Instance.GameServers; foreach (DataTable t in ds) { DataRow[] rows = t.Select(String.Format("{0} = {1}", StatisticsFields.GameServerId, gameServerId)); foreach (DataRow row in rows) { gs.GetDataFromRow(row); } } } catch (Exception ex) { AssistLogger.Log<ExceptionHolder>(ex); throw ex; } return gs; }