51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using System.Data.SQLite;
|
|
using System.IO;
|
|
using DualScreenDemo;
|
|
namespace DBObj
|
|
{
|
|
/**
|
|
從資料庫取資料回來
|
|
*/
|
|
public class ArtistManager
|
|
{
|
|
private static ArtistManager _instance;
|
|
public List<Artist> AllArtists { get; private set; }
|
|
|
|
public static ArtistManager Instance
|
|
{
|
|
get
|
|
{
|
|
if (_instance == null)
|
|
{
|
|
_instance = new ArtistManager();
|
|
}
|
|
return _instance;
|
|
}
|
|
}
|
|
|
|
public ArtistManager()
|
|
{
|
|
AllArtists = new List<Artist>();
|
|
//LoadArtists();
|
|
|
|
}
|
|
|
|
public List<Artist> GetArtistsByCategoryAndStrokeCountRange(string category, int minStrokes, int maxStrokes)
|
|
{
|
|
if (category == "全部")
|
|
{
|
|
string query = $"SELECT * FROM ArtistLibrary WHERE 歌手筆畫 >= {minStrokes} AND 歌手筆畫 <={maxStrokes}";
|
|
var searchResults = PrimaryForm.SearchSingers_Mysql(query);
|
|
return searchResults;
|
|
//return AllArtists.Where(artist => artist.Strokes >= minStrokes && artist.Strokes <= maxStrokes).ToList();
|
|
}
|
|
else
|
|
{
|
|
string query = $"SELECT * FROM ArtistLibrary WHERE 歌手分類 = '{category}' AND 歌手筆畫 >= {minStrokes} AND 歌手筆畫 <={maxStrokes}";
|
|
var searchResults = PrimaryForm.SearchSingers_Mysql(query);
|
|
return searchResults;
|
|
//return AllArtists.Where(artist => artist.Category == category && artist.Strokes >= minStrokes && artist.Strokes <= maxStrokes).ToList();
|
|
}
|
|
}
|
|
}
|
|
} |