using System.Data.SQLite; 
using System.IO;
using DualScreenDemo;
namespace DBObj
{
    /** 
        從資料庫取資料回來
    */
    public class ArtistManager
    {
        public ArtistManager()
        {

        }
        // 筆畫問題
        public List<Artist> GetArtistsByCategoryAndStrokeCountRange(string category, int minStrokes, int maxStrokes)
        {
            if (category == "全部")
            {
                string query = $"SELECT * FROM artists WHERE strokes_abbr >= {minStrokes} AND strokes_abbr <={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 artists WHERE category = '{category}' AND strokes_abbr >= {minStrokes} AND strokes_abbr <={maxStrokes};";
                var searchResults = PrimaryForm.SearchSingers_Mysql(query);
                return searchResults;
                //return AllArtists.Where(artist => artist.Category == category && artist.Strokes >= minStrokes && artist.Strokes <= maxStrokes).ToList();
            }
        }
    }
}