附件增加改名功能
This commit is contained in:
parent
52b72a0c3c
commit
1d1716ca4e
19
CalendarNotepad/WorkMain.Designer.cs
generated
19
CalendarNotepad/WorkMain.Designer.cs
generated
|
@ -76,6 +76,7 @@
|
|||
panel2 = new Panel();
|
||||
panel3 = new Panel();
|
||||
OpenFileDlg = new OpenFileDialog();
|
||||
更名ToolStripMenuItem = new ToolStripMenuItem();
|
||||
tabControl1.SuspendLayout();
|
||||
tpWorkManage.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
|
||||
|
@ -418,28 +419,28 @@
|
|||
//
|
||||
// cms_FileList
|
||||
//
|
||||
cms_FileList.Items.AddRange(new ToolStripItem[] { 删除ToolStripMenuItem,导入ToolStripMenuItem,下载ToolStripMenuItem });
|
||||
cms_FileList.Items.AddRange(new ToolStripItem[] { 删除ToolStripMenuItem,导入ToolStripMenuItem,下载ToolStripMenuItem,更名ToolStripMenuItem });
|
||||
cms_FileList.Name = "contextMenuStrip1";
|
||||
cms_FileList.Size = new Size(101,70);
|
||||
cms_FileList.Size = new Size(181,114);
|
||||
//
|
||||
// 删除ToolStripMenuItem
|
||||
//
|
||||
删除ToolStripMenuItem.Name = "删除ToolStripMenuItem";
|
||||
删除ToolStripMenuItem.Size = new Size(100,22);
|
||||
删除ToolStripMenuItem.Size = new Size(180,22);
|
||||
删除ToolStripMenuItem.Text = "删除";
|
||||
删除ToolStripMenuItem.Click += 删除ToolStripMenuItem_Click;
|
||||
//
|
||||
// 导入ToolStripMenuItem
|
||||
//
|
||||
导入ToolStripMenuItem.Name = "导入ToolStripMenuItem";
|
||||
导入ToolStripMenuItem.Size = new Size(100,22);
|
||||
导入ToolStripMenuItem.Size = new Size(180,22);
|
||||
导入ToolStripMenuItem.Text = "导入";
|
||||
导入ToolStripMenuItem.Click += 导入ToolStripMenuItem_Click;
|
||||
//
|
||||
// 下载ToolStripMenuItem
|
||||
//
|
||||
下载ToolStripMenuItem.Name = "下载ToolStripMenuItem";
|
||||
下载ToolStripMenuItem.Size = new Size(100,22);
|
||||
下载ToolStripMenuItem.Size = new Size(180,22);
|
||||
下载ToolStripMenuItem.Text = "下载";
|
||||
下载ToolStripMenuItem.Click += 下载ToolStripMenuItem_Click;
|
||||
//
|
||||
|
@ -621,6 +622,13 @@
|
|||
//
|
||||
OpenFileDlg.Multiselect = true;
|
||||
//
|
||||
// 更名ToolStripMenuItem
|
||||
//
|
||||
更名ToolStripMenuItem.Name = "更名ToolStripMenuItem";
|
||||
更名ToolStripMenuItem.Size = new Size(180,22);
|
||||
更名ToolStripMenuItem.Text = "更名";
|
||||
更名ToolStripMenuItem.Click += 更名ToolStripMenuItem_Click;
|
||||
//
|
||||
// WorkMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F,17F);
|
||||
|
@ -718,5 +726,6 @@
|
|||
private FlowLayoutPanel flowLayoutPanel5;
|
||||
private Button bt_m_dbshc;
|
||||
private Label label5;
|
||||
private ToolStripMenuItem 更名ToolStripMenuItem;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
using CalendarNotepad.Extends;
|
||||
using CalendarNotepad.Models;
|
||||
using Microsoft.VisualBasic;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CalendarNotepad
|
||||
|
@ -360,5 +361,37 @@ namespace CalendarNotepad
|
|||
var dlg = new dlgDatabaseSchemas();
|
||||
dlg.Show();
|
||||
}
|
||||
|
||||
private void 更名ToolStripMenuItem_Click(object sender,EventArgs e) {
|
||||
var items = this.FileListView.SelectedItems;
|
||||
if(items.Count == 0) {
|
||||
MessageBox.Show("必须要选择更名的文件");
|
||||
return;
|
||||
}
|
||||
if(items.Count > 1) {
|
||||
MessageBox.Show("不能同时对多个文件更名,只能选择一个");
|
||||
return;
|
||||
}
|
||||
var item = items[0];
|
||||
var fileName = item.Text;
|
||||
var dlgr = Interaction.InputBox($"原文件名:{fileName}",Title: "修改文件名",DefaultResponse: fileName);
|
||||
if(dlgr == "") {
|
||||
return;
|
||||
}
|
||||
if(fileName == dlgr) {
|
||||
return;
|
||||
}
|
||||
var wd = this.WorkDayKey;
|
||||
this.Db.Updateable<WorkUnitPlusFile>().Where(a => a.WorkDay == wd).SetColumns(a => a.FileName == dlgr).ExecuteCommand();
|
||||
item.Text = dlgr;
|
||||
MessageBox.Show("文件名修改完成");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前记录日志的键
|
||||
/// </summary>
|
||||
public string WorkDayKey {
|
||||
get => this.mcWorkDay.SelectionStart.ToString("yyyyMMdd");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user