Exemple #1
0
    protected string scoringHistory(string name, int level)
    {
        string player         = (name != "%") ? name + "'s" : "All-time";
        string scoringHistory = "<h3>" + player + " top level " + level.ToString() + " scores</h3>";

        scoringHistory += "<table class='scoringHistory'><tr><th>Player</th><th>Score</th><th>Date</th></tr>";
        Geography geography = new Geography();
        DataTable dt        = geography.GetScoringHistory(name, level);

        foreach (DataRow row in dt.Rows)
        {
            int    scoreId  = geography.GetWWScoreId(Session["Players"].ToString().TrimEnd('|').Split('|')[0], Convert.ToInt32(Session["level"]));
            string congrats = (scoreId == Convert.ToInt32(row["id"])) ? " Congratulations!" : "";
            string rowClass = (scoreId == Convert.ToInt32(row["id"])) ? " class='congrats'" : "";
            scoringHistory += "<tr" + rowClass + "><td>" + row["name"] + "</td><td>" + row["score"] + "</td><td>" + ((DateTime)row["playdate"]).ToString("dd-MMM-yy") + congrats + "</td></tr>";
        }
        scoringHistory += "</table>";
        return(scoringHistory);
    }