private void createLeaderboard()
        {
            printMessage("Creating Leaderboard...");
            String rootFolder = Path.Combine(m_webpagesRootDirectory, "leaderboard");

            if (!Directory.Exists(rootFolder))
            {
                Directory.CreateDirectory(rootFolder);
            }
            string title          = "<h2>Leaderboard</h2>";
            string headerTemplate = title + "<br/>[_commonPageHeader]";

            Utilities.HTMLTableParameters parameters = new Utilities.HTMLTableParameters("");
            parameters.columns.Add("Rank", "{Rank}");
            parameters.columns.Add("No.", "[_makeTeamNumberLink]");
            parameters.columns.Add("Name", "[_makeTeamNameLink]");
            parameters.columns.Add("Total_Score", "{Total_Score}");
            parameters.columns.Add("Boards_Played", "{Boards_Played}");
            parameters.columns.Add("Percentage_Score", "{Percentage_Score}");
            parameters.sortCriteria = "Rank ASC";
            m_prefix                  = "../";
            parameters.fileName       = Path.Combine(rootFolder, "index.html");
            parameters.filterCriteria = "";
            parameters.headerTemplate = headerTemplate;
            parameters.tableName      = Constants.TableName.EventNames;
            createPage_(parameters);
            m_prefix            = "./";
            parameters.fileName = Path.Combine(m_webpagesRootDirectory, "index.html");
            createPage_(parameters);
            reportProgress("Created Leaderboard Page");
        }
示例#2
0
        private void createPage_(Utilities.HTMLTableParameters parameters)
        {
            StreamWriter sw = new StreamWriter(parameters.fileName);

            sw.WriteLine("<html><head></head><body>");
            DataRow[] foundRows = getTable(parameters.tableName).Select(parameters.filterCriteria, parameters.sortCriteria);
            DataRow   dRow      = (foundRows.Length < 1) ? null : foundRows[0];

            sw.WriteLine(applyTemplate_(parameters.headerTemplate, dRow));

            sw.WriteLine(Utilities.makeTablePreamble_() + "<thead><tr>");
            ArrayList tableHeader = new ArrayList();

            foreach (DictionaryEntry pair in parameters.columns)
            {
                tableHeader.Add(applyTemplate_("" + pair.Key, dRow));
            }
            sw.WriteLine(Utilities.makeTableHeader_(tableHeader) + "</tr></thead><tbody>");
            for (int i = 0; i < foundRows.Length; ++i)
            {
                DataRow   row      = foundRows[i];
                ArrayList tableRow = new ArrayList();
                foreach (DictionaryEntry pair in parameters.columns)
                {
                    string value = "" + pair.Value;
                    if (value.Equals("serial_number", StringComparison.OrdinalIgnoreCase))
                    {
                        tableRow.Add("" + (i + 1));
                    }
                    else if (value.Equals("qualified", StringComparison.OrdinalIgnoreCase))
                    {
                        tableRow.Add((i < m_numberOfQualifiers) ? "Q" : "");
                    }
                    else
                    {
                        tableRow.Add(applyTemplate_(value, row));
                    }
                }
                sw.WriteLine("<tr>" + Utilities.makeTableCell_(tableRow, i) + "</tr>");
            }
            sw.WriteLine("</tbody></table>");
            sw.WriteLine("</body></html>");
            sw.Close();
        }
示例#3
0
        private void createLeaderboard()
        {
            printMessage("Creating Leaderboard...");
            String rootFolder = Path.Combine(m_webpagesRootDirectory, "leaderboard");

            if (!Directory.Exists(rootFolder))
            {
                Directory.CreateDirectory(rootFolder);
            }
            string title          = (m_roundsCompleted == m_numberOfRounds) ? "<h2>Final Leaderboard</h2>" : "<h2>Leaderboard after Round " + m_roundsCompleted + "</h2>";
            string headerTemplate = title + "<br/>[_commonPageHeader]";

            if (m_roundsCompleted < 1)
            {
                StreamWriter sw = new StreamWriter(Path.Combine(rootFolder, "index.html"));
                sw.WriteLine("<html><head></head><body>");
                sw.WriteLine(applyTemplate_(headerTemplate, null));
                sw.WriteLine("<h1>No Scores Available Yet!</h1>");
                sw.WriteLine("</body></html>");
                sw.Close();
                return;
            }
            m_currentRound = m_roundsCompleted;
            Utilities.HTMLTableParameters parameters = new Utilities.HTMLTableParameters("");
            parameters.columns.Add("Rank", "{Rank_After_Round_" + m_roundsCompleted + "}");
            //parameters.columns.Add("Qualified", "Qualified");
            parameters.columns.Add("No.", "[_makeTeamNumberLink]");
            parameters.columns.Add("Name", "[_makeTeamNameLink]");
            parameters.columns.Add("VPs", "{Score_After_Round_" + m_roundsCompleted + "}");
            parameters.columns.Add("Tiebreaker Quotient", "{Tiebreaker_After_Round_" + m_roundsCompleted + "}");
            parameters.sortCriteria = "Rank_After_Round_" + m_roundsCompleted + " ASC";
            m_prefix                  = "../";
            parameters.fileName       = Path.Combine(rootFolder, "index.html");
            parameters.filterCriteria = "Rank_After_Round_" + m_roundsCompleted + " > -1";
            parameters.headerTemplate = headerTemplate;
            parameters.tableName      = Constants.TableName.EventComputedScores;
            createPage_(parameters);
            m_prefix            = "./";
            parameters.fileName = Path.Combine(m_webpagesRootDirectory, "index.html");
            createPage_(parameters);
            reportProgress("Created Leaderboard Page");
        }
示例#4
0
        private void createNamesPage()
        {
            printMessage("Creating Team Names...");
            String rootFolder = Path.Combine(m_webpagesRootDirectory, "names");

            if (!Directory.Exists(rootFolder))
            {
                Directory.CreateDirectory(rootFolder);
            }

            Utilities.HTMLTableParameters parameters = new Utilities.HTMLTableParameters("");
            parameters.columns.Add("No.", "[_makeTeamNumberLink]");
            parameters.columns.Add("Name", "[_makeTeamNameLink]");
            parameters.columns.Add("Members", "{Member_Names}");
            parameters.sortCriteria = "Team_Number ASC";
            m_prefix                  = "../";
            parameters.fileName       = Path.Combine(rootFolder, "index.html");
            parameters.filterCriteria = "";
            parameters.headerTemplate = "<h2>Team Compositions</h2>" + "<br/>[_commonPageHeader]";
            parameters.tableName      = Constants.TableName.EventNames;
            createPage_(parameters);
            reportProgress("Created Names Page");
        }
示例#5
0
        private void createRoundPage(int roundNumber)
        {
            printMessage("Creating Round Page for Round Number : " + roundNumber);
            m_prefix = "../";
            StreamWriter sw = new StreamWriter(Path.Combine(m_webpagesRootDirectory, "rounds", "round" + roundNumber + "score.html"));

            sw.WriteLine("<html><head></head><body>");
            int numberOfTeamsLeft   = LocalUtilities.teamsLeft(m_databaseFileName, roundNumber);
            int numberOfMatchesLeft = (numberOfTeamsLeft / 2) + numberOfTeamsLeft % 2;

            DataRow[] foundRows      = getTable(Constants.TableName.EventScores).Select("Round_Number = " + roundNumber + " AND Table_Number <= " + numberOfMatchesLeft, "Table_Number ASC");
            DataRow   dRow           = (foundRows.Length > 0)?foundRows[0]:null;
            string    headerTemplate = "<h2>Scores for Round " + roundNumber + "</h2>" + "<br/>[_commonPageHeader]";

            sw.WriteLine(applyTemplate_(headerTemplate, dRow));
            if (roundNumber > m_roundsCompleted)
            {
                if (roundNumber <= m_drawsCompleted)
                {
                    sw.WriteLine(Utilities.makeTablePreamble_() + "<thead><tr>");
                    ArrayList tableHeader = new ArrayList();
                    tableHeader.Clear();
                    tableHeader.Add("Round " + roundNumber + " Draw");
                    sw.WriteLine(Utilities.makeTableHeader_(tableHeader) + "</tr></thead><tbody>");
                    sw.WriteLine("<tr><td>");
                    sw.WriteLine(createRoundTable(roundNumber, foundRows, false));
                    sw.WriteLine("</td></tr></tbody></table>");
                    sw.WriteLine("</tbody></table>");
                }
                else
                {
                    sw.WriteLine("<h2>No Draw or Score published yet!</h2>");
                }
            }
            else
            {
                sw.WriteLine(Utilities.makeTablePreamble_() + "<thead><tr>");
                ArrayList tableHeader = new ArrayList();
                tableHeader.Clear();
                tableHeader.Add("Round " + roundNumber + " Score");
                tableHeader.Add("Cumulative Score and Ranking after Round " + roundNumber);
                sw.WriteLine(Utilities.makeTableHeader_(tableHeader) + "</tr></thead><tbody>");
                sw.WriteLine("<tr><td>");
                sw.WriteLine(createRoundTable(roundNumber, foundRows));
                sw.WriteLine("</td><td>");
                m_currentRound = roundNumber;
                Utilities.HTMLTableParameters parameters = new Utilities.HTMLTableParameters("");
                parameters.columns.Add("Rank", "{Rank_After_Round_" + roundNumber + "}");
                //parameters.columns.Add("Qualified", "Qualified");
                parameters.columns.Add("No.", "[_makeTeamNumberLink]");
                parameters.columns.Add("Name", "[_makeTeamNameLink]");
                parameters.columns.Add("VPs", "{Score_After_Round_" + roundNumber + "}");
                parameters.columns.Add("Tiebreaker Quotient", "{Tiebreaker_After_Round_" + roundNumber + "}");
                parameters.sortCriteria   = "Rank_After_Round_" + roundNumber + " ASC";
                parameters.filterCriteria = "Rank_After_Round_" + roundNumber + " > -1";
                parameters.headerTemplate = headerTemplate;
                parameters.tableName      = Constants.TableName.EventComputedScores;

                sw.WriteLine(createTable_(parameters));
                sw.WriteLine("</td></tr></tbody></table>");
                sw.WriteLine("</tbody></table>");
            }
            sw.WriteLine("</body></html>");
            sw.Close();
            reportProgress("Created Round " + roundNumber + " Score Page");
        }