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

📄 memberform.cs

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

		#region  工具栏具体的事件方法
		//添加
		private void insert(object sender, System.EventArgs e)
		{
		    this.Enabled = false;
			MemberForm.mem.memberId = "insert";
			if(mainForm.mf.CheckForm("AddForm1") == true)
			{
				return;
			}
			else
			{
				AddForm1 af1 =new AddForm1();
				af1.MdiParent = mainForm.mf;
				af1.Show();
			}

		}

		//修改
		private void update(object sender, System.EventArgs e)
		{
			this.Enabled = false;
			MemberForm.mem.memberId = "update";
			MemberForm.mem.ID = this.No_txt.Text.Trim();
			if(mainForm.mf.CheckForm("AddForm1") == true)
			{
				return;
			}
			else
			{
				AddForm1 af1 =new AddForm1();
				af1.MdiParent = mainForm.mf;
				af1.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.No_txt.Text.Trim());
				delstr[1] = "delete from EndowmentInfo where endId=" + int.Parse(this.No_txt.Text.Trim());
				delstr[2] = "delete from HolidayInfo where hId=" + int.Parse(this.No_txt.Text.Trim());
				delstr[3] = "delete from MedicalInfo where meId=" + int.Parse(this.No_txt.Text.Trim());
				delstr[4] = "delete from Photo where phId=" + int.Parse(this.No_txt.Text.Trim());
				delstr[5] = "delete from PpInfo where pId=" + int.Parse(this.No_txt.Text.Trim());
				delstr[6] = "delete from SocietyInfo where seId=" + int.Parse(this.No_txt.Text.Trim());
				delstr[7] = "delete from TitleInfo where tiId=" + int.Parse(this.No_txt.Text.Trim());
				delstr[8] = "delete from TrainInfo where trId=" + int.Parse(this.No_txt.Text.Trim());
				delstr[9] = "delete from TransferInfo where traId=" + int.Parse(this.No_txt.Text.Trim());
				delstr[10] = "delete from WagesInfo where waId=" + int.Parse(this.No_txt.Text.Trim());
				delstr[11] = "delete from WorkInfo where wId=" + int.Parse(this.No_txt.Text.Trim());
				Base bb = new Base();
				bb.ExeSQLs(delstr);
				MessageBox.Show("删除成功!");
			}
			if(result == DialogResult.No)
			{
				return ;
			}
			this.DBDataGrid(int.Parse(this.No_txt.Text.Trim()));
			empInfoForm.eif.DBDataGrid();
		}
		
		//退出
		private void close(object sender, System.EventArgs e)
		{
			empInfoForm.eif.Enabled = true;
		    this.Close();
		}
		#endregion

		#region  右键快捷菜单事件
		private void contextMenu1_Popup(object sender, System.EventArgs e)
		{
			if(this.contextMenu1.SourceControl == this)
			{
				this.contextMenu1.MenuItems.Clear();
			    this.contextMenu1.MenuItems.Add("添加记录",new EventHandler(this.insert));
				this.contextMenu1.MenuItems.Add("修改记录",new EventHandler(this.update));
				this.contextMenu1.MenuItems.Add("删除记录",new EventHandler(this.delete));
				this.contextMenu1.MenuItems.Add("-");
				this.contextMenu1.MenuItems.Add("打印");
				this.contextMenu1.MenuItems.Add("-");
				this.contextMenu1.MenuItems.Add("退出",new EventHandler(this.close));
				
			}
		}
		#endregion

		#region  当员工编号变化,相映的数据也变化
		private void No_txt_TextChanged(object sender, System.EventArgs e)
		{
			DBDataGrid(int.Parse(this.No_txt.Text.Trim()));
			Base b  = new Base();
			b.ReadImage(int.Parse(this.No_txt.Text.Trim()),this.pictureBox1);
		}
		#endregion

		private void menuItem1_Click(object sender, System.EventArgs e)
		{
			this.pageSetupDialog1.ShowDialog();
		}

		private void menuItem2_Click(object sender, System.EventArgs e)
		{
		    this.printPreviewDialog1.ShowDialog();
		}

		private void menuItem3_Click(object sender, System.EventArgs e)
		{
			if(this.printDialog1.ShowDialog() == DialogResult.OK)
			{
				try
				{
				    this.printDocument1.Print();
				}
				catch(Exception error)
				{
				    MessageBox.Show(error.ToString(),"打印出错!",MessageBoxButtons.OK,MessageBoxIcon.Error);
					this.printDocument1.PrintController.OnEndPrint(this.printDocument1,new PrintEventArgs());
				}
			}
		}

		#region  打印时画出简历表
		private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
		{
		    Graphics g = e.Graphics;
			Font TitleFont = new Font("楷体_GB2312",18);//大标题字体
			Font SubTileFont = new Font("楷体_GB2312",12);//小标题字体
			Font font = new Font("宋体",9);//字段值的字体
			Font Ffont = new Font("宋体",9,FontStyle.Bold);//字段的字体
			SolidBrush brush = new SolidBrush(Color.Black);//画刷
			Pen pen = new Pen(brush,1);
			g.DrawString("员工档案表",TitleFont,brush,e.MarginBounds.Width / 2 ,e.MarginBounds.Top);//画大标题
			g.DrawString("所在部门:  " + this.Section_txt.Text.Trim(),SubTileFont,brush,e.MarginBounds.Width*1/4,e.MarginBounds.Top + TitleFont.GetHeight(g)*2);//画小标题
			g.DrawString("员工编号:  " + this.No_txt.Text.Trim(),SubTileFont,brush,e.MarginBounds.Width*4/4,e.MarginBounds.Top + TitleFont.GetHeight(g)*2);//画小标题

			g.DrawRectangle(pen,e.MarginBounds.X,e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +SubTileFont.GetHeight(g) ,e.MarginBounds.Width,e.MarginBounds.Height);//画表格的大矩形
			float Ypos = e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +font.GetHeight(g);//画表格时的最上面的横线的坐标Y轴

			float Xline = e.MarginBounds.Width*4/5;//个人资料顶线到相片左上角的长度

			float XLine = (e.MarginBounds.X + e.MarginBounds.Width) - (e.MarginBounds.X+Xline*1/8);//社会关系的顶线的长度

			//画横线
			g.DrawLine(pen,e.MarginBounds.X,Ypos+font.GetHeight(g)*3,e.MarginBounds.X + e.MarginBounds.Width*4/5,Ypos+font.GetHeight(g)*3);
			g.DrawLine(pen,e.MarginBounds.X,Ypos+font.GetHeight(g)*3*2,e.MarginBounds.X + e.MarginBounds.Width*4/5,Ypos+font.GetHeight(g)*3*2);
			g.DrawLine(pen,e.MarginBounds.X,Ypos+font.GetHeight(g)*3*3,e.MarginBounds.X + e.MarginBounds.Width*4/5,Ypos+font.GetHeight(g)*3*3);
			g.DrawLine(pen,e.MarginBounds.X,Ypos+font.GetHeight(g)*3*4,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*4);
			g.DrawLine(pen,e.MarginBounds.X,Ypos+font.GetHeight(g)*3*5,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*5);
			g.DrawLine(pen,e.MarginBounds.X,Ypos+font.GetHeight(g)*3*6,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*6);
			g.DrawLine(pen,e.MarginBounds.X,Ypos+font.GetHeight(g)*3*7,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*7);

			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*8,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*8);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*9,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*9);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*10,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*10);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*11,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*11);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*12,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*12);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*13,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*13);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*14,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*14);

			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*16,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*16);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*17,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*17);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*18,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*18);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*19,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*19);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*20,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*20);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*21,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*21);
			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,Ypos+font.GetHeight(g)*3*22,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*22);
			

			g.DrawLine(pen,e.MarginBounds.X,Ypos+font.GetHeight(g)*3*15,e.MarginBounds.X + e.MarginBounds.Width,Ypos+font.GetHeight(g)*3*15);

			//画竖线
			g.DrawLine(pen,e.MarginBounds.X + e.MarginBounds.Width*4/5,e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +SubTileFont.GetHeight(g),e.MarginBounds.X + e.MarginBounds.Width*4/5,Ypos+font.GetHeight(g)*3*4);

			g.DrawLine(pen,e.MarginBounds.X+Xline*1/8,e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +SubTileFont.GetHeight(g),e.MarginBounds.X+Xline*1/8,e.MarginBounds.Y+e.MarginBounds.Height+76);
			g.DrawLine(pen,e.MarginBounds.X+Xline*2/8,e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +SubTileFont.GetHeight(g),e.MarginBounds.X+Xline*2/8,Ypos+font.GetHeight(g)*3*2);
			g.DrawLine(pen,e.MarginBounds.X+Xline*3/8,e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +SubTileFont.GetHeight(g),e.MarginBounds.X+Xline*3/8,Ypos+font.GetHeight(g)*3*7);
			g.DrawLine(pen,e.MarginBounds.X+Xline*4/8,e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +SubTileFont.GetHeight(g),e.MarginBounds.X+Xline*4/8,Ypos+font.GetHeight(g)*3*7);
			g.DrawLine(pen,e.MarginBounds.X+Xline*5/8,e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +SubTileFont.GetHeight(g),e.MarginBounds.X+Xline*5/8,Ypos+font.GetHeight(g)*3*2);
			g.DrawLine(pen,e.MarginBounds.X+Xline*6/8,e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +SubTileFont.GetHeight(g),e.MarginBounds.X+Xline*6/8,Ypos+font.GetHeight(g)*3*7);
			g.DrawLine(pen,e.MarginBounds.X+Xline*7/8,e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +SubTileFont.GetHeight(g),e.MarginBounds.X+Xline*7/8,Ypos+font.GetHeight(g)*3*7);
			g.DrawLine(pen,e.MarginBounds.X+Xline*8/8,e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +SubTileFont.GetHeight(g),e.MarginBounds.X+Xline*8/8,Ypos+font.GetHeight(g)*3*4);
            
			
			float XPos = e.MarginBounds.X + Xline*1/8;//社会关系栏中X轴的起始点

			g.DrawLine(pen,XPos+XLine*1/7,Ypos+font.GetHeight(g)*3*7,XPos+XLine*1/7,e.MarginBounds.Y+e.MarginBounds.Height+76);
			g.DrawLine(pen,XPos+XLine*3/7,Ypos+font.GetHeight(g)*3*7,XPos+XLine*3/7,e.MarginBounds.Y+e.MarginBounds.Height+76);
			g.DrawLine(pen,XPos+XLine*5/7,Ypos+font.GetHeight(g)*3*7,XPos+XLine*5/7,e.MarginBounds.Y+e.MarginBounds.Height+76);
			g.DrawLine(pen,XPos+XLine*7/7,Ypos+font.GetHeight(g)*3*7,XPos+XLine*7/7,e.MarginBounds.Y+e.MarginBounds.Height+76);

			
			float YFont = e.MarginBounds.Y + TitleFont.GetHeight(g)*2 +SubTileFont.GetHeight(g);//一个单元格的高度;
			float XFont = e.MarginBounds.X+Xline*1/8;//一个单元格的宽度
			float Unit = Xline*1/8/12;

			//画字段和字段的值
			g.DrawString("员工姓名",Ffont,brush,e.MarginBounds.X+Unit,Ypos+YFont/10);
			g.DrawString(this.Name_txt.Text,font,brush,e.MarginBounds.X+Xline*1/8 + Unit,Ypos+YFont/10);
			g.DrawString("性别",Ffont,brush,e.MarginBounds.X+Xline*2/8 + 2*Unit,Ypos+YFont/10);
			g.DrawString(this.Sex_txt.Text,font,brush,e.MarginBounds.X+Xline*3/8 + 3*Unit,Ypos+YFont/10);
			g.DrawString("出生日期",Ffont,brush,e.MarginBounds.X+Xline*4/8 + Unit,Ypos+YFont/10);
			g.DrawString(this.Birth_txt.Text,font,brush,e.MarginBounds.X+Xline*5/8,Ypos+YFont/10);
			g.DrawString("民族",Ffont,brush,e.MarginBounds.X+Xline*6/8 + 4*Unit,Ypos+YFont/10);
			g.DrawString(this.Race_txt.Text,font,brush,e.MarginBounds.X+Xline*7/8 + 4*Unit,Ypos+YFont/10);

			g.DrawString("籍贯",Ffont,brush,e.MarginBounds.X+Unit,Ypos+YFont/3);
			g.DrawString(this.Place_txt.Text,font,brush,e.MarginBounds.X+Xline*1/8 + Unit,Ypos+YFont/3);
			g.DrawString("学历",Ffont,brush,e.MarginBounds.X+Xline*2/8 + 2*Unit,Ypos+YFont/3);
			g.DrawString(this.Edu_txt.Text,font,brush,e.MarginBounds.X+Xline*3/8 + 3*Unit,Ypos+YFont/3);
			g.DrawString("婚姻状况",Ffont,brush,e.MarginBounds.X+Xline*4/8 + Unit,Ypos+YFont/3);
			g.DrawString(this.Mag_txt.Text,font,brush,e.MarginBounds.X+Xline*5/8 + 4*Unit,Ypos+YFont/3);
			g.DrawString("政治面貌",Ffont,brush,e.MarginBounds.X+Xline*6/8,Ypos+YFont/3);
			g.DrawString(this.Party_txt.Text,font,brush,e.MarginBounds.X+Xline*7/8 +4*Unit,Ypos+YFont/3);

			g.DrawString("专业",Ffont,brush,e.MarginBounds.X+Unit,Ypos+YFont/2+11);
			g.DrawString(this.Pro_txt.Text,font,brush,e.MarginBounds.X+Xline*1/8 + Unit,Ypos+YFont/2+11);
			g.DrawString("毕业学校",Ffont,brush,e.MarginBounds.X+Xline*3/8,Ypos+YFont/2+11);
			g.DrawString(this.School_txt.Text,font,brush,e.MarginBounds.X+Xline*4/8 + Unit,Ypos+YFont/2+11);
			g.DrawString("毕业时间",Ffont,brush,e.MarginBounds.X+Xline*6/8,Ypos+YFont/2+11);
			g.DrawString(this.LeaveSchool_txt.Text,font,brush,e.MarginBounds.X+Xline*7/8,Ypos+YFont/2+11);

			g.DrawString("身份证号",Ffont,brush,e.MarginBounds.X+Unit,Ypos+YFont/2+53);
			g.DrawString(this.Number_txt.Text,font,brush,e.MarginBounds.X+Xline*1/8 + Unit,Ypos+YFont/2+53);
			g.DrawString("工资号",Ffont,brush,e.MarginBounds.X+Xline*3/8,Ypos+YFont/2+53);
			g.DrawString(this.Wa_txt.Text,font,brush,e.MarginBounds.X+Xline*4/8 + Unit,Ypos+YFont/2+53);
			g.DrawString("养保号",Ffont,brush,e.MarginBounds.X+Xline*6/8,Ypos+YFont/2+53);
			g.DrawString(this.EenMen_txt.Text,font,brush,e.Margin

⌨️ 快捷键说明

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