Skip to content

Commit

Permalink
finalized new models, added more to search (the query strings)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Mill committed Nov 12, 2015
1 parent f457f38 commit e93a3b2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
23 changes: 17 additions & 6 deletions TeamDBAwesome/TeamDBAwesome/SqlService/MySqlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ private void Init_Connection()
SqlConn = new MySqlConnection(connectionString);
}

private string GetDBString(string SqlFieldName, MySqlDataReader Reader)
{
return Reader[SqlFieldName].Equals(DBNull.Value) ? String.Empty : Reader.GetString(SqlFieldName);
}

/// <summary>
/// opens a connection to the DB
/// </summary>
Expand Down Expand Up @@ -167,10 +172,7 @@ public Customer GetCustomer(int PersonID)

}

private string GetDBString(string SqlFieldName, MySqlDataReader Reader)
{
return Reader[SqlFieldName].Equals(DBNull.Value) ? String.Empty : Reader.GetString(SqlFieldName);
}


public SearchResult Search(Search search)
{
Expand All @@ -179,9 +181,18 @@ public SearchResult Search(Search search)

if(open == true)
{
//media / album / artist / track / composer / genre

//do the search
//need to make the track, album, genre,media,composer, artist models
//nope. composer is inside of track
//need to write some logic to see any of the fields are blank, otherwise do each search, and add them to the lists in result
string mediaQuery = "select * from chinook.mediatype where name like \'%" + search.Media + "%\' ";
string albumQuery = "select * from chinook.album where name like \'%" + search.Album + "%\' ";
string artistQuery = "select * from chinook.artist where name like \'%" + search.Artist + "%\' ";
string trackQuery = "select * from chinook.track where name like \'%" + search.Track + "%\' ";
string composerQuery = "select * from chinook.track where composer like \'%" + search.Composer + "%\' ";
string genreQuery = "select * from chinook.genre where name like \'%" + search.Genre + "%\' ";


}
else
{
Expand Down
7 changes: 7 additions & 0 deletions TeamDBAwesome/TeamDBAwesome/TeamDBAwesome.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,14 @@
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Models\Album.cs" />
<Compile Include="Models\Artist.cs" />
<Compile Include="Models\Customer.cs" />
<Compile Include="Models\Genre.cs" />
<Compile Include="Models\Media.cs" />
<Compile Include="Models\Search.cs" />
<Compile Include="Models\SearchResult.cs" />
<Compile Include="Models\Track.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SqlService\MySqlService.cs" />
</ItemGroup>
Expand Down

0 comments on commit e93a3b2

Please sign in to comment.