⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 empinfoform.cs

📁 c#编写的人事管理系统源码 写得不错 值得收藏
💻 CS
📖 第 1 页 / 共 5 页
字号:
			this.comboBox2.Size = new System.Drawing.Size(100, 20);
			this.comboBox2.TabIndex = 7;
			this.comboBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox2_KeyPress);
			// 
			// comboBox1
			// 
			this.comboBox1.Location = new System.Drawing.Point(472, 16);
			this.comboBox1.Name = "comboBox1";
			this.comboBox1.Size = new System.Drawing.Size(100, 20);
			this.comboBox1.TabIndex = 6;
			this.comboBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBox1_KeyPress);
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(600, 24);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(56, 16);
			this.label4.TabIndex = 5;
			this.label4.Text = "所任职务";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(408, 24);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(56, 16);
			this.label3.TabIndex = 4;
			this.label3.Text = "所在部门";
			// 
			// name_txt
			// 
			this.name_txt.Location = new System.Drawing.Point(280, 16);
			this.name_txt.Name = "name_txt";
			this.name_txt.TabIndex = 3;
			this.name_txt.Text = "";
			this.name_txt.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.name_txt_KeyPress);
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(216, 24);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(56, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "员工姓名";
			// 
			// ID_txt
			// 
			this.ID_txt.Location = new System.Drawing.Point(88, 16);
			this.ID_txt.Name = "ID_txt";
			this.ID_txt.TabIndex = 1;
			this.ID_txt.Text = "";
			this.ID_txt.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.ID_txt_KeyPress);
			this.ID_txt.TextChanged += new System.EventHandler(this.ID_txt_TextChanged);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(24, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(56, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "员工编号";
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(688, 56);
			this.button2.Name = "button2";
			this.button2.TabIndex = 14;
			this.button2.Text = "取消";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// pageSetupDialog1
			// 
			this.pageSetupDialog1.Document = this.printDocument1;
			this.pageSetupDialog1.ShowHelp = true;
			// 
			// printDocument1
			// 
			this.printDocument1.OriginAtMargins = true;
			this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
			// 
			// printPreviewDialog1
			// 
			this.printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(0, 0);
			this.printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
			this.printPreviewDialog1.ClientSize = new System.Drawing.Size(400, 300);
			this.printPreviewDialog1.Document = this.printDocument1;
			this.printPreviewDialog1.Enabled = true;
			this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
			this.printPreviewDialog1.Location = new System.Drawing.Point(569, 9);
			this.printPreviewDialog1.MinimumSize = new System.Drawing.Size(375, 250);
			this.printPreviewDialog1.Name = "printPreviewDialog1";
			this.printPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty;
			this.printPreviewDialog1.UseAntiAlias = true;
			this.printPreviewDialog1.Visible = false;
			// 
			// printDialog1
			// 
			this.printDialog1.AllowSelection = true;
			this.printDialog1.AllowSomePages = true;
			this.printDialog1.Document = this.printDocument1;
			this.printDialog1.ShowHelp = true;
			// 
			// printPreviewDialog2
			// 
			this.printPreviewDialog2.AutoScrollMargin = new System.Drawing.Size(0, 0);
			this.printPreviewDialog2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
			this.printPreviewDialog2.ClientSize = new System.Drawing.Size(400, 300);
			this.printPreviewDialog2.Document = this.printDocument2;
			this.printPreviewDialog2.Enabled = true;
			this.printPreviewDialog2.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog2.Icon")));
			this.printPreviewDialog2.Location = new System.Drawing.Point(17, 54);
			this.printPreviewDialog2.MinimumSize = new System.Drawing.Size(375, 250);
			this.printPreviewDialog2.Name = "printPreviewDialog2";
			this.printPreviewDialog2.TransparencyKey = System.Drawing.Color.Empty;
			this.printPreviewDialog2.UseAntiAlias = true;
			this.printPreviewDialog2.Visible = false;
			// 
			// printDocument2
			// 
			this.printDocument2.OriginAtMargins = true;
			this.printDocument2.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument2_PrintPage);
			// 
			// printDialog2
			// 
			this.printDialog2.AllowSelection = true;
			this.printDialog2.AllowSomePages = true;
			this.printDialog2.Document = this.printDocument2;
			this.printDialog2.ShowHelp = true;
			// 
			// pageSetupDialog2
			// 
			this.pageSetupDialog2.Document = this.printDocument2;
			this.pageSetupDialog2.ShowHelp = true;
			// 
			// empInfoForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(936, 461);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.treeView1);
			this.Controls.Add(this.dataGrid1);
			this.Controls.Add(this.toolBar1);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "empInfoForm";
			this.Text = "人员档案";
			this.Load += new System.EventHandler(this.empInfoForm_Load);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		#region  窗体出现就对DataGrid进行数据绑定
		private void empInfoForm_Load(object sender, System.EventArgs e)
		{
			DBDataGrid();
			DBddl();
			switch(Form1.f1.power)
			{
				case "系统管理员":
				{
					this.toolBarButton5.Enabled = true;
					this.toolBarButton6.Enabled = true;
					this.toolBarButton7.Enabled = true;
					break;
				}
				case "管理员":
				{
					this.toolBarButton5.Enabled = true;
					this.toolBarButton6.Enabled = true;
					this.toolBarButton7.Enabled = true;
					break;
				}
				case "一般用户":
				{
					this.toolBarButton5.Enabled = false;
					this.toolBarButton6.Enabled = false;
					this.toolBarButton7.Enabled = false;
					break;
				}
				default :
				{
					this.toolBarButton5.Enabled = false;
					this.toolBarButton6.Enabled = false;
					this.toolBarButton7.Enabled = false;
					break;
				}
			}
		}
		#endregion

		#region 填充下拉列表
		private void DBddl()
		{
		    string s1 = "select * from SectionInfo";
			Base bb = new Base();
			DataTable dt1 = bb.ExeSQLdt(s1);
			for(int i =0 ; i < dt1.Rows.Count;i ++)
			{
			    this.comboBox1.Items.Add(dt1.Rows[i]["sName"].ToString());
			}

			string s2 = "select * from JobInfo";
			DataTable dt2 = bb.ExeSQLdt(s2);
			for(int j = 0 ; j < dt2.Rows.Count; j ++)
			{
			    this.comboBox2.Items.Add(dt2.Rows[j]["JName"].ToString());
			}

			string s3 = "select * from Title";
			DataTable dt3 = bb.ExeSQLdt(s3);
			for(int k=0;k<dt3.Rows.Count ; k ++)
			{
			    this.comboBox3.Items.Add(dt3.Rows[k]["tName"].ToString());
			}
		}
		#endregion

		#region  DataGrid的数据绑定
		public void DBDataGrid()
		{
			string str = "select distinct EmployInfo.eId as 员工编号,EmployInfo.eName as 员工姓名,EmployInfo.eSex as 性别,RaceInfo.rName as 民族,EmployInfo.eMarriage as 婚姻状况,";
			str += "EmployInfo.eParty as 党派,EmployInfo.eBirth as 出生日期,EmployInfo.eNumber as 身份证号,EmployInfo.ePlace as 籍贯,EmployInfo.ePhone as 联系电话,EmployInfo.eAddress as 联系地址,";
			str += "EmployInfo.eEdu as 学历,EmployInfo.ePro as 专业,EmployInfo.eDegree as 学位,EmployInfo.eSchool as 毕业学校,EmployInfo.eDate as 毕业时间,";
			str += "EmployInfo.eEmpTime as 聘用时间,EmployInfo.eEmpType as 聘用方式,EmployInfo.eEmpDataSource as 聘用来源,EmployInfo.eApp as 员工状态,";
			str += "SectionInfo.sName as 所在部门,JobInfo.JName as 所任职务,Title.tName as 所获职称,EndowmentInfo.endId,EndowmentInfo.enId as 养老保险号,";
			str += "MedicalInfo.meId,MedicalInfo.mId as 医疗保险号,WagesInfo.waId,WagesInfo.Id as 工资号 ";
			str += "from EmployInfo,RaceInfo,SectionInfo,JobInfo,Title,EndowmentInfo,MedicalInfo,WagesInfo ";
			str += "where EmployInfo.rId=RaceInfo.rId and EmployInfo.sId=SectionInfo.sId and JobInfo.jId=EmployInfo.jId and Title.tId=EmployInfo.tId and ";
			str += "EndowmentInfo.endId=EmployInfo.endId and MedicalInfo.meId=EmployInfo.meId and WagesInfo.waId=EmployInfo.waId order by eId asc";
			Base bb = new Base();
			this.table = bb.ExeSQLdt(str);
			this.dataGrid1.DataSource = table.DefaultView;
			this.cm = (CurrencyManager)this.BindingContext[this.table];
			File.DataGridStyle(this.table,1,this.dataGrid1);
		}
		#endregion

        #region 工具栏按钮事件
		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			switch(e.Button.ToolTipText)
			{
				case "首记录":
				{
					if(cm.Position != 0)
					{
						this.dataGrid1.UnSelect(cm.Position);
						cm.Position = 0;
						this.dataGrid1.Select(cm.Position);
						this.dataGrid1.CurrentRowIndex = cm.Position;
					}
					break;
				}
				case "上记录":
				{
					if(cm.Position > 0)
					{
						this.dataGrid1.UnSelect(cm.Position );
						cm.Position -= 1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -