修复修改文件名的BUG

This commit is contained in:
Falcon 2024-08-02 15:17:58 +08:00
parent 62d6d6d920
commit 4f49ae9887

View File

@ -377,6 +377,7 @@ namespace CalendarNotepad
} }
var item = items[0]; var item = items[0];
var fileName = item.Text; var fileName = item.Text;
var fileKey = item.SubItems[2].Text;
var dlgr = Interaction.InputBox($"原文件名:{fileName}",Title: "修改文件名",DefaultResponse: fileName); var dlgr = Interaction.InputBox($"原文件名:{fileName}",Title: "修改文件名",DefaultResponse: fileName);
if(dlgr == "") { if(dlgr == "") {
return; return;
@ -385,7 +386,7 @@ namespace CalendarNotepad
return; return;
} }
var wd = this.WorkDayKey; var wd = this.WorkDayKey;
this.Db.Updateable<WorkUnitPlusFile>().Where(a => a.WorkDay == wd).SetColumns(a => a.FileName == dlgr).ExecuteCommand(); this.Db.Updateable<WorkUnitPlusFile>().Where(a => a.WorkDay == wd && a.FileKey == fileKey).SetColumns(a => a.FileName == dlgr).ExecuteCommand();
item.Text = dlgr; item.Text = dlgr;
MessageBox.Show("文件名修改完成"); MessageBox.Show("文件名修改完成");
} }