歌手(全)SQL查詢
This commit is contained in:
parent
66fdbb7680
commit
50b2126e5b
@ -515,10 +515,22 @@ namespace DualScreenDemo
|
|||||||
pictureBoxZhuYinSingers.Visible = false;
|
pictureBoxZhuYinSingers.Visible = false;
|
||||||
// 關閉注音搜尋的按鈕顏色
|
// 關閉注音搜尋的按鈕顏色
|
||||||
zhuyinSearchButton.BackgroundImage = zhuyinSearchNormalBackground;
|
zhuyinSearchButton.BackgroundImage = zhuyinSearchNormalBackground;
|
||||||
|
FindBopomofoSingers();
|
||||||
// 隱藏與 ZhuYin 歌手相關的所有按鈕
|
// 隱藏與 ZhuYin 歌手相關的所有按鈕
|
||||||
SetZhuYinSingersAndButtonsVisibility(false);
|
SetZhuYinSingersAndButtonsVisibility(false);
|
||||||
}
|
}
|
||||||
|
private void FindBopomofoSingers(){
|
||||||
|
string searchText = inputBoxZhuYinSingers.Text;
|
||||||
|
string query = $"SELECT * FROM ArtistLibrary WHERE `歌手注音` LIKE '{searchText}%' ";
|
||||||
|
var searchResults = SearchSingers_Mysql(query);
|
||||||
|
|
||||||
|
currentPage = 0;
|
||||||
|
currentArtistList = searchResults;
|
||||||
|
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
||||||
|
|
||||||
|
multiPagePanel.currentPageIndex = 0;
|
||||||
|
multiPagePanel.LoadSingers(currentArtistList);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 創建一個特殊的按鈕,並設定其顯示屬性、事件處理和位置。
|
/// 創建一個特殊的按鈕,並設定其顯示屬性、事件處理和位置。
|
||||||
@ -584,7 +596,7 @@ namespace DualScreenDemo
|
|||||||
ResizeAndPositionControl(inputBoxZhuYinSingers, inputBoxZhuYinCoords.X, inputBoxZhuYinCoords.Y, inputBoxZhuYinCoords.Width, inputBoxZhuYinCoords.Height);
|
ResizeAndPositionControl(inputBoxZhuYinSingers, inputBoxZhuYinCoords.X, inputBoxZhuYinCoords.Y, inputBoxZhuYinCoords.Width, inputBoxZhuYinCoords.Height);
|
||||||
|
|
||||||
// 設定文本變更事件,當輸入框內容改變時觸發
|
// 設定文本變更事件,當輸入框內容改變時觸發
|
||||||
inputBoxZhuYinSingers.TextChanged += (sender, e) =>
|
/*inputBoxZhuYinSingers.TextChanged += (sender, e) =>
|
||||||
{
|
{
|
||||||
string searchText = inputBoxZhuYinSingers.Text;
|
string searchText = inputBoxZhuYinSingers.Text;
|
||||||
|
|
||||||
@ -598,7 +610,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
multiPagePanel.currentPageIndex = 0;
|
multiPagePanel.currentPageIndex = 0;
|
||||||
multiPagePanel.LoadSingers(currentArtistList);
|
multiPagePanel.LoadSingers(currentArtistList);
|
||||||
};
|
};*/
|
||||||
|
|
||||||
// 將輸入框加入到窗體的控件集合中
|
// 將輸入框加入到窗體的控件集合中
|
||||||
this.Controls.Add(inputBoxZhuYinSingers);
|
this.Controls.Add(inputBoxZhuYinSingers);
|
||||||
|
@ -266,9 +266,21 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
pictureBoxEnglishSingers.Visible = false;
|
pictureBoxEnglishSingers.Visible = false;
|
||||||
englishSearchButton.BackgroundImage = englishSearchNormalBackground;
|
englishSearchButton.BackgroundImage = englishSearchNormalBackground;
|
||||||
|
FindEnglishSingers();
|
||||||
SetEnglishSingersAndButtonsVisibility(false);
|
SetEnglishSingersAndButtonsVisibility(false);
|
||||||
}
|
}
|
||||||
|
private void FindEnglishSingers(){
|
||||||
|
string searchText = inputBoxEnglishSingers.Text;
|
||||||
|
string query = $"SELECT * FROM ArtistLibrary WHERE `歌手姓名` LIKE '{searchText}%' ";
|
||||||
|
var searchResults = SearchSingers_Mysql(query);
|
||||||
|
|
||||||
|
currentPage = 0;
|
||||||
|
currentArtistList = searchResults;
|
||||||
|
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
||||||
|
|
||||||
|
multiPagePanel.currentPageIndex = 0;
|
||||||
|
multiPagePanel.LoadSingers(currentArtistList);
|
||||||
|
}
|
||||||
private void InitializeInputBoxEnglishSingers()
|
private void InitializeInputBoxEnglishSingers()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -304,19 +316,6 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
ResizeAndPositionControl(inputBoxEnglishSingers, x, y, width, height);
|
ResizeAndPositionControl(inputBoxEnglishSingers, x, y, width, height);
|
||||||
|
|
||||||
inputBoxEnglishSingers.TextChanged += (sender, e) =>
|
|
||||||
{
|
|
||||||
string searchText = inputBoxEnglishSingers.Text;
|
|
||||||
var searchResults = allArtists.Where(artist => artist.Name.Replace(" ", "").StartsWith(searchText)).ToList();
|
|
||||||
|
|
||||||
currentPage = 0;
|
|
||||||
currentArtistList = searchResults;
|
|
||||||
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
|
||||||
|
|
||||||
multiPagePanel.currentPageIndex = 0;
|
|
||||||
multiPagePanel.LoadSingers(currentArtistList);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.Controls.Add(inputBoxEnglishSingers);
|
this.Controls.Add(inputBoxEnglishSingers);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -118,20 +118,7 @@ namespace DualScreenDemo
|
|||||||
ResizeAndPositionControl(handwritingInputBoxForSingers, 366, 373, 541, 62);
|
ResizeAndPositionControl(handwritingInputBoxForSingers, 366, 373, 541, 62);
|
||||||
this.Controls.Add(handwritingInputBoxForSingers);
|
this.Controls.Add(handwritingInputBoxForSingers);
|
||||||
|
|
||||||
handwritingInputBoxForSingers.TextChanged += (sender, e) =>
|
|
||||||
{
|
|
||||||
string searchText = handwritingInputBoxForSingers.Text;
|
|
||||||
|
|
||||||
|
|
||||||
var searchResults = allArtists.Where(artist => artist.Name.StartsWith(searchText)).ToList();
|
|
||||||
|
|
||||||
currentPage = 0;
|
|
||||||
currentArtistList = searchResults;
|
|
||||||
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
|
||||||
|
|
||||||
multiPagePanel.currentPageIndex = 0;
|
|
||||||
multiPagePanel.LoadSingers(currentArtistList);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeCandidateListBoxForSingers()
|
private void InitializeCandidateListBoxForSingers()
|
||||||
@ -297,8 +284,20 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
SetHandWritingForSingersAndButtonsVisibility(false);
|
SetHandWritingForSingersAndButtonsVisibility(false);
|
||||||
handWritingSearchButton.BackgroundImage = handWritingSearchNormalBackground;
|
handWritingSearchButton.BackgroundImage = handWritingSearchNormalBackground;
|
||||||
|
FindHandwritingSingers();
|
||||||
this.ResumeLayout();
|
this.ResumeLayout();
|
||||||
}
|
}
|
||||||
|
private void FindHandwritingSingers(){
|
||||||
|
string searchText = handwritingInputBoxForSingers.Text;
|
||||||
|
string query = $"SELECT * FROM ArtistLibrary WHERE `歌手姓名` LIKE '{searchText}%' ";
|
||||||
|
var searchResults = SearchSingers_Mysql(query);
|
||||||
|
|
||||||
|
currentPage = 0;
|
||||||
|
currentArtistList = searchResults;
|
||||||
|
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
||||||
|
|
||||||
|
multiPagePanel.currentPageIndex = 0;
|
||||||
|
multiPagePanel.LoadSingers(currentArtistList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -168,8 +168,26 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
pictureBoxPinYinSingers.Visible = false;
|
pictureBoxPinYinSingers.Visible = false;
|
||||||
pinyinSearchButton.BackgroundImage = pinyinSearchNormalBackground;
|
pinyinSearchButton.BackgroundImage = pinyinSearchNormalBackground;
|
||||||
|
FindPinYinSingers();
|
||||||
SetPinYinSingersAndButtonsVisibility(false);
|
SetPinYinSingersAndButtonsVisibility(false);
|
||||||
}
|
}
|
||||||
|
private void FindPinYinSingers(){
|
||||||
|
string searchText = inputBoxPinYinSingers.Text;
|
||||||
|
// 在這裡添加搜尋歌曲的邏輯
|
||||||
|
// 例如:根據輸入框的內容搜尋歌曲
|
||||||
|
string query = $"SELECT * FROM SongLibrary WHERE `歌星A拼音` LIKE '{searchText}%' OR `歌星B拼音` LIKE '{searchText}%' ";
|
||||||
|
|
||||||
|
var searchResults = SearchSongs_Mysql(query);
|
||||||
|
// 重置分頁
|
||||||
|
currentPage = 0;
|
||||||
|
currentSongList = searchResults;
|
||||||
|
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
||||||
|
// 更新多頁面面板的內容
|
||||||
|
multiPagePanel.currentPageIndex = 0;
|
||||||
|
multiPagePanel.LoadSongs(currentSongList);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void InitializeInputBoxPinYinSingers()
|
private void InitializeInputBoxPinYinSingers()
|
||||||
{
|
{
|
||||||
@ -206,7 +224,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
ResizeAndPositionControl(inputBoxPinYinSingers, x, y, width, height);
|
ResizeAndPositionControl(inputBoxPinYinSingers, x, y, width, height);
|
||||||
|
|
||||||
inputBoxPinYinSingers.TextChanged += (sender, e) =>
|
/*inputBoxPinYinSingers.TextChanged += (sender, e) =>
|
||||||
{
|
{
|
||||||
string searchText = inputBoxPinYinSingers.Text;
|
string searchText = inputBoxPinYinSingers.Text;
|
||||||
var searchResults = allSongs.Where(song => song.ArtistAPinyin.Replace(" ", "").StartsWith(searchText))
|
var searchResults = allSongs.Where(song => song.ArtistAPinyin.Replace(" ", "").StartsWith(searchText))
|
||||||
@ -218,19 +236,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
multiPagePanel.currentPageIndex = 0;
|
multiPagePanel.currentPageIndex = 0;
|
||||||
multiPagePanel.LoadSongs(currentSongList);
|
multiPagePanel.LoadSongs(currentSongList);
|
||||||
/////////////////////////////////////////////////////////////////
|
};*/
|
||||||
/*string searchText = inputBoxPinYinSingers.Text;
|
|
||||||
var searchResults = allArtists.Where(artist => artist.Name.Replace(" ", "").StartsWith(searchText)).ToList();
|
|
||||||
|
|
||||||
currentPage = 0;
|
|
||||||
currentArtistList = searchResults;
|
|
||||||
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
|
||||||
|
|
||||||
multiPagePanel.currentPageIndex = 0;
|
|
||||||
multiPagePanel.LoadSingers(currentArtistList);*/
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
this.Controls.Add(inputBoxPinYinSingers);
|
this.Controls.Add(inputBoxPinYinSingers);
|
||||||
}
|
}
|
||||||
|
@ -532,11 +532,26 @@ namespace DualScreenDemo
|
|||||||
// 隱藏 WordCount 歌手圖片框
|
// 隱藏 WordCount 歌手圖片框
|
||||||
pictureBoxWordCountSingers.Visible = false;
|
pictureBoxWordCountSingers.Visible = false;
|
||||||
wordCountSearchButton.BackgroundImage = wordCountSearchNormalBackground;
|
wordCountSearchButton.BackgroundImage = wordCountSearchNormalBackground;
|
||||||
|
FindWordCountSingers();
|
||||||
// 隱藏與 WordCount 歌手相關的所有按鈕
|
// 隱藏與 WordCount 歌手相關的所有按鈕
|
||||||
SetWordCountSingersAndButtonsVisibility(false);
|
SetWordCountSingersAndButtonsVisibility(false);
|
||||||
}
|
}
|
||||||
|
private void FindWordCountSingers(){
|
||||||
|
string searchText = inputBoxWordCountSingers.Text; // 取得輸入內容
|
||||||
|
if (int.TryParse(searchText, out int length))
|
||||||
|
{
|
||||||
|
//var searchResults = allArtists.Where(artist => artist.Name.Length == length).ToList();
|
||||||
|
string query = $"SELECT * FROM ArtistLibrary WHERE CHAR_LENGTH(歌手姓名) = {length} ";
|
||||||
|
var searchResults = SearchSingers_Mysql(query);
|
||||||
|
// 設定當前頁數為 0,並加載搜索結果
|
||||||
|
currentPage = 0;
|
||||||
|
currentArtistList = searchResults;
|
||||||
|
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
||||||
|
|
||||||
|
multiPagePanel.currentPageIndex = 0;
|
||||||
|
multiPagePanel.LoadSingers(currentArtistList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 創建一個特殊的按鈕,並設定其顯示屬性、事件處理和位置。
|
/// 創建一個特殊的按鈕,並設定其顯示屬性、事件處理和位置。
|
||||||
@ -600,24 +615,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
// 調整和定位輸入框的位置及大小
|
// 調整和定位輸入框的位置及大小
|
||||||
ResizeAndPositionControl(inputBoxWordCountSingers, inputBoxWordCountCoords.X, inputBoxWordCountCoords.Y, inputBoxWordCountCoords.Width, inputBoxWordCountCoords.Height);
|
ResizeAndPositionControl(inputBoxWordCountSingers, inputBoxWordCountCoords.X, inputBoxWordCountCoords.Y, inputBoxWordCountCoords.Width, inputBoxWordCountCoords.Height);
|
||||||
|
|
||||||
// 設定文本變更事件,當輸入框內容改變時觸發
|
|
||||||
inputBoxWordCountSingers.TextChanged += (sender, e) =>
|
|
||||||
{
|
|
||||||
string searchText = inputBoxWordCountSingers.Text; // 取得輸入內容
|
|
||||||
if (int.TryParse(searchText, out int length))
|
|
||||||
{
|
|
||||||
var searchResults = allArtists.Where(artist => artist.Name.Length == length).ToList();
|
|
||||||
|
|
||||||
// 設定當前頁數為 0,並加載搜索結果
|
|
||||||
currentPage = 0;
|
|
||||||
currentArtistList = searchResults;
|
|
||||||
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
|
||||||
|
|
||||||
multiPagePanel.currentPageIndex = 0;
|
|
||||||
multiPagePanel.LoadSingers(currentArtistList);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// 將輸入框加入到窗體的控件集合中
|
// 將輸入框加入到窗體的控件集合中
|
||||||
this.Controls.Add(inputBoxWordCountSingers);
|
this.Controls.Add(inputBoxWordCountSingers);
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ namespace DualScreenDemo
|
|||||||
string searchText = inputBoxZhuYinSongs.Text;
|
string searchText = inputBoxZhuYinSongs.Text;
|
||||||
// 在這裡添加搜尋歌曲的邏輯
|
// 在這裡添加搜尋歌曲的邏輯
|
||||||
// 例如:根據輸入框的內容搜尋歌曲
|
// 例如:根據輸入框的內容搜尋歌曲
|
||||||
string query = $"SELECT * FROM SongLibrary WHERE `歌曲注音` = '{searchText}' ";
|
string query = $"SELECT * FROM SongLibrary WHERE `歌曲注音` LIKE '{searchText}%' ";
|
||||||
|
|
||||||
var searchResults = SearchSongs_Mysql(query);
|
var searchResults = SearchSongs_Mysql(query);
|
||||||
// 重置分頁
|
// 重置分頁
|
||||||
|
Loading…
x
Reference in New Issue
Block a user