歌曲編號SQL查詢+變數型態調整
This commit is contained in:
parent
8d66c5e408
commit
ae8e4424e4
@ -1970,7 +1970,7 @@ public class MultiPagePanel : Panel
|
|||||||
{
|
{
|
||||||
string searchText = artistLabel.Text; // 取得輸入內容
|
string searchText = artistLabel.Text; // 取得輸入內容
|
||||||
string query = $"SELECT * FROM SongLibrary WHERE `歌星 A` = '{searchText}' OR `歌星 B` = '{searchText}'";
|
string query = $"SELECT * FROM SongLibrary WHERE `歌星 A` = '{searchText}' OR `歌星 B` = '{searchText}'";
|
||||||
List<SongData> searchResults = PrimaryForm.Instance.SearchSongs_Mysql(query);
|
var searchResults = PrimaryForm.Instance.SearchSongs_Mysql(query);
|
||||||
// 重置分頁
|
// 重置分頁
|
||||||
PrimaryForm.Instance.currentPage = 0;
|
PrimaryForm.Instance.currentPage = 0;
|
||||||
currentSongList = searchResults;
|
currentSongList = searchResults;
|
||||||
|
@ -3,6 +3,7 @@ using System.Drawing.Imaging;
|
|||||||
using IniParser;
|
using IniParser;
|
||||||
using IniParser.Model;
|
using IniParser.Model;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
WordCountSongs -> SongIDSearch
|
WordCountSongs -> SongIDSearch
|
||||||
WordCount -> SongID
|
WordCount -> SongID
|
||||||
@ -537,8 +538,26 @@ namespace DualScreenDemo
|
|||||||
numberSearchSongButton.BackgroundImage = numberSearchSongNormalBackground;
|
numberSearchSongButton.BackgroundImage = numberSearchSongNormalBackground;
|
||||||
// 隱藏與 SongID 歌手相關的所有按鈕
|
// 隱藏與 SongID 歌手相關的所有按鈕
|
||||||
SetSongIDSearchAndButtonsVisibility(false);
|
SetSongIDSearchAndButtonsVisibility(false);
|
||||||
|
FindNumberSongs(); // 搜尋歌曲
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FindNumberSongs(){
|
||||||
|
string searchText = inputBoxSongIDSearch.Text;
|
||||||
|
// 在這裡添加搜尋歌曲的邏輯
|
||||||
|
// 例如:根據輸入框的內容搜尋歌曲
|
||||||
|
string query = $"SELECT * FROM SongLibrary WHERE `歌曲編號` = '{searchText}' ";
|
||||||
|
|
||||||
|
var searchResults = SearchSongs_Mysql(query);
|
||||||
|
// 重置分頁
|
||||||
|
currentPage = 0;
|
||||||
|
currentSongList = searchResults;
|
||||||
|
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
||||||
|
// 更新多頁面面板的內容
|
||||||
|
multiPagePanel.currentPageIndex = 0;
|
||||||
|
multiPagePanel.LoadSongs(currentSongList);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 創建一個特殊的按鈕,並設定其顯示屬性、事件處理和位置。
|
/// 創建一個特殊的按鈕,並設定其顯示屬性、事件處理和位置。
|
||||||
@ -604,7 +623,7 @@ namespace DualScreenDemo
|
|||||||
ResizeAndPositionControl(inputBoxSongIDSearch, inputBoxSongIDCoords.X, inputBoxSongIDCoords.Y, inputBoxSongIDCoords.Width, inputBoxSongIDCoords.Height);
|
ResizeAndPositionControl(inputBoxSongIDSearch, inputBoxSongIDCoords.X, inputBoxSongIDCoords.Y, inputBoxSongIDCoords.Width, inputBoxSongIDCoords.Height);
|
||||||
|
|
||||||
// 設定文本變更事件,當輸入框內容改變時觸發
|
// 設定文本變更事件,當輸入框內容改變時觸發
|
||||||
inputBoxSongIDSearch.TextChanged += (sender, e) =>
|
/*inputBoxSongIDSearch.TextChanged += (sender, e) =>
|
||||||
{
|
{
|
||||||
string searchText = inputBoxSongIDSearch.Text; // 取得輸入內容
|
string searchText = inputBoxSongIDSearch.Text; // 取得輸入內容
|
||||||
|
|
||||||
@ -619,7 +638,7 @@ namespace DualScreenDemo
|
|||||||
// 更新多頁面面板的內容
|
// 更新多頁面面板的內容
|
||||||
multiPagePanel.currentPageIndex = 0;
|
multiPagePanel.currentPageIndex = 0;
|
||||||
multiPagePanel.LoadSongs(currentSongList);
|
multiPagePanel.LoadSongs(currentSongList);
|
||||||
};
|
};*/
|
||||||
|
|
||||||
// 將輸入框加入到窗體的控件集合中
|
// 將輸入框加入到窗體的控件集合中
|
||||||
this.Controls.Add(inputBoxSongIDSearch);
|
this.Controls.Add(inputBoxSongIDSearch);
|
||||||
|
@ -258,6 +258,24 @@ namespace DualScreenDemo
|
|||||||
pinyinSearchSongButton.BackgroundImage = pinyinSearchSongNormalBackground;
|
pinyinSearchSongButton.BackgroundImage = pinyinSearchSongNormalBackground;
|
||||||
// 設定拼音輸入框與所有相關按鈕的可見性為 false
|
// 設定拼音輸入框與所有相關按鈕的可見性為 false
|
||||||
SetPinYinSongsAndButtonsVisibility(false);
|
SetPinYinSongsAndButtonsVisibility(false);
|
||||||
|
FindPinYinSongs();
|
||||||
|
|
||||||
|
}
|
||||||
|
private void FindPinYinSongs(){
|
||||||
|
string searchText = inputBoxPinYinSongs.Text;
|
||||||
|
// 在這裡添加搜尋歌曲的邏輯
|
||||||
|
// 例如:根據輸入框的內容搜尋歌曲
|
||||||
|
string query = $"SELECT * FROM SongLibrary WHERE `歌曲拼音` 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);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -312,7 +330,7 @@ namespace DualScreenDemo
|
|||||||
ResizeAndPositionControl(inputBoxPinYinSongs, x, y, width, height);
|
ResizeAndPositionControl(inputBoxPinYinSongs, x, y, width, height);
|
||||||
|
|
||||||
// **綁定 TextChanged 事件 (當輸入內容改變時觸發搜尋)**
|
// **綁定 TextChanged 事件 (當輸入內容改變時觸發搜尋)**
|
||||||
inputBoxPinYinSongs.TextChanged += (sender, e) =>
|
/*inputBoxPinYinSongs.TextChanged += (sender, e) =>
|
||||||
{
|
{
|
||||||
string searchText = inputBoxPinYinSongs.Text;
|
string searchText = inputBoxPinYinSongs.Text;
|
||||||
|
|
||||||
@ -326,7 +344,7 @@ namespace DualScreenDemo
|
|||||||
// 更新 UI,顯示搜尋結果
|
// 更新 UI,顯示搜尋結果
|
||||||
multiPagePanel.currentPageIndex = 0;
|
multiPagePanel.currentPageIndex = 0;
|
||||||
multiPagePanel.LoadSongs(currentSongList);
|
multiPagePanel.LoadSongs(currentSongList);
|
||||||
};
|
};*/
|
||||||
|
|
||||||
// 將拼音輸入框加入視窗中
|
// 將拼音輸入框加入視窗中
|
||||||
this.Controls.Add(inputBoxPinYinSongs);
|
this.Controls.Add(inputBoxPinYinSongs);
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
namespace DualScreenDemo
|
|
||||||
{
|
|
||||||
public partial class PrimaryForm
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,7 +3,6 @@ using System.Drawing.Imaging;
|
|||||||
using IniParser;
|
using IniParser;
|
||||||
using IniParser.Model;
|
using IniParser.Model;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DBObj;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -561,7 +560,7 @@ namespace DualScreenDemo
|
|||||||
query = string.Empty; // 清空查詢
|
query = string.Empty; // 清空查詢
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<SongData> searchResults = SearchSongs_Mysql(query);
|
var searchResults = SearchSongs_Mysql(query);
|
||||||
// 重置分頁
|
// 重置分頁
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
currentSongList = searchResults;
|
currentSongList = searchResults;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user