Inheritance: BF2PageModel
        private void ShowIndex()
        {
            // Check the cache file
            if (!base.CacheFileExpired("rankings_index", 30))
            {
                base.SendCachedResponse("rankings_index");
                return;
            }

            // Create our model
            RankingsModel Model = new RankingsModel(Client);

            // NOTE: The HttpServer will handle the DbConnectException
            using (StatsDatabase Database = new StatsDatabase())
            {
                // Loop through and add each index catagories, and its players
                for (int i = 0; i < IndexCatagories.Count; i++)
                {
                    Model.Stats.Add(new RankingStats
                    {
                        Name = IndexCatagories[i].Key,
                        Desc = IndexCatagories[i].Value,
                        UrlName = ActionNames[i],
                        TopPlayers = GetTopFromQuery(i, Database)
                    });
                }
            }

            // Send response
            base.SendTemplateResponse("rankings_index", typeof(RankingsModel), Model, "Rankings");
        }
Exemplo n.º 2
0
        private void ShowIndex()
        {
            // Check the cache file
            if (!base.CacheFileExpired("rankings_index", 30))
            {
                base.SendCachedResponse("rankings_index");
                return;
            }

            // Create our model
            RankingsModel Model = new RankingsModel(Client);

            // NOTE: The HttpServer will handle the DbConnectException
            using (StatsDatabase Database = new StatsDatabase())
            {
                // Loop through and add each index catagories, and its players
                for (int i = 0; i < IndexCatagories.Count; i++)
                {
                    Model.Stats.Add(new RankingStats
                    {
                        Name       = IndexCatagories[i].Key,
                        Desc       = IndexCatagories[i].Value,
                        UrlName    = ActionNames[i],
                        TopPlayers = GetTopFromQuery(i, Database)
                    });
                }
            }

            // Send response
            base.SendTemplateResponse("rankings_index", typeof(RankingsModel), Model, "Rankings");
        }