新增點播次數
This commit is contained in:
parent
7bc4902e38
commit
3e30e7130c
@ -468,6 +468,35 @@ namespace DBObj
|
||||
}
|
||||
}
|
||||
|
||||
public void AddSongCount(string songNumber)
|
||||
{
|
||||
string databaseFileName = "KSongDatabase.db";
|
||||
string databasePath = Path.Combine(Application.StartupPath, databaseFileName);
|
||||
string connectionString = String.Format("Data Source={0};Version=3;", databasePath);
|
||||
|
||||
using (var connection = new SQLiteConnection(connectionString))
|
||||
{
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
string sql = "UPDATE SongLibrary SET `點播次數`= `點播次數` + 1 WHERE `歌曲編號` = @songNumber";
|
||||
using (var command = new SQLiteCommand(sql, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@songNumber", songNumber);
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
connection.Close();
|
||||
Console.WriteLine("Success to add song counts: " + sql);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Failed to add song counts: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<SongData> SearchSongsBySinger(string keyword)
|
||||
{
|
||||
|
||||
|
@ -1511,6 +1511,7 @@ private void DisplaySongsInLanguage(string language, Category category)
|
||||
VideoPlayerForm.Instance.SetPlayingSongList(PrimaryForm.userRequestedSongs);
|
||||
PrimaryForm.currentSongIndexInHistory += 1;
|
||||
}
|
||||
SongListManager.Instance.AddSongCount(songData.SongNumber);
|
||||
VideoPlayerForm.Instance.UpdateNextSongFromPlaylist();
|
||||
PrimaryForm.PrintPlayingSongList();
|
||||
}
|
||||
|
Reference in New Issue
Block a user