Ejemplo n.º 1
0
        public static string GetGameList(string apiKey, string clientID)
        {
            string response = ResponseTool.CheckAPIKey(apiKey, clientAPIKey);

            if (response != null)
            {
                return(response);
            }

            using (var conn = DataManager.CreateConnectionObject())
            {
                conn.Open();
                using (var command = conn.CreateCommand())
                {
                    var webResponse = new WebResponse(ResponseTypes.Succeeded);
                    webResponse.Games   = new List <WebResponse_Game>();
                    command.CommandText = string.Format("SELECT ID, Name FROM Games WHERE ClientID = '{0}'", clientID);
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var game = new WebResponse_Game()
                            {
                                ID   = reader["ID"].ToString(),
                                Name = reader["Name"].ToString()
                            };
                            webResponse.Games.Add(game);
                        }
                    }

                    return(ResponseTool.GenerateXML(webResponse));
                }
            }
        }
Ejemplo n.º 2
0
		public static string GetGameList(string apiKey, string clientID)
		{
			string response = ResponseTool.CheckAPIKey(apiKey, clientAPIKey);
			if (response != null) return response;

			using (var conn = DataManager.CreateConnectionObject())
			{
				conn.Open();
				using (var command = conn.CreateCommand())
				{
					var webResponse = new WebResponse(ResponseTypes.Succeeded);
					webResponse.Games = new List<WebResponse_Game>();
					command.CommandText = string.Format("SELECT ID, Name FROM Games WHERE ClientID = '{0}'", clientID);
					using (var reader = command.ExecuteReader())
					{
						while (reader.Read())
						{
							var game = new WebResponse_Game()
							{
								ID = reader["ID"].ToString(),
								Name = reader["Name"].ToString()
							};
							webResponse.Games.Add(game);
						}
					}

					return ResponseTool.GenerateXML(webResponse);
				}
			}
		}