📄 frmpeoplemanage.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace 人力资源管理系统
{
/// <summary>
/// frmPeopleManage 的摘要说明。
/// </summary>
public class frmPeopleManage : System.Windows.Forms.Form
{
internal System.Data.SqlClient.SqlCommand SqlDeleteCommand1;
internal System.Windows.Forms.ImageList ImageList1;
internal System.Data.SqlClient.SqlCommand SqlSelectCommand1;
internal System.Windows.Forms.DataGrid dgdPeopleInfo;
internal System.Data.SqlClient.SqlCommand SqlInsertCommand1;
internal System.Windows.Forms.ToolBarButton tbbDel;
internal System.Windows.Forms.GroupBox grbPeople;
internal System.Windows.Forms.ComboBox cbbDepCode;
internal System.Windows.Forms.ComboBox cbbSex;
internal System.Windows.Forms.ComboBox cbbNature;
internal System.Windows.Forms.ComboBox cbbCity;
internal System.Windows.Forms.TextBox TextBox17;
internal System.Windows.Forms.TextBox TextBox16;
internal System.Windows.Forms.TextBox TextBox15;
internal System.Windows.Forms.TextBox TextBox14;
internal System.Windows.Forms.TextBox TextBox13;
internal System.Windows.Forms.TextBox TextBox11;
internal System.Windows.Forms.TextBox TextBox10;
internal System.Windows.Forms.TextBox TextBox9;
internal System.Windows.Forms.TextBox TextBox8;
internal System.Windows.Forms.TextBox TextBox7;
internal System.Windows.Forms.TextBox TextBox6;
internal System.Windows.Forms.TextBox TextBox5;
internal System.Windows.Forms.TextBox TextBox4;
internal System.Windows.Forms.TextBox TextBox3;
internal System.Windows.Forms.TextBox TextBox2;
internal System.Windows.Forms.TextBox TextBox1;
internal System.Windows.Forms.Label Label20;
internal System.Windows.Forms.Label Label19;
internal System.Windows.Forms.Label Label18;
internal System.Windows.Forms.Label Label17;
internal System.Windows.Forms.Label Label16;
internal System.Windows.Forms.Label Label15;
internal System.Windows.Forms.Label Label14;
internal System.Windows.Forms.Label Label13;
internal System.Windows.Forms.Label Label12;
internal System.Windows.Forms.Label Label11;
internal System.Windows.Forms.Label Label10;
internal System.Windows.Forms.Label Label9;
internal System.Windows.Forms.Label Label8;
internal System.Windows.Forms.Label Label7;
internal System.Windows.Forms.Label Label6;
internal System.Windows.Forms.Label Label5;
internal System.Windows.Forms.Label Label4;
internal System.Windows.Forms.Label Label3;
internal System.Windows.Forms.Label Label2;
internal System.Windows.Forms.Label Label1;
internal System.Windows.Forms.TextBox TextBox12;
internal System.Data.SqlClient.SqlCommand SqlUpdateCommand1;
internal System.Windows.Forms.ToolBar ToolBar1;
internal System.Windows.Forms.ToolBarButton tbbSave;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand2;
private System.Data.SqlClient.SqlCommand sqlInsertCommand2;
private System.Data.SqlClient.SqlCommand sqlUpdateCommand2;
private System.Data.SqlClient.SqlCommand sqlDeleteCommand2;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private 人力资源管理系统.DataSet1 dataSet11;
private System.ComponentModel.IContainer components;
// added parameters
private int iCurrentLine = -1;
// added method
private void SetDataGrid()
{
sqlConnection1.ConnectionString = DataBase.sConn;
sqlDataAdapter1.Fill( dataSet11 );
DataTable dt = dataSet11.Tables[ "职员基本信息表" ];
// 定义一个DataGrid样式
DataGridTableStyle ts = new DataGridTableStyle();
DataGridTextBoxColumn aCol;
int numCols = dt.Columns.Count;
for ( int i = 1; i < numCols; i ++ )
{
aCol = new DataGridTextBoxColumn();
aCol.MappingName = dt.Columns[ i ].ColumnName;
aCol.HeaderText = dt.Columns[ i ].ColumnName;
aCol.NullText = "";
if ( i == 3 || i == 5 )
{
aCol.Width = 40;
}
ts.GridColumnStyles.Add( aCol );
}
ts.AlternatingBackColor = Color.LightGray;
ts.AllowSorting = false;
ts.MappingName = dt.TableName;
dgdPeopleInfo.TableStyles.Add( ts );
DataView dv = dt.DefaultView;
// dv.AllowNew = false;
dgdPeopleInfo.DataSource = dt.DefaultView;
}
public frmPeopleManage()
{
//
// 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.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmPeopleManage));
this.SqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.ImageList1 = new System.Windows.Forms.ImageList(this.components);
this.SqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.dgdPeopleInfo = new System.Windows.Forms.DataGrid();
this.SqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.tbbDel = new System.Windows.Forms.ToolBarButton();
this.grbPeople = new System.Windows.Forms.GroupBox();
this.cbbDepCode = new System.Windows.Forms.ComboBox();
this.dataSet11 = new 人力资源管理系统.DataSet1();
this.cbbSex = new System.Windows.Forms.ComboBox();
this.cbbNature = new System.Windows.Forms.ComboBox();
this.cbbCity = new System.Windows.Forms.ComboBox();
this.TextBox17 = new System.Windows.Forms.TextBox();
this.TextBox16 = new System.Windows.Forms.TextBox();
this.TextBox15 = new System.Windows.Forms.TextBox();
this.TextBox14 = new System.Windows.Forms.TextBox();
this.TextBox13 = new System.Windows.Forms.TextBox();
this.TextBox11 = new System.Windows.Forms.TextBox();
this.TextBox10 = new System.Windows.Forms.TextBox();
this.TextBox9 = new System.Windows.Forms.TextBox();
this.TextBox8 = new System.Windows.Forms.TextBox();
this.TextBox7 = new System.Windows.Forms.TextBox();
this.TextBox6 = new System.Windows.Forms.TextBox();
this.TextBox5 = new System.Windows.Forms.TextBox();
this.TextBox4 = new System.Windows.Forms.TextBox();
this.TextBox3 = new System.Windows.Forms.TextBox();
this.TextBox2 = new System.Windows.Forms.TextBox();
this.TextBox1 = new System.Windows.Forms.TextBox();
this.Label20 = new System.Windows.Forms.Label();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -