📄 check.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>
/// Check 的摘要说明。
/// </summary>
public class Check : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textEmployeeID1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.DataGrid dataGrid3;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.DateTimePicker dateTimePicker2;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.Button btnCheckIn;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.Button btnCheckOut;
private System.Windows.Forms.DataGrid dataGrid2;
private System.Windows.Forms.DateTimePicker dateTimePicker4;
private System.Windows.Forms.DateTimePicker dateTimePicker3;
private System.Windows.Forms.ComboBox comboCheckInType;
private System.Windows.Forms.ComboBox comboCheckOutType;
private System.Windows.Forms.TextBox textEmployeeID2;
private System.Windows.Forms.TextBox textEmployeeID3;
private System.Windows.Forms.TextBox textEmployeeID4;
private System.Windows.Forms.Button btnCheckInExport;
private System.Windows.Forms.Button btnCheckInSearch;
private System.Windows.Forms.Button btnCheckInCancel;
private System.Windows.Forms.Button btnCheckOutExport;
private System.Windows.Forms.Button btnCheckOutSearch;
private System.Windows.Forms.Button btnCheckOutCancel;
private string selectStrViewCheckIn;
private string selectStrViewCheckOut;
private string commandStr;
private string connectionStr;
private OleDbConnection Connection1=null;
private OleDbCommand Command1=null;
private OleDbDataAdapter dataAdapterViewCheckIn=null;
private OleDbDataAdapter dataAdapterViewCheckOut=null;
private DataSet DataSetViewCheckIn=new DataSet();
private DataSet DataSetViewCheckOut=new DataSet();
DataView CheckInDataView=new DataView();
DataView CheckOutDataView=new DataView();
DataTable CheckInTable=new DataTable("CheckInRecord");
DataTable CheckOutTable=new DataTable("CheckOutRecord");
private OleDbDataReader DataReader1=null;
private string [] myData={"职工号","姓名","部门","类型","日期"};
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.DataGridTableStyle dataGridTableStyle2;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn4;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn5;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn6;
private System.Windows.Forms.DataGrid dataGrid4;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle3;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn7;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn8;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn9;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn10;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn11;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle4;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn12;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn13;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn14;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn15;
private System.Windows.Forms.DataGridTextBoxColumn dataGridTextBoxColumn16;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.ComboBox comboOutDepartment;
private System.Windows.Forms.ComboBox comboInDepartment;
private System.Windows.Forms.Label label8;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Check()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
this.connectionStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +Application.StartupPath + "\\ManPowerManage.mdb";
this.selectStrViewCheckIn="select * from View_CheckInRecord";
this.selectStrViewCheckOut="select * from View_CheckOutRecord";
this.Connection1=new OleDbConnection(this.connectionStr);
this.Command1=new OleDbCommand();
this.dataAdapterViewCheckIn=new OleDbDataAdapter(this.selectStrViewCheckIn,this.Connection1);
this.dataAdapterViewCheckOut=new OleDbDataAdapter(this.selectStrViewCheckOut,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 );
}
private void Check_Load(object sender, System.EventArgs e)
{
try
{
this.Connection1.Open();
this.dataAdapterViewCheckIn.Fill(this.DataSetViewCheckIn,"View_CheckInRecord");
this.dataAdapterViewCheckOut.Fill(this.DataSetViewCheckOut,"View_CheckOutRecord");
}
catch(Exception E)
{
MessageBox.Show(E.ToString());
}
finally
{
this.Connection1.Close();
}
this.Table_Fill();
this.DataSet_Fill();
this.Combo_Fill();
}
private void btnExit_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void DataSet_Fill()
{
this.dataGrid1.DataSource=this.CheckInTable;
this.dataGrid2.DataSource=this.CheckOutTable;
}
private void Table_Fill()
{
DataColumn EmployeeID=new DataColumn("EmployeeID");
EmployeeID.DataType=typeof(System.Char);
DataColumn CheckType=new DataColumn("CheckType",typeof(System.Char));
DataColumn Date=new DataColumn("Date",typeof(System.DateTime));
this.CheckInTable.Columns.Add("EmployeeID");
this.CheckInTable.Columns.Add("CheckType");
this.CheckInTable.Columns.Add("Date");
this.CheckOutTable.Columns.Add("EmployeeID");
this.CheckOutTable.Columns.Add("CheckType");
this.CheckOutTable.Columns.Add("Date");
}
private void Combo_Fill()
{
try
{
this.Connection1.Open();
this.commandStr="select * from Department";
this.Command1.CommandText=this.commandStr;
this.DataReader1=this.Command1.ExecuteReader();
while(this.DataReader1.Read())
{
this.comboInDepartment.Items.Add(this.DataReader1[1].ToString());
this.comboOutDepartment.Items.Add(this.DataReader1[1].ToString());
}
this.Connection1.Close();
}
catch(Exception E)
{
MessageBox.Show(E.ToString());
}
finally
{
this.Connection1.Close();
}
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Check));
this.btnExit = new System.Windows.Forms.Button();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnCheckIn = new System.Windows.Forms.Button();
this.textEmployeeID1 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
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.tabPage2 = new System.Windows.Forms.TabPage();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.btnCheckOut = new System.Windows.Forms.Button();
this.textEmployeeID2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
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.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.dataGrid3 = new System.Windows.Forms.DataGrid();
this.dataGridTableStyle3 = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn7 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn8 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn9 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn10 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn11 = new System.Windows.Forms.DataGridTextBoxColumn();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.comboInDepartment = new System.Windows.Forms.ComboBox();
this.label8 = new System.Windows.Forms.Label();
this.btnCheckInExport = new System.Windows.Forms.Button();
this.btnCheckInSearch = new System.Windows.Forms.Button();
this.btnCheckInCancel = new System.Windows.Forms.Button();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.dateTimePicker4 = new System.Windows.Forms.DateTimePicker();
this.dateTimePicker3 = new System.Windows.Forms.DateTimePicker();
this.comboCheckInType = new System.Windows.Forms.ComboBox();
this.label11 = new System.Windows.Forms.Label();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.textEmployeeID3 = new System.Windows.Forms.TextBox();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.dataGrid4 = new System.Windows.Forms.DataGrid();
this.dataGridTableStyle4 = new System.Windows.Forms.DataGridTableStyle();
this.dataGridTextBoxColumn12 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn13 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn14 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn15 = new System.Windows.Forms.DataGridTextBoxColumn();
this.dataGridTextBoxColumn16 = new System.Windows.Forms.DataGridTextBoxColumn();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.comboOutDepartment = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.btnCheckOutExport = new System.Windows.Forms.Button();
this.btnCheckOutSearch = new System.Windows.Forms.Button();
this.btnCheckOutCancel = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();
this.comboCheckOutType = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.textEmployeeID4 = new System.Windows.Forms.TextBox();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.tabPage2.SuspendLayout();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid3)).BeginInit();
this.groupBox2.SuspendLayout();
this.tabPage4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid4)).BeginInit();
this.groupBox4.SuspendLayout();
this.SuspendLayout();
//
// btnExit
//
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Image = ((System.Drawing.Image)(resources.GetObject("btnExit.Image")));
this.btnExit.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnExit.Location = new System.Drawing.Point(696, 432);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(56, 24);
this.btnExit.TabIndex = 93;
this.btnExit.Text = "退出";
this.btnExit.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// tabPage1
//
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.ForeColor = System.Drawing.SystemColors.Desktop;
this.tabPage1.Location = new System.Drawing.Point(4, 21);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Size = new System.Drawing.Size(648, 431);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "签到记录";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnCheckIn);
this.groupBox1.Controls.Add(this.textEmployeeID1);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.dataGrid1);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(576, 376);
this.groupBox1.TabIndex = 18;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "上班签到";
//
// btnCheckIn
//
this.btnCheckIn.Location = new System.Drawing.Point(192, 32);
this.btnCheckIn.Name = "btnCheckIn";
this.btnCheckIn.TabIndex = 14;
this.btnCheckIn.Text = "签到";
this.btnCheckIn.Click += new System.EventHandler(this.btnCheckIn_Click);
//
// textEmployeeID1
//
this.textEmployeeID1.Location = new System.Drawing.Point(72, 32);
this.textEmployeeID1.Name = "textEmployeeID1";
this.textEmployeeID1.Size = new System.Drawing.Size(80, 21);
this.textEmployeeID1.TabIndex = 9;
this.textEmployeeID1.Text = "";
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 32);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(48, 23);
this.label6.TabIndex = 10;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -