Commit 8b3f9ad2 authored by tr's avatar tr

1、工具优化:清空表、员工考核

parent 09fa31df
一、操作说明
1、选择数据库->填写模块主表
2、点击【查询外键引用】,显示所有外键关联表
3、点击【清空】,清空表内数据,并重置自增ID
二、说明
1、上述的主表,是相似表名中,较短的那个。相似表名,即拥有相同前缀的表,如T_Main与T_MainDetail
......@@ -48,4 +48,10 @@
<UserId>sa</UserId>
<Pwd>sa</Pwd>
</links>
<links>
<Link>.</Link>
<DbName>PDM_LN</DbName>
<UserId>sa</UserId>
<Pwd>sa</Pwd>
</links>
</DocumentElement>
\ No newline at end of file
......@@ -270,6 +270,16 @@ namespace Tools.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap 清空 {
get {
object obj = ResourceManager.GetObject("清空", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
......
......@@ -181,6 +181,9 @@
<data name="测试" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\测试.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="清空" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\清空.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="类" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\类.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
......
......@@ -394,6 +394,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="favior.ico" />
<None Include="Resources\清空.png" />
<None Include="Resources\编辑.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
......@@ -28,16 +28,19 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(wEmptyTable));
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.tslbLinkString = new System.Windows.Forms.ToolStripLabel();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.tstbMainTable = new System.Windows.Forms.ToolStripTextBox();
this.tsbSearchFK = new System.Windows.Forms.ToolStripButton();
this.tsbEmpty = new System.Windows.Forms.ToolStripButton();
this.tsbSelectDb = new System.Windows.Forms.ToolStripButton();
this.tslbLinkString = new System.Windows.Forms.ToolStripLabel();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.View = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
this.tsbSelectDb = new System.Windows.Forms.ToolStripButton();
this.tsbSearchFK = new System.Windows.Forms.ToolStripButton();
this.tsbEmpty = new System.Windows.Forms.ToolStripButton();
this.tsbHelp = new System.Windows.Forms.ToolStripButton();
this.toolStrip1.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
......@@ -45,23 +48,40 @@
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbSelectDb,
this.tslbLinkString,
this.toolStripSeparator2,
this.toolStripLabel1,
this.tstbMainTable,
this.toolStripSeparator3,
this.tsbSearchFK,
this.tsbEmpty,
this.tsbSelectDb,
this.tslbLinkString});
this.toolStripSeparator1,
this.tsbHelp});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(695, 25);
this.toolStrip1.Size = new System.Drawing.Size(884, 25);
this.toolStrip1.TabIndex = 0;
this.toolStrip1.Text = "toolStrip1";
//
// tslbLinkString
//
this.tslbLinkString.Font = new System.Drawing.Font("Microsoft YaHei UI", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tslbLinkString.ForeColor = System.Drawing.Color.Green;
this.tslbLinkString.Name = "tslbLinkString";
this.tslbLinkString.Size = new System.Drawing.Size(94, 22);
this.tslbLinkString.Text = "--请先选择数据库--";
//
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
//
// toolStripLabel1
//
this.toolStripLabel1.Name = "toolStripLabel1";
this.toolStripLabel1.Size = new System.Drawing.Size(32, 22);
this.toolStripLabel1.Text = "主表";
this.toolStripLabel1.Size = new System.Drawing.Size(44, 22);
this.toolStripLabel1.Text = "主表:";
//
// tstbMainTable
//
......@@ -70,40 +90,15 @@
this.tstbMainTable.Name = "tstbMainTable";
this.tstbMainTable.Size = new System.Drawing.Size(200, 25);
//
// tsbSearchFK
//
this.tsbSearchFK.Image = ((System.Drawing.Image)(resources.GetObject("tsbSearchFK.Image")));
this.tsbSearchFK.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbSearchFK.Name = "tsbSearchFK";
this.tsbSearchFK.Size = new System.Drawing.Size(100, 22);
this.tsbSearchFK.Text = "查询外键引用";
this.tsbSearchFK.Click += new System.EventHandler(this.tsbSearchFK_Click);
//
// tsbEmpty
//
this.tsbEmpty.Image = ((System.Drawing.Image)(resources.GetObject("tsbEmpty.Image")));
this.tsbEmpty.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbEmpty.Name = "tsbEmpty";
this.tsbEmpty.Size = new System.Drawing.Size(52, 22);
this.tsbEmpty.Text = "清空";
this.tsbEmpty.Click += new System.EventHandler(this.tsbEmpty_Click);
//
// tsbSelectDb
// toolStripSeparator3
//
this.tsbSelectDb.Image = ((System.Drawing.Image)(resources.GetObject("tsbSelectDb.Image")));
this.tsbSelectDb.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbSelectDb.Name = "tsbSelectDb";
this.tsbSelectDb.Size = new System.Drawing.Size(88, 22);
this.tsbSelectDb.Text = "选择数据库";
this.tsbSelectDb.Click += new System.EventHandler(this.tsbSelectDb_Click);
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25);
//
// tslbLinkString
// toolStripSeparator1
//
this.tslbLinkString.Font = new System.Drawing.Font("Microsoft YaHei UI", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.tslbLinkString.ForeColor = System.Drawing.Color.Green;
this.tslbLinkString.Name = "tslbLinkString";
this.tslbLinkString.Size = new System.Drawing.Size(94, 22);
this.tslbLinkString.Text = "--请先选择数据库--";
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
//
// View
//
......@@ -112,7 +107,7 @@
this.View.Dock = System.Windows.Forms.DockStyle.Top;
this.View.Location = new System.Drawing.Point(0, 0);
this.View.Name = "View";
this.View.Size = new System.Drawing.Size(695, 41);
this.View.Size = new System.Drawing.Size(884, 41);
this.View.TabIndex = 1;
//
// panel1
......@@ -123,15 +118,51 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 25);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(695, 432);
this.panel1.Size = new System.Drawing.Size(884, 536);
this.panel1.TabIndex = 2;
//
// tsbSelectDb
//
this.tsbSelectDb.Image = global::Tools.Properties.Resources.数据库;
this.tsbSelectDb.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbSelectDb.Name = "tsbSelectDb";
this.tsbSelectDb.Size = new System.Drawing.Size(64, 22);
this.tsbSelectDb.Text = "数据库";
this.tsbSelectDb.Click += new System.EventHandler(this.tsbSelectDb_Click);
//
// tsbSearchFK
//
this.tsbSearchFK.Image = global::Tools.Properties.Resources.查询;
this.tsbSearchFK.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbSearchFK.Name = "tsbSearchFK";
this.tsbSearchFK.Size = new System.Drawing.Size(100, 22);
this.tsbSearchFK.Text = "查询外键引用";
this.tsbSearchFK.Click += new System.EventHandler(this.tsbSearchFK_Click);
//
// tsbEmpty
//
this.tsbEmpty.Image = global::Tools.Properties.Resources.清空;
this.tsbEmpty.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbEmpty.Name = "tsbEmpty";
this.tsbEmpty.Size = new System.Drawing.Size(52, 22);
this.tsbEmpty.Text = "清空";
this.tsbEmpty.Click += new System.EventHandler(this.tsbEmpty_Click);
//
// tsbHelp
//
this.tsbHelp.Image = global::Tools.Properties.Resources.使用说明;
this.tsbHelp.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbHelp.Name = "tsbHelp";
this.tsbHelp.Size = new System.Drawing.Size(76, 22);
this.tsbHelp.Text = "操作说明";
this.tsbHelp.Click += new System.EventHandler(this.tsbHelp_Click);
//
// wEmptyTable
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(695, 457);
this.ClientSize = new System.Drawing.Size(884, 561);
this.Controls.Add(this.panel1);
this.Controls.Add(this.toolStrip1);
this.Name = "wEmptyTable";
......@@ -155,5 +186,9 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.ToolStripButton tsbSelectDb;
private System.Windows.Forms.ToolStripLabel tslbLinkString;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripButton tsbHelp;
}
}
\ No newline at end of file
......@@ -31,6 +31,17 @@ namespace Tools.UI
this.tsbEmpty.Enabled = false;
}
//事件:数据库选择
private void tsbSelectDb_Click(object sender, EventArgs e)
{
var w = new wDbSetting(this.tslbLinkString);
if (w.ShowDialog() == DialogResult.OK)
{
//初始化数据库访问对象
this.InitDBHelper(w.LinkModel);
}
}
//事件:查询外键引用
private void tsbSearchFK_Click(object sender, EventArgs e)
{
if (this._db == null)
......@@ -59,6 +70,7 @@ namespace Tools.UI
//界面激活
this.SetEnabled(true);
}
//事件:清空表
private void tsbEmpty_Click(object sender, EventArgs e)
{
this.SetEnabled(false);
......@@ -107,14 +119,10 @@ namespace Tools.UI
//
this.SetEnabled(true);
}
private void tsbSelectDb_Click(object sender, EventArgs e)
{
var w = new wDbSetting(this.tslbLinkString);
if (w.ShowDialog() == DialogResult.OK)
//事件:操作说明
private void tsbHelp_Click(object sender, EventArgs e)
{
//初始化数据库访问对象
this.InitDBHelper(w.LinkModel);
}
Utils.ShowHelp("emptytable_help");
}
/// <summary>
......
......@@ -120,50 +120,4 @@
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tsbSearchFK.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="tsbEmpty.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<data name="tsbSelectDb.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
</root>
\ No newline at end of file
......@@ -31,7 +31,7 @@ namespace Tools.UI
//初始化数据库链接
var link = Utils.GetDbLinkString("192.168.1.204", "sa", "sa", "FTT_Work");
this.InitDBHelper(link);
//初始化数据
//初始化
this.InitData();
this.InitUI();
}
......@@ -62,30 +62,33 @@ namespace Tools.UI
}
if (this.IsAdd)
{
this.Add();
this.AddRow();
}
else
{
this.Edit();
this.EditRow();
}
return base.SaveCheck();
}
//事件:新增记录
private void tsbAdd_Click(object sender, EventArgs e)
{
this.IsAdd = true;
this.Save();
}
//事件:更新记录
private void tsbUpdate_Click(object sender, EventArgs e)
{
this.IsAdd = false;
this.Save();
}
//事件:操作说明
private void tsbHelp_Click(object sender, EventArgs e)
{
Utils.ShowHelp("evaluation_help");
}
//事件:明细行点击
private void DgvDetail_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
var rowIndex = this.dgvDetail.CurrentRow.Index;
......@@ -98,8 +101,10 @@ namespace Tools.UI
this.tbReason.Text = drv["Reason"].ToString();
}
private void Add()
/// <summary>
/// 新增数据
/// </summary>
private void AddRow()
{
//増行
var drNew = this._ds.Tables[0].NewRow();
......@@ -108,7 +113,10 @@ namespace Tools.UI
drNew["Reason"] = this.tbReason.Text.Trim();
this._ds.Tables[0].Rows.Add(drNew);
}
private void Edit()
/// <summary>
/// 更新数据
/// </summary>
private void EditRow()
{
//查找编辑行
var drEdit = this._ds.Tables[0].Select($"ID={this.EditID}").FirstOrDefault();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment