public static string RequestAchievements(string apiKey, string userID) { string response = ResponseTool.CheckAPIKey(apiKey, userAPIKey); if (response != null) { return(response); } using (var conn = DataManager.CreateConnectionObject()) { conn.Open(); using (var command = conn.CreateCommand()) { command.CommandText = string.Format("SELECT ID, AchievementID, PercentComplete FROM Achievements WHERE UserID = '{0}'", userID); using (var reader = command.ExecuteReader()) { var webResponse = new WebResponse(ResponseTypes.Succeeded); webResponse.Achievements = new List <WebResponse_Achievement>(); while (reader.Read()) { var a = new WebResponse_Achievement() { ID = reader["AchievementID"].ToString(), AchievementID = reader["AchievementID"].ToString(), PercentComplete = float.Parse(reader["PercentComplete"].ToString()) }; webResponse.Achievements.Add(a); } return(ResponseTool.GenerateXML(webResponse)); } } } }
public static string RequestAchievements(string apiKey, string userID) { string response = ResponseTool.CheckAPIKey(apiKey, userAPIKey); if (response != null) return response; using (var conn = DataManager.CreateConnectionObject()) { conn.Open(); using (var command = conn.CreateCommand()) { command.CommandText = string.Format("SELECT ID, AchievementID, PercentComplete FROM Achievements WHERE UserID = '{0}'", userID); using (var reader = command.ExecuteReader()) { var webResponse = new WebResponse(ResponseTypes.Succeeded); webResponse.Achievements = new List<WebResponse_Achievement>(); while (reader.Read()) { var a = new WebResponse_Achievement() { ID = reader["AchievementID"].ToString(), AchievementID = reader["AchievementID"].ToString(), PercentComplete = float.Parse(reader["PercentComplete"].ToString()) }; webResponse.Achievements.Add(a); } return ResponseTool.GenerateXML(webResponse); } } } }