superstar_v2/DBObj/ArtistManager.cs

51 lines
1.7 KiB
C#
Raw Normal View History

2025-04-07 16:54:10 +08:00
using System.Data.SQLite;
2025-04-18 15:22:47 +08:00
using System.IO;
using DualScreenDemo;
2025-04-07 16:54:10 +08:00
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>();
2025-04-14 16:54:40 +08:00
//LoadArtists();
2025-04-07 16:54:10 +08:00
}
public List<Artist> GetArtistsByCategoryAndStrokeCountRange(string category, int minStrokes, int maxStrokes)
{
if (category == "全部")
{
2025-04-18 15:22:47 +08:00
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();
2025-04-07 16:54:10 +08:00
}
else
{
2025-04-18 15:22:47 +08:00
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();
2025-04-07 16:54:10 +08:00
}
}
}
}