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
This diff is collapsed.
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