示例#1
0
 public static void AddUserToRanking(int UserId, RankingType t, string Information = "hlatCompetitions", int RoomId = 0)
 {
     using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
     {
         dbClient.runFastQuery("INSERT INTO user_rankings (type, information, userid, roomid, score) VALUES ('" + parseEnum(t) + "', '" + Information + "', " + UserId + ", " + RoomId + ", 0);");
     }
     Ranking r = new Ranking();
     r.UserId = UserId;
     r.Type = t;
     r.Information = Information;
     r.RoomId = RoomId;
     r.Score = 0;
     getRanking.Add(UserId, r);
 }
示例#2
0
 public static void initRankings(IQueryAdapter dbClient)
 {
     dbClient.setQuery("SELECT * FROM user_rankings ORDER BY score ASC");
     DataTable table = dbClient.getTable();
     getRanking = new Dictionary<int, Ranking>();
     foreach (DataRow row in table.Rows)
     {
         Ranking r = new Ranking();
         r.UserId = Convert.ToInt32(row["userid"]);
         string type = (string)row["type"];
         if (type == "competitions")
             r.Type = RankingType.COMPETITIONS;
         else if (type == "snowwar")
             r.Type = RankingType.SNOWWAR;
         else if (type == "fastfood")
             r.Type = RankingType.FASTFOOD;
         else if (type == "slotcar")
             r.Type = RankingType.SLOTCAR;
         else
             r.Type = RankingType.NONE;
         r.Information = (string)row["information"];
         r.RoomId = (int)row["roomid"];
         r.Score = (int)row["score"];
         getRanking.Add(r.UserId, r);
     }
 }