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

📄 empinfoform.cs

📁 c#编写的人事管理系统源码 写得不错 值得收藏
💻 CS
📖 第 1 页 / 共 5 页
字号:
						this.dataGrid1.Select(cm.Position);
						this.dataGrid1.CurrentRowIndex = cm.Position;
					}
					break;
				}
				case "下记录":
				{
					if(cm.Position < cm.Count - 1)
					{
						this.dataGrid1.UnSelect(cm.Position );
						cm.Position += 1;
						this.dataGrid1.Select(cm.Position);
						this.dataGrid1.CurrentRowIndex = cm.Position;
					}
					break;
				}
				case "尾记录":
				{
					if(cm.Position != cm.Count - 1)
					{
						this.dataGrid1.UnSelect(cm.Position);
						cm.Position = cm.Count - 1;
						this.dataGrid1.Select(cm.Count - 1);
						this.dataGrid1.CurrentRowIndex = cm.Position;
					}
					break;
				}
				case "添加":
				{
					this.insert(sender,e);
					break;
				}
				case "修改":
				{
					this.updata(sender,e);
					break;
				}
				case "删除":
				{
					this.delete(sender,e);
					break;
				}
				case "退出":
				{
					this.close(sender,e);
					break;
				}
				case "列选择":
				{
					this.colSelect(sender,e);
				    break;
				}
				case "查找":
				{
					this.Search(sender,e);
				    break;
				}
				case "打印":
				{
				    break;
				}
			}
		}
		#endregion

		#region 工具栏上的事件方法
		//添加
		private void insert(object sender, System.EventArgs e)
		{
			empInfoForm.empID = "insert";
			this.Enabled = false;
			if(mainForm.mf.CheckForm("AddForm") == true)
			{
				return;
			}
			else
			{
				AddForm af =new AddForm();
				af.MdiParent = mainForm.mf;
				af.Show();
			}
		}

		//修改
		private void updata(object sender, System.EventArgs e)
		{
		    empInfoForm.empID = "update";
			this.Enabled = false;
			empInfoForm.eif.ID = this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString();
			if(mainForm.mf.CheckForm("AddForm") == true)
			{
				return;
			}
			else
			{
				AddForm af =new AddForm();
				af.MdiParent = mainForm.mf;
				af.Show();
			}

		}

		//删除
		private void delete(object sender, System.EventArgs e)
		{
		    DialogResult result = MessageBox.Show("是否删除此记录?","提示!",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
			if(result == DialogResult.Yes)
			{
			    string [] delstr = new string[12];
				delstr[0] = "delete from EmployInfo where eId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				delstr[1] = "delete from EndowmentInfo where endId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				delstr[2] = "delete from HolidayInfo where hId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				delstr[3] = "delete from MedicalInfo where meId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				delstr[4] = "delete from Photo where phId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				delstr[5] = "delete from PpInfo where pId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				delstr[6] = "delete from SocietyInfo where seId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				delstr[7] = "delete from TitleInfo where tiId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				delstr[8] = "delete from TrainInfo where trId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				delstr[9] = "delete from TransferInfo where traId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				delstr[10] = "delete from WagesInfo where waId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				delstr[11] = "delete from WorkInfo where wId=" + int.Parse(this.dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
				Base bb = new Base();
				bb.ExeSQLs(delstr);
				MessageBox.Show("删除成功!");
			}
			if(result == DialogResult.No)
			{
			    return ;
			}
			this.DBDataGrid();
			
		}

		//退出
		private void close(object sender, System.EventArgs e)
		{
		    this.Close();
		}

		//查找
		private void Search(object sender, System.EventArgs e)
		{
			this.groupBox1.Visible = true;
			this.dataGrid1.Dock = DockStyle.None;
			this.dataGrid1.Location = new Point(128,128);
			this.dataGrid1.Size = new Size(808,328);
		}

		//列选择
		private void colSelect(object sender, System.EventArgs e)
		{ 
			if(mainForm.mf.CheckForm("ColselectForm") == true)
			{
				return;
			}
			else
			{
				ColselectForm cf =new ColselectForm();
				cf.MdiParent = mainForm.mf;
				cf.Show();
			}
		}
		#endregion

        #region 双击一行出现该行的具体信息
		private void dataGrid1_DoubleClick(object sender, System.EventArgs e)
		{
			this.cm.Position = this.dataGrid1.CurrentCell.RowNumber;
			this.dataGrid1.CurrentRowIndex = this.cm.Position;
			if(mainForm.mf.CheckForm("MemberForm") == true)
			{
				return;
			}
			else
			{
				MemberForm mbf =new MemberForm();
				mbf.MdiParent = mainForm.mf;
				mbf.Show();
			}
		}
		#endregion

		#region 右键快捷菜单事件方法
		private void contextMenu1_Popup(object sender, System.EventArgs e)
		{
			if(this.contextMenu1.SourceControl == this.dataGrid1)
			{
				this.contextMenu1.MenuItems.Clear();
			    this.contextMenu1.MenuItems.Add("添加记录",new EventHandler(this.insert));
				this.contextMenu1.MenuItems.Add("修改记录",new EventHandler(this.updata));
				this.contextMenu1.MenuItems.Add("删除记录",new EventHandler(this.delete));
				this.contextMenu1.MenuItems.Add("-");
				this.contextMenu1.MenuItems.Add("查看",new EventHandler(this.dataGrid1_DoubleClick));
				this.contextMenu1.MenuItems.Add("-");
				this.contextMenu1.MenuItems.Add("查找",new EventHandler(this.Search));
				this.contextMenu1.MenuItems.Add("-");
				this.contextMenu1.MenuItems.Add("打印");
				this.contextMenu1.MenuItems[8].MenuItems.Add("标准样式一");
				this.contextMenu1.MenuItems[8].MenuItems[0].MenuItems.Add("页面设置",new EventHandler(this.menuItem4_Click));
				this.contextMenu1.MenuItems[8].MenuItems[0].MenuItems.Add("打印设置",new EventHandler(this.menuItem5_Click));
				this.contextMenu1.MenuItems[8].MenuItems[0].MenuItems.Add("打印",new EventHandler(this.menuItem6_Click));
				this.contextMenu1.MenuItems[8].MenuItems.Add("标准样式二");
				this.contextMenu1.MenuItems[8].MenuItems[1].MenuItems.Add("页面设置",new EventHandler(this.menuItem7_Click));
				this.contextMenu1.MenuItems[8].MenuItems[1].MenuItems.Add("打印设置",new EventHandler(this.menuItem8_Click));
				this.contextMenu1.MenuItems[8].MenuItems[1].MenuItems.Add("打印",new EventHandler(this.menuItem9_Click));
				this.contextMenu1.MenuItems[8].MenuItems.Add("自定义样式",new EventHandler(this.menuItem3_Click));
				this.contextMenu1.MenuItems.Add("-");
				this.contextMenu1.MenuItems.Add("列选择",new EventHandler(this.colSelect));
				this.contextMenu1.MenuItems.Add("-");
				this.contextMenu1.MenuItems.Add("退出",new EventHandler(this.close));
			}
		}
		#endregion

		#region  选择不同的节点,显示不同的员工信息
		private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
		{
			switch(e.Node.Text)
			{
				case "全部":
				{
					this.DBDataGrid();
				    break;
				}
					#region 党派为群众的员工档案
				case "群众":
				{
					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 and EmployInfo.eParty='" + "群众'";;
					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);
				    break;
				}
					#endregion

					#region 党派为团员的员工档案
				case "团员":
				{
					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 and EmployInfo.eParty='" + "团员'";;
					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);

⌨️ 快捷键说明

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