public DataSet GetAllSpecies(string version, string filter) { if (version == null) { // Special versioning case, if all parameters are not specified then we return an appropriate error. InstallerInfo.WriteEventLog("GetAllSpecies", "Suspect: " + Context.Request.ServerVariables["REMOTE_ADDR"].ToString()); return(null); } // Let's verify that this version is even allowed. string errorMessage = ""; PeerDiscoveryService discoveryService = new PeerDiscoveryService(); if (discoveryService.IsVersionDisabled(version, out errorMessage) == true) { return(null); } if (filter == null) { filter = string.Empty; } version = new Version(version).ToString(3); try { using (SqlConnection myConnection = new SqlConnection(ServerSettings.SpeciesDsn)) { myConnection.Open(); SqlCommand mySqlCommand = null; switch (filter) { case "All": mySqlCommand = new SqlCommand("TerrariumGrabAllSpecies", myConnection); break; default: mySqlCommand = new SqlCommand("TerrariumGrabAllRecentSpecies", myConnection); break; } SqlDataAdapter adapter = new SqlDataAdapter(mySqlCommand); mySqlCommand.CommandType = CommandType.StoredProcedure; SqlParameter parmVersion = mySqlCommand.Parameters.Add("@Version", SqlDbType.VarChar, 255); parmVersion.Value = version; DataSet data = new DataSet(); adapter.Fill(data); return(data); } } catch (Exception e) { InstallerInfo.WriteEventLog("GetAllSpecies", e.ToString()); return(null); } }
public DataSet GetAllSpecies(string version, string filter) { if ( version == null ) { // Special versioning case, if all parameters are not specified then we return an appropriate error. InstallerInfo.WriteEventLog("GetAllSpecies", "Suspect: " + Context.Request.ServerVariables["REMOTE_ADDR"].ToString()); return null; } // Let's verify that this version is even allowed. string errorMessage = ""; PeerDiscoveryService discoveryService = new PeerDiscoveryService(); if ( discoveryService.IsVersionDisabled( version, out errorMessage ) == true ) { return null; } if (filter == null) filter = string.Empty; version = new Version(version).ToString(3); try { using(SqlConnection myConnection = new SqlConnection(ServerSettings.SpeciesDsn)) { myConnection.Open(); SqlCommand mySqlCommand = null; switch(filter) { case "All": mySqlCommand = new SqlCommand("TerrariumGrabAllSpecies", myConnection); break; default: mySqlCommand = new SqlCommand("TerrariumGrabAllRecentSpecies", myConnection); break; } SqlDataAdapter adapter = new SqlDataAdapter(mySqlCommand); mySqlCommand.CommandType = CommandType.StoredProcedure; SqlParameter parmVersion = mySqlCommand.Parameters.Add("@Version", SqlDbType.VarChar, 255); parmVersion.Value = version; DataSet data = new DataSet(); adapter.Fill(data); return data; } } catch(Exception e) { InstallerInfo.WriteEventLog("GetAllSpecies", e.ToString()); return null; } }