新歌(全)SQL查詢

This commit is contained in:
jasonchenwork 2025-04-14 16:32:29 +08:00
parent dd07cd6f52
commit f3bfe3eb1a
7 changed files with 34 additions and 16 deletions

View File

@ -80,12 +80,13 @@ namespace DualScreenDemo
riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground;
hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground;
int songLimit = ReadNewSongLimit();
guoYuSongs2 = allSongs.Where(song => song.Category == "國語")
/*guoYuSongs2 = allSongs.Where(song => song.Category == "國語")
.OrderByDescending(song => song.AddedTime)
.Take(songLimit)
.ToList();
.ToList();*/
string query = setQueryforNewSong("國語");
var guoYuSongs2 = SearchSongs_Mysql(query);
currentPage = 0;
currentSongList = guoYuSongs2;
totalPages = (int)Math.Ceiling((double)guoYuSongs2.Count / itemsPerPage);
@ -249,5 +250,9 @@ namespace DualScreenDemo
return 100;
}
private string setQueryforNewSong(string category){
string query = $"SELECT * FROM SongLibrary WHERE `語別` = '{category}' ORDER BY `新增日期` DESC LIMIT {ReadNewSongLimit()}";
return query;
}
}
}

View File

@ -13,10 +13,12 @@ namespace DualScreenDemo
int songLimit = ReadNewSongLimit();
yueYuSongs2 = allSongs.Where(song => song.Category == "粵語")
/*yueYuSongs2 = allSongs.Where(song => song.Category == "粵語")
.OrderByDescending(song => song.AddedTime)
.Take(songLimit)
.ToList();
.ToList();*/
string query = setQueryforNewSong("粵語");
var yueYuSongs2 = SearchSongs_Mysql(query);
currentPage = 0;
currentSongList = yueYuSongs2;
totalPages = (int)Math.Ceiling((double)yueYuSongs2.Count / itemsPerPage);

View File

@ -13,10 +13,12 @@ namespace DualScreenDemo
int songLimit = ReadNewSongLimit();
guoYuSongs2 = allSongs.Where(song => song.Category == "國語")
/*guoYuSongs2 = allSongs.Where(song => song.Category == "國語")
.OrderByDescending(song => song.AddedTime)
.Take(songLimit)
.ToList();
.ToList();*/
string query = setQueryforNewSong("國語");
var guoYuSongs2 = SearchSongs_Mysql(query);
currentPage = 0;
currentSongList = guoYuSongs2;
totalPages = (int)Math.Ceiling((double)guoYuSongs2.Count / itemsPerPage);

View File

@ -13,10 +13,13 @@ namespace DualScreenDemo
int songLimit = ReadNewSongLimit();
yingWenSongs2 = allSongs.Where(song => song.Category == "英文")
/*yingWenSongs2 = allSongs.Where(song => song.Category == "英文")
.OrderByDescending(song => song.AddedTime)
.Take(songLimit)
.ToList();
.ToList();*/
string query = setQueryforNewSong("英文");
var yingWenSongs2 = SearchSongs_Mysql(query);
currentPage = 0;
currentSongList = yingWenSongs2;
totalPages = (int)Math.Ceiling((double)yingWenSongs2.Count / itemsPerPage);

View File

@ -13,10 +13,12 @@ namespace DualScreenDemo
int songLimit = ReadNewSongLimit();
riYuSongs2 = allSongs.Where(song => song.Category == "日語")
/*riYuSongs2 = allSongs.Where(song => song.Category == "日語")
.OrderByDescending(song => song.AddedTime)
.Take(songLimit)
.ToList();
.ToList();*/
string query = setQueryforNewSong("日語");
var riYuSongs2 = SearchSongs_Mysql(query);
currentPage = 0;
currentSongList = riYuSongs2;
totalPages = (int)Math.Ceiling((double)riYuSongs2.Count / itemsPerPage);

View File

@ -13,10 +13,12 @@ namespace DualScreenDemo
int songLimit = ReadNewSongLimit();
hanYuSongs2 = allSongs.Where(song => song.Category == "韓語")
/*hanYuSongs2 = allSongs.Where(song => song.Category == "韓語")
.OrderByDescending(song => song.AddedTime)
.Take(songLimit)
.ToList();
.ToList();*/
string query = setQueryforNewSong("韓語");
var hanYuSongs2 = SearchSongs_Mysql(query);
currentPage = 0;
currentSongList = hanYuSongs2;
totalPages = (int)Math.Ceiling((double)hanYuSongs2.Count / itemsPerPage);

View File

@ -13,10 +13,12 @@ namespace DualScreenDemo
int songLimit = ReadNewSongLimit();
taiYuSongs2 = allSongs.Where(song => song.Category == "台語")
/*taiYuSongs2 = allSongs.Where(song => song.Category == "台語")
.OrderByDescending(song => song.AddedTime)
.Take(songLimit)
.ToList();
.ToList();*/
string query = setQueryforNewSong("台語");
var taiYuSongs2 = SearchSongs_Mysql(query);
currentPage = 0;
currentSongList = taiYuSongs2;
totalPages = (int)Math.Ceiling((double)taiYuSongs2.Count / itemsPerPage);