📄 rewardandpunish.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Reflection;
namespace ManPowerManage.UILevel
{
/// <summary>
/// RewardAndPunish 的摘要说明。
/// </summary>
public class RewardAndPunish : System.Windows.Forms.Form
{
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.ComboBox comboRewardType;
private System.Windows.Forms.TextBox textEmployeeID;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.Label lblRecord;
private System.Windows.Forms.Button btnFirst;
private System.Windows.Forms.Button btnPrevious;
private System.Windows.Forms.Button btnNext;
private System.Windows.Forms.Button btnLast;
private System.Windows.Forms.Button btnModify;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Label label1;
private string connectionStr;
private string selectStr;
private string commandStr;
private OleDbConnection Connection1=null;
private OleDbCommand Command1=null;
private OleDbDataReader DataReader1=null;
private OleDbDataAdapter dataAdapter1=null;
private OleDbDataAdapter dataAdapter2=null;
private DataSet DataSetReward=new DataSet();
private DataSet DataSetViewReward=new DataSet();
private bool add=false;
DataView DataViewReward=new DataView();
private string [] ListHeader={"职工号","姓名","部门","类型","数额/元","日期"};
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.DataGrid dataGrid2;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn1;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ComboBox comboRewardType2;
private System.Windows.Forms.TextBox textEmployeeID2;
private System.Windows.Forms.Button btnRewardCancel;
private System.Windows.Forms.Button btnRewardSearch;
private System.Windows.Forms.Button btnRewardExport;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn4;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn5;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn6;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn7;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn8;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn9;
private System.Windows.Forms.TextBox textRemark;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn10;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn11;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.DateTimePicker dateTimePicker3;
private System.Windows.Forms.DateTimePicker dateTimePicker4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label11;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public RewardAndPunish()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this.connectionStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +Application.StartupPath + "\\ManPowerManage.mdb";
this.selectStr="select * from Reward";
this.Connection1=new OleDbConnection(this.connectionStr);
this.Command1=new OleDbCommand();
this.dataAdapter1=new OleDbDataAdapter(this.selectStr,this.Connection1);
this.selectStr="select * from View_Reward";
this.dataAdapter2=new OleDbDataAdapter(this.selectStr,this.Connection1);
this.Command1.Connection=this.Connection1;
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(RewardAndPunish));
this.dataGrid2 = new System.Windows.Forms.DataGrid();
this.dataGridTableStyle2 = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn4 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn5 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn6 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn7 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn8 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn9 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn11 = new System.Windows.Forms.DataGridTextBoxColumn();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.btnModify = new System.Windows.Forms.Button();
this.btnDelete = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.textRemark = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.label10 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.comboRewardType = new System.Windows.Forms.ComboBox();
this.textEmployeeID = new System.Windows.Forms.TextBox();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn1 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn2 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn3 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn10 = new System.Windows.Forms.DataGridTextBoxColumn();
this.btnApply = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnLast = new System.Windows.Forms.Button();
this.btnFirst = new System.Windows.Forms.Button();
this.lblRecord = new System.Windows.Forms.Label();
this.btnPrevious = new System.Windows.Forms.Button();
this.btnNext = new System.Windows.Forms.Button();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.comboRewardType2 = new System.Windows.Forms.ComboBox();
this.textEmployeeID2 = new System.Windows.Forms.TextBox();
this.btnRewardCancel = new System.Windows.Forms.Button();
this.btnRewardSearch = new System.Windows.Forms.Button();
this.btnRewardExport = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.dateTimePicker3 = new System.Windows.Forms.DateTimePicker();
this.dateTimePicker4 = new System.Windows.Forms.DateTimePicker();
this.label3 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.tabPage2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// dataGrid2
//
this.dataGrid2.AlternatingBackColor = System.Drawing.Color.GhostWhite;
this.dataGrid2.BackColor = System.Drawing.Color.GhostWhite;
this.dataGrid2.BackgroundColor = System.Drawing.Color.Lavender;
this.dataGrid2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.dataGrid2.CaptionBackColor = System.Drawing.Color.RoyalBlue;
this.dataGrid2.CaptionForeColor = System.Drawing.Color.White;
this.dataGrid2.DataMember = "";
this.dataGrid2.FlatMode = true;
this.dataGrid2.Font = new System.Drawing.Font("Tahoma", 8F);
this.dataGrid2.ForeColor = System.Drawing.Color.MidnightBlue;
this.dataGrid2.GridLineColor = System.Drawing.Color.RoyalBlue;
this.dataGrid2.HeaderBackColor = System.Drawing.Color.MidnightBlue;
this.dataGrid2.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
this.dataGrid2.HeaderForeColor = System.Drawing.Color.Lavender;
this.dataGrid2.LinkColor = System.Drawing.Color.Teal;
this.dataGrid2.Location = new System.Drawing.Point(16, 144);
this.dataGrid2.Name = "dataGrid2";
this.dataGrid2.ParentRowsBackColor = System.Drawing.Color.Lavender;
this.dataGrid2.ParentRowsForeColor = System.Drawing.Color.MidnightBlue;
this.dataGrid2.SelectionBackColor = System.Drawing.Color.Teal;
this.dataGrid2.SelectionForeColor = System.Drawing.Color.PaleGreen;
this.dataGrid2.Size = new System.Drawing.Size(496, 264);
this.dataGrid2.TabIndex = 0;
this.dataGrid2.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] {
this.dataGridTableStyle2});
//
// dataGridTableStyle2
//
this.dataGridTableStyle2.DataGrid = this.dataGrid2;
this.dataGridTableStyle2.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] {
this.dataGridTextBoxColumn4,
this.dataGridTextBoxColumn5,
this.dataGridTextBoxColumn6,
this.dataGridTextBoxColumn7,
this.dataGridTextBoxColumn8,
this.dataGridTextBoxColumn9,
this.dataGridTextBoxColumn11});
this.dataGridTableStyle2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGridTableStyle2.MappingName = "View_Reward";
//
// dataGridTextBoxColumn4
//
this.dataGridTextBoxColumn4.Format = "";
this.dataGridTextBoxColumn4.FormatInfo = null;
this.dataGridTextBoxColumn4.HeaderText = "职工号";
this.dataGridTextBoxColumn4.MappingName = "EmployeeID";
this.dataGridTextBoxColumn4.Width = 75;
//
// dataGridTextBoxColumn5
//
this.dataGridTextBoxColumn5.Format = "";
this.dataGridTextBoxColumn5.FormatInfo = null;
this.dataGridTextBoxColumn5.HeaderText = "姓名";
this.dataGridTextBoxColumn5.MappingName = "EmployeeName";
this.dataGridTextBoxColumn5.Width = 75;
//
// dataGridTextBoxColumn6
//
this.dataGridTextBoxColumn6.Format = "";
this.dataGridTextBoxColumn6.FormatInfo = null;
this.dataGridTextBoxColumn6.HeaderText = "部门";
this.dataGridTextBoxColumn6.MappingName = "Department";
this.dataGridTextBoxColumn6.Width = 75;
//
// dataGridTextBoxColumn7
//
this.dataGridTextBoxColumn7.Format = "";
this.dataGridTextBoxColumn7.FormatInfo = null;
this.dataGridTextBoxColumn7.HeaderText = "类型";
this.dataGridTextBoxColumn7.MappingName = "RewardType";
this.dataGridTextBoxColumn7.Width = 75;
//
// dataGridTextBoxColumn8
//
this.dataGridTextBoxColumn8.Format = "";
this.dataGridTextBoxColumn8.FormatInfo = null;
this.dataGridTextBoxColumn8.HeaderText = "金额";
this.dataGridTextBoxColumn8.MappingName = "Money";
this.dataGridTextBoxColumn8.Width = 75;
//
// dataGridTextBoxColumn9
//
this.dataGridTextBoxColumn9.Format = "";
this.dataGridTextBoxColumn9.FormatInfo = null;
this.dataGridTextBoxColumn9.HeaderText = "日期";
this.dataGridTextBoxColumn9.MappingName = "Date";
this.dataGridTextBoxColumn9.Width = 75;
//
// dataGridTextBoxColumn11
//
this.dataGridTextBoxColumn11.Format = "";
this.dataGridTextBoxColumn11.FormatInfo = null;
this.dataGridTextBoxColumn11.HeaderText = "备注";
this.dataGridTextBoxColumn11.MappingName = "Remark";
this.dataGridTextBoxColumn11.Width = 75;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(24, 8);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(616, 464);
this.tabControl1.TabIndex = 1;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabPage1
//
this.tabPage1.Controls.Add(this.btnModify);
this.tabPage1.Controls.Add(this.btnDelete);
this.tabPage1.Controls.Add(this.btnAdd);
this.tabPage1.Controls.Add(this.groupBox2);
this.tabPage1.Controls.Add(this.dataGrid1);
this.tabPage1.Controls.Add(this.btnApply);
this.tabPage1.Controls.Add(this.btnCancel);
this.tabPage1.Controls.Add(this.btnLast);
this.tabPage1.Controls.Add(this.btnFirst);
this.tabPage1.Controls.Add(this.lblRecord);
this.tabPage1.Controls.Add(this.btnPrevious);
this.tabPage1.Controls.Add(this.btnNext);
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(608, 439);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "奖惩记录管理";
//
// btnModify
//
this.btnModify.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnModify.Image = ((System.Drawing.Image)(resources.GetObject("btnModify.Image")));
this.btnModify.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnModify.Location = new System.Drawing.Point(504, 120);
this.btnModify.Name = "btnModify";
this.btnModify.Size = new System.Drawing.Size(56, 24);
this.btnModify.TabIndex = 109;
this.btnModify.Text = "修改";
this.btnModify.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnModify.Click += new System.EventHandler(this.btnModify_Click);
//
// btnDelete
//
this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDelete.Image = ((System.Drawing.Image)(resources.GetObject("btnDelete.Image")));
this.btnDelete.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnDelete.Location = new System.Drawing.Point(504, 88);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(56, 24);
this.btnDelete.TabIndex = 108;
this.btnDelete.Text = "删除";
this.btnDelete.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// btnAdd
//
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Image = ((System.Drawing.Image)(resources.GetObject("btnAdd.Image")));
this.btnAdd.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAdd.Location = new System.Drawing.Point(504, 56);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(56, 24);
this.btnAdd.TabIndex = 107;
this.btnAdd.Text = "添加";
this.btnAdd.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.textRemark);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.dateTimePicker1);
this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.label12);
this.groupBox2.Controls.Add(this.comboRewardType);
this.groupBox2.Controls.Add(this.textEmployeeID);
this.groupBox2.Location = new System.Drawing.Point(8, 16);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(432, 104);
this.groupBox2.TabIndex = 37;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "奖惩记录";
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 64);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 23);
this.label2.TabIndex = 100;
this.label2.Text = "备注";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -