Commit fe264873 authored by tr's avatar tr

1、添加:员工考核记录工具(存储于204 FTT_Work.FTT_EvaluationOfEmployee)

parent a9b014e5
一、操作说明:
1、新增:填写减分、减分原因、并选择员工姓名;然后点击【添加记录】
2、编辑:点击明细记录指定行,编辑后,点击【更新记录】
3、复制:点击明细记录指定行,编辑后,点击【新增记录】
二、规则与约束
1、减分区间为[1, 30]
2、减分记录不允许删除
\ No newline at end of file
......@@ -42,4 +42,10 @@
<UserId>sa</UserId>
<Pwd>sa</Pwd>
</links>
<links>
<Link>192.168.1.202</Link>
<DbName>FTT_PDM_210317</DbName>
<UserId>sa</UserId>
<Pwd>sa</Pwd>
</links>
</DocumentElement>
\ No newline at end of file
......@@ -202,6 +202,18 @@ namespace Tools.MyCommon
{
this.Binding(c as CheckBox, drv);
}
else if (c is NumericUpDown)
{
this.Binding(c as NumericUpDown, drv);
}
else if (c is ComboBox)
{
this.Binding(c as ComboBox, drv);
}
else if (c is DateTimePicker)
{
this.Binding(c as DateTimePicker, drv);
}
}
}
......@@ -238,7 +250,7 @@ namespace Tools.MyCommon
var property = "";
var column = "";
if (c is TextBox)
if (c is TextBox || c is ComboBox)
{
property = "Text";
column = c.Name.Substring(2);
......@@ -248,6 +260,11 @@ namespace Tools.MyCommon
property = "Checked";
column = c.Name.Substring(2);
}
else if (c is DateTimePicker || c is NumericUpDown)
{
property = "Value";
column = c.Name.Substring(2);
}
return new BindInfo() { ColumnName = column, PropertyName = property };
}
......
......@@ -280,6 +280,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>
......
......@@ -184,6 +184,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>
......
......@@ -90,6 +90,12 @@
<Compile Include="MyData\DBHelper.cs" />
<Compile Include="MyData\SqlHelper.cs" />
<Compile Include="MyUtils\DrawHelper.cs" />
<Compile Include="UI\wEvaluationOfEmployee.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\wEvaluationOfEmployee.Designer.cs">
<DependentUpon>wEvaluationOfEmployee.cs</DependentUpon>
</Compile>
<Compile Include="UI\wImageSearch.cs">
<SubType>Form</SubType>
</Compile>
......@@ -238,6 +244,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="UI\wEvaluationOfEmployee.resx">
<DependentUpon>wEvaluationOfEmployee.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\wImageSearch.resx">
<DependentUpon>wImageSearch.cs</DependentUpon>
</EmbeddedResource>
......@@ -376,6 +385,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="favior.ico" />
<None Include="Resources\编辑.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
namespace Tools.UI
{
partial class wEvaluationOfEmployee
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.tsbAdd = new System.Windows.Forms.ToolStripButton();
this.tsbUpdate = new System.Windows.Forms.ToolStripButton();
this.tsbHelp = new System.Windows.Forms.ToolStripButton();
this.panel1 = new System.Windows.Forms.Panel();
this.cbWho = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.tbReason = new System.Windows.Forms.TextBox();
this.nbMinus = new System.Windows.Forms.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.dgvDetail = new System.Windows.Forms.DataGridView();
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.toolStrip1.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nbMinus)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvDetail)).BeginInit();
this.SuspendLayout();
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbAdd,
this.tsbUpdate,
this.tsbHelp});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(745, 25);
this.toolStrip1.TabIndex = 0;
this.toolStrip1.Text = "toolStrip1";
//
// tsbAdd
//
this.tsbAdd.Image = global::Tools.Properties.Resources.新增;
this.tsbAdd.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbAdd.Name = "tsbAdd";
this.tsbAdd.Size = new System.Drawing.Size(76, 22);
this.tsbAdd.Text = "添加记录";
this.tsbAdd.Click += new System.EventHandler(this.tsbAdd_Click);
//
// tsbUpdate
//
this.tsbUpdate.Image = global::Tools.Properties.Resources.编辑;
this.tsbUpdate.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbUpdate.Name = "tsbUpdate";
this.tsbUpdate.Size = new System.Drawing.Size(76, 22);
this.tsbUpdate.Text = "更新记录";
this.tsbUpdate.Click += new System.EventHandler(this.tsbUpdate_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);
//
// panel1
//
this.panel1.Controls.Add(this.cbWho);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.tbReason);
this.panel1.Controls.Add(this.nbMinus);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.label1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 25);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(745, 100);
this.panel1.TabIndex = 1;
//
// cbWho
//
this.cbWho.FormattingEnabled = true;
this.cbWho.Items.AddRange(new object[] {
"段廷瑞",
"王奇誉"});
this.cbWho.Location = new System.Drawing.Point(296, 7);
this.cbWho.Name = "cbWho";
this.cbWho.Size = new System.Drawing.Size(108, 20);
this.cbWho.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(228, 11);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 4;
this.label3.Text = "员工姓名:";
//
// tbReason
//
this.tbReason.Location = new System.Drawing.Point(83, 35);
this.tbReason.Multiline = true;
this.tbReason.Name = "tbReason";
this.tbReason.Size = new System.Drawing.Size(381, 59);
this.tbReason.TabIndex = 3;
//
// nbMinus
//
this.nbMinus.Location = new System.Drawing.Point(83, 7);
this.nbMinus.Maximum = new decimal(new int[] {
30,
0,
0,
0});
this.nbMinus.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nbMinus.Name = "nbMinus";
this.nbMinus.Size = new System.Drawing.Size(120, 21);
this.nbMinus.TabIndex = 2;
this.nbMinus.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 35);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 1;
this.label2.Text = "减分原因:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 11);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 0;
this.label1.Text = "减 分:";
//
// dgvDetail
//
this.dgvDetail.BackgroundColor = System.Drawing.SystemColors.Window;
this.dgvDetail.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvDetail.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column4,
this.Column2,
this.Column1,
this.Column3});
this.dgvDetail.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvDetail.Location = new System.Drawing.Point(0, 125);
this.dgvDetail.Name = "dgvDetail";
this.dgvDetail.ReadOnly = true;
this.dgvDetail.RowTemplate.Height = 23;
this.dgvDetail.Size = new System.Drawing.Size(745, 356);
this.dgvDetail.TabIndex = 3;
//
// Column4
//
this.Column4.DataPropertyName = "ID";
this.Column4.HeaderText = "记录编号";
this.Column4.Name = "Column4";
//
// Column2
//
this.Column2.DataPropertyName = "Who";
this.Column2.HeaderText = "员工姓名";
this.Column2.Name = "Column2";
//
// Column1
//
this.Column1.DataPropertyName = "Minus";
this.Column1.HeaderText = "减分";
this.Column1.Name = "Column1";
//
// Column3
//
this.Column3.DataPropertyName = "Reason";
this.Column3.HeaderText = "减分原因";
this.Column3.Name = "Column3";
//
// wEvaluationOfEmployee
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(745, 481);
this.Controls.Add(this.dgvDetail);
this.Controls.Add(this.panel1);
this.Controls.Add(this.toolStrip1);
this.Name = "wEvaluationOfEmployee";
this.Text = "员工考核";
this.Load += new System.EventHandler(this.wEvaluationOfEmployee_Load);
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nbMinus)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgvDetail)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TextBox tbReason;
private System.Windows.Forms.NumericUpDown nbMinus;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ToolStripButton tsbAdd;
private System.Windows.Forms.ToolStripButton tsbUpdate;
private System.Windows.Forms.ToolStripButton tsbHelp;
private System.Windows.Forms.DataGridView dgvDetail;
private System.Windows.Forms.ComboBox cbWho;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Tools.MyCommon;
using Tools.MyUtils;
using Tools.MyData;
namespace Tools.UI
{
public partial class wEvaluationOfEmployee : wEditBasic
{
bool IsAdd = false;
int EditID = 0;
public wEvaluationOfEmployee()
{
InitializeComponent();
}
private void wEvaluationOfEmployee_Load(object sender, EventArgs e)
{
//初始化保存结构
this.ModuleTableList = new List<MyData.TQuery> {
new TQuery("FTT_EvaluationOfEmployee"),
};
//初始化数据库链接
var link = Utils.GetDbLinkString("192.168.1.204", "sa", "sa", "FTT_Work");
this.InitDBHelper(link);
//初始化数据
this.InitData();
this.InitUI();
}
public override void InitData()
{
this._ds = this._db.GetData(this.ModuleTableList, true);
}
public override void InitUI()
{
this.dgvDetail.MultiSelect = false;
this.dgvDetail.AllowUserToAddRows = false;
this.dgvDetail.AutoGenerateColumns = false;
this.dgvDetail.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
this.dgvDetail.DataSource = this._ds.Tables[0].DefaultView;
this.dgvDetail.CellMouseClick += DgvDetail_CellMouseClick;
}
public override bool SaveCheck()
{
if (this.cbWho.Text == string.Empty)
{
Utils.Tip("员工姓名必须输入!");
return false;
}
if (this.tbReason.Text == string.Empty)
{
Utils.Tip("减分原因必须输入!");
return false;
}
if (this.IsAdd)
{
this.Add();
}
else
{
this.Edit();
}
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;
if (rowIndex < 0 || rowIndex >= this._ds.Tables[0].DefaultView.Count)
return;
var drv = this._ds.Tables[0].DefaultView[rowIndex];
this.EditID = (int)drv["ID"];
this.nbMinus.Value = (int)drv["Minus"];
this.cbWho.Text = drv["Who"].ToString();
this.tbReason.Text = drv["Reason"].ToString();
}
private void Add()
{
//増行
var drNew = this._ds.Tables[0].NewRow();
drNew["Minus"] = this.nbMinus.Value;
drNew["Who"] = this.cbWho.Text;
drNew["Reason"] = this.tbReason.Text.Trim();
this._ds.Tables[0].Rows.Add(drNew);
}
private void Edit()
{
//查找编辑行
var drEdit = this._ds.Tables[0].Select($"ID={this.EditID}").FirstOrDefault();
if (this.EditID == 0 || drEdit == null)
{
Utils.Tip("请选择您要编辑的行!");
return;
}
//编辑赋值
drEdit["Minus"] = this.nbMinus.Value;
drEdit["Who"] = this.cbWho.Text;
drEdit["Reason"] = this.tbReason.Text.Trim();
drEdit.EndEdit();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
\ No newline at end of file
......@@ -34,6 +34,7 @@ namespace Tools
this.CreateModule(typeof(UI.wXmlGenerator), "XML生成器", "tr"),
this.CreateModule(typeof(UI.wModuleManager), "模块管理", "tr"),
this.CreateModule(typeof(UI.wLoginPwd), "登录密码", "tr"),
this.CreateModule(typeof(UI.wEvaluationOfEmployee), "员工考核", "tr"),
};
}
......
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