📄 employeemanageform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data;
using SupDataBase;
namespace WindowsApplication1
{
/// <summary>
/// EmployeeManageForm 的摘要说明。
/// </summary>
public class EmployeeManageForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox m_NameText;
private System.Windows.Forms.ComboBox m_SexCombo;
private System.Windows.Forms.TextBox m_PostText;
private System.Windows.Forms.DataGrid m_EmployeeDataGrid;
private System.Windows.Forms.Button m_AddButton;
private System.Windows.Forms.Button m_ModifyButton;
private System.Windows.Forms.Button m_DeleteButton;
private System.Windows.Forms.DataGridTableStyle m_EmployeeGridStyle;
private System.Windows.Forms.DataGridTextBoxColumn m_NameColumn;
private System.Windows.Forms.DataGridTextBoxColumn m_SexColumn;
private System.Windows.Forms.DataGridTextBoxColumn m_WorkyearColumn;
private System.Windows.Forms.DataGridTextBoxColumn m_PostColumn;
private System.Windows.Forms.DataGridTextBoxColumn m_PriorityColumn;
private System.Windows.Forms.ComboBox m_PriorityCombo;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox m_PasswordText;
private System.Windows.Forms.DataGridTextBoxColumn m_PasswordColumn;
private System.Windows.Forms.Button m_CancelButton;
private System.Windows.Forms.Button m_OKButton;
private System.Data.SqlClient.SqlConnection m_Connection;
private System.Data.SqlClient.SqlDataAdapter m_sqlDataAdapter;
private int previousRowNumber;
private System.Windows.Forms.TextBox m_IDText;
private ArrayList employeeList;
private System.Windows.Forms.DateTimePicker m_BirthdayDateTime;
private System.Windows.Forms.DateTimePicker m_StartWorkDateTime;
private System.Windows.Forms.DataGridTextBoxColumn m_BirthdayColumn;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox m_UserText;
private System.Windows.Forms.DataGridTextBoxColumn m_UserNameColumn;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public EmployeeManageForm()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// 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()
{
this.m_EmployeeDataGrid = new System.Windows.Forms.DataGrid();
this.m_EmployeeGridStyle = new System.Windows.Forms.DataGridTableStyle();
this.m_NameColumn = new System.Windows.Forms.DataGridTextBoxColumn();
this.m_SexColumn = new System.Windows.Forms.DataGridTextBoxColumn();
this.m_BirthdayColumn = new System.Windows.Forms.DataGridTextBoxColumn();
this.m_WorkyearColumn = new System.Windows.Forms.DataGridTextBoxColumn();
this.m_UserNameColumn = new System.Windows.Forms.DataGridTextBoxColumn();
this.m_PostColumn = new System.Windows.Forms.DataGridTextBoxColumn();
this.m_PriorityColumn = new System.Windows.Forms.DataGridTextBoxColumn();
this.m_PasswordColumn = new System.Windows.Forms.DataGridTextBoxColumn();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.m_NameText = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.m_PostText = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.m_SexCombo = new System.Windows.Forms.ComboBox();
this.m_AddButton = new System.Windows.Forms.Button();
this.m_ModifyButton = new System.Windows.Forms.Button();
this.m_DeleteButton = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.m_UserText = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.m_StartWorkDateTime = new System.Windows.Forms.DateTimePicker();
this.m_BirthdayDateTime = new System.Windows.Forms.DateTimePicker();
this.m_IDText = new System.Windows.Forms.TextBox();
this.m_PasswordText = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.m_PriorityCombo = new System.Windows.Forms.ComboBox();
this.m_CancelButton = new System.Windows.Forms.Button();
this.m_OKButton = new System.Windows.Forms.Button();
this.m_Connection=DBUtil.GetConnection();
this.m_sqlDataAdapter = new System.Data.SqlClient.SqlDataAdapter();
((System.ComponentModel.ISupportInitialize)(this.m_EmployeeDataGrid)).BeginInit();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// m_EmployeeDataGrid
//
this.m_EmployeeDataGrid.DataMember = "";
this.m_EmployeeDataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.m_EmployeeDataGrid.Location = new System.Drawing.Point(0, 24);
this.m_EmployeeDataGrid.Name = "m_EmployeeDataGrid";
this.m_EmployeeDataGrid.Size = new System.Drawing.Size(816, 176);
this.m_EmployeeDataGrid.TabIndex = 0;
this.m_EmployeeDataGrid.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] {
this.m_EmployeeGridStyle});
this.m_EmployeeDataGrid.CurrentCellChanged += new System.EventHandler(this.m_EmployeeDataGrid_CurrentCellChanged);
//
// m_EmployeeGridStyle
//
this.m_EmployeeGridStyle.DataGrid = this.m_EmployeeDataGrid;
this.m_EmployeeGridStyle.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] {
this.m_NameColumn,
this.m_SexColumn,
this.m_BirthdayColumn,
this.m_WorkyearColumn,
this.m_UserNameColumn,
this.m_PostColumn,
this.m_PriorityColumn,
this.m_PasswordColumn});
this.m_EmployeeGridStyle.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.m_EmployeeGridStyle.MappingName = "";
//
// m_NameColumn
//
this.m_NameColumn.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.m_NameColumn.Format = "";
this.m_NameColumn.FormatInfo = null;
this.m_NameColumn.HeaderText = "姓名";
this.m_NameColumn.MappingName = "name";
this.m_NameColumn.NullText = "";
this.m_NameColumn.ReadOnly = true;
this.m_NameColumn.Width = 75;
//
// m_SexColumn
//
this.m_SexColumn.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.m_SexColumn.Format = "";
this.m_SexColumn.FormatInfo = null;
this.m_SexColumn.HeaderText = "性别";
this.m_SexColumn.MappingName = "sex";
this.m_SexColumn.NullText = "";
this.m_SexColumn.ReadOnly = true;
this.m_SexColumn.Width = 75;
//
// m_BirthdayColumn
//
this.m_BirthdayColumn.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.m_BirthdayColumn.Format = "";
this.m_BirthdayColumn.FormatInfo = null;
this.m_BirthdayColumn.HeaderText = "出生日期";
this.m_BirthdayColumn.MappingName = "age";
this.m_BirthdayColumn.NullText = "";
this.m_BirthdayColumn.ReadOnly = true;
this.m_BirthdayColumn.Width = 75;
//
// m_WorkyearColumn
//
this.m_WorkyearColumn.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.m_WorkyearColumn.Format = "";
this.m_WorkyearColumn.FormatInfo = null;
this.m_WorkyearColumn.HeaderText = "开始工作时间";
this.m_WorkyearColumn.MappingName = "workyear";
this.m_WorkyearColumn.NullText = "";
this.m_WorkyearColumn.ReadOnly = true;
this.m_WorkyearColumn.Width = 75;
//
// m_UserNameColumn
//
this.m_UserNameColumn.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.m_UserNameColumn.Format = "";
this.m_UserNameColumn.FormatInfo = null;
this.m_UserNameColumn.HeaderText = "用户名";
this.m_UserNameColumn.MappingName = "username";
this.m_UserNameColumn.NullText = "";
this.m_UserNameColumn.ReadOnly = true;
this.m_UserNameColumn.Width = 75;
//
// m_PostColumn
//
this.m_PostColumn.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.m_PostColumn.Format = "";
this.m_PostColumn.FormatInfo = null;
this.m_PostColumn.HeaderText = "职称";
this.m_PostColumn.MappingName = "post";
this.m_PostColumn.NullText = "";
this.m_PostColumn.ReadOnly = true;
this.m_PostColumn.Width = 75;
//
// m_PriorityColumn
//
this.m_PriorityColumn.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.m_PriorityColumn.Format = "";
this.m_PriorityColumn.FormatInfo = null;
this.m_PriorityColumn.HeaderText = "权限";
this.m_PriorityColumn.MappingName = "priority";
this.m_PriorityColumn.NullText = "";
this.m_PriorityColumn.ReadOnly = true;
this.m_PriorityColumn.Width = 75;
//
// m_PasswordColumn
//
this.m_PasswordColumn.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.m_PasswordColumn.Format = "";
this.m_PasswordColumn.FormatInfo = null;
this.m_PasswordColumn.HeaderText = "密码";
this.m_PasswordColumn.MappingName = "password";
this.m_PasswordColumn.NullText = "";
this.m_PasswordColumn.ReadOnly = true;
this.m_PasswordColumn.Width = 75;
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(816, 24);
this.label1.TabIndex = 0;
this.label1.Text = "员工列表:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label2
//
this.label2.Location = new System.Drawing.Point(40, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(48, 24);
this.label2.TabIndex = 2;
this.label2.Text = "姓名:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// m_NameText
//
this.m_NameText.Location = new System.Drawing.Point(96, 24);
this.m_NameText.Name = "m_NameText";
this.m_NameText.ReadOnly = true;
this.m_NameText.Size = new System.Drawing.Size(88, 21);
this.m_NameText.TabIndex = 0;
this.m_NameText.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(200, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(48, 24);
this.label3.TabIndex = 4;
this.label3.Text = "性别:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label4
//
this.label4.Location = new System.Drawing.Point(360, 24);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(72, 24);
this.label4.TabIndex = 6;
this.label4.Text = "出生日期:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label5
//
this.label5.Location = new System.Drawing.Point(568, 24);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(96, 24);
this.label5.TabIndex = 8;
this.label5.Text = "开始工作时间:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// m_PostText
//
this.m_PostText.Location = new System.Drawing.Point(256, 56);
this.m_PostText.Name = "m_PostText";
this.m_PostText.ReadOnly = true;
this.m_PostText.Size = new System.Drawing.Size(88, 21);
this.m_PostText.TabIndex = 5;
this.m_PostText.Text = "";
//
// label6
//
this.label6.Location = new System.Drawing.Point(200, 56);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(48, 24);
this.label6.TabIndex = 10;
this.label6.Text = "职称:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label7
//
this.label7.Location = new System.Drawing.Point(384, 56);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(48, 24);
this.label7.TabIndex = 12;
this.label7.Text = "权限:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// m_SexCombo
//
this.m_SexCombo.AllowDrop = true;
this.m_SexCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.m_SexCombo.Enabled = false;
this.m_SexCombo.Items.AddRange(new object[] {
"男",
"女"});
this.m_SexCombo.Location = new System.Drawing.Point(256, 24);
this.m_SexCombo.Name = "m_SexCombo";
this.m_SexCombo.Size = new System.Drawing.Size(88, 20);
this.m_SexCombo.TabIndex = 1;
//
// m_AddButton
//
this.m_AddButton.Location = new System.Drawing.Point(88, 296);
this.m_AddButton.Name = "m_AddButton";
this.m_AddButton.Size = new System.Drawing.Size(80, 24);
this.m_AddButton.TabIndex = 1;
this.m_AddButton.Text = "添加";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -