




已阅读5页,还剩15页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
河南理工大学C#程序设计实训报告河南理工大学计算机科学与技术学院课程设计2011 2012学年 第二学期课程名称 C#Windows程序设计课设设计题目 人事管理系统 学生姓名 学 号 专业班级 指导教师 年 月 日1 设计任务书1.1 题目与要求本人计划编写一个简单的人事管理系统,主要用来管理员工基本信息具体要求如下:1、设置登陆界面2、主界面;3、员工信息的查询;4、员工信息的添加;5、员工信息的修改;6、员工信息的删除; 1.2 本系统涉及的知识点WinForm常用控件、属性、方法、(button,textbox,dataGridView等控件)窗体之间的数据交互、数据库技术。2 功能设计通过设计一个人事管理系统来对公司员进行增删查改的操作在系统功能分析的基础上,考虑Microsoft Visual Studio 2013和数据库sql server2012程序编制的特点,得到如图2-1所示的系统功能模块图登 录主 界 面删除员工查寻员工添加员工修改员工信息数 据 库图2-1 功能模块图3 数据库设计进入主界面管理员登录 验证用户操作 信息正确 操作成功程序作出反应数据交互 数据库概念设计图首先建立一个名为YGGL的数据库CREATE DATABASE YEEL建立登陆信息表Create table 登陆然后建立 信息 的表(以十条信息作为基础信息)GREATE TABLE 信息Sql server 设计4 系统实现4.1:首先设计一个登陆窗口代码如下:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Data.SqlClient;namespace 员工管理系统 public partial class Form1 : Form public Form1() InitializeComponent(); private void button1_Click(object sender, EventArgs e) string name = textBox1.Text; string pwd = textBox2.Text; SqlConnection myCon = new SqlConnection(); myCon.ConnectionString = data source=LIBINGCHUAN-PC; initial catalog=YGGL; integrated security=true;/设置数据库连接参数,依次是服务器名、数据库名、连接方式 myCon.Open();/打开数据库对象 SqlCommand selectDM = new SqlCommand(); selectDM.Connection = myCon; selectDM.CommandText = select * from denglu where name= + name + and pwd= + pwd + ; SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = selectDM; DataTable dt = new DataTable(); da.Fill(dt); /int i = dt.Rows.Count;/此位置的设置是直接跳过密码登陆 int i = 1; if (i = 1) this.Hide(); zj frm = new zj(); frm.Show(); else MessageBox.Show(帐号或者密码错误!, 提示); textBox1.Clear(); textBox2.Clear(); textBox1.Focus(); myCon.Close(); private void button2_Click(object sender, EventArgs e) Application.Exit(); 效果图如下:4.2:主页面的设计代码如下using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace 员工管理系统 public partial class zj : Form public zj() InitializeComponent(); private void zj_Load(object sender, EventArgs e) private void textBox3_TextChanged(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) /点击进入查询页面 this.Hide(); cx frm = new cx(); frm.Show(); private void button2_Click(object sender, EventArgs e) /点击进入添加页面 this.Hide(); tj frm = new tj(); frm.Show(); private void button5_Click(object sender, EventArgs e) /点击退出程序 Application.Exit(); private void button3_Click(object sender, EventArgs e) /点击进入修改页面 this.Hide(); xg frm = new xg (); frm.Show(); private void button4_Click(object sender, EventArgs e) /点击进入删除页面 this.Hide(); sc frm = new sc(); frm.Show(); 运行效果图如下点击各个按键可以跳转进行下一步操作。4.3:对增删查改的设置:查:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Data.SqlClient;namespace 员工管理系统 public partial class cx : Form public cx() InitializeComponent(); private void button1_Click(object sender, EventArgs e) /SqlConnection myCon = new SqlConnection(); /myCon.ConnectionString = data source=LIBINGCHUAN-PC; initial catalog=YGGL; integrated security=true;/设置数据库连接参数,依次是服务器名、数据库名、连接方式 /myCon.Open();/打开数据库对象 /SqlCommand selectDM = new SqlCommand(); /selectDM.Connection = myCon; /selectDM.CommandText = select * from 员工信息; private void cx_Load(object sender, EventArgs e) / TODO: 这行代码将数据加载到表“yGGLDataSet2.信息”中。您可以根据需要移动或删除它。 this.信息TableAdapter.Fill(this.yGGLDataSet2.信息); private void button2_Click(object sender, EventArgs e) this.Hide(); zj frm = new zj(); frm.Show(); 效果图较为简洁有十条基础数据如下:增:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using System.Data.SqlClient;namespace 员工管理系统 public partial class tj : Form public tj() InitializeComponent(); private void button1_Click(object sender, EventArgs e) this.Hide(); zj frm = new zj(); frm.Show(); private void button2_Click(object sender, EventArgs e) string 员工编号 = textBox1.Text; string 员工姓名 = textBox2.Text; string 性别 = textBox3.Text; string 籍贯 = textBox4.Text; string 电话 = textBox5.Text; SqlConnection myCon = new SqlConnection(); myCon.ConnectionString = data source=LIBINGCHUAN-PC; initial catalog=YGGL; integrated security=true;/设置数据库连接参数,依次是服务器名、数据库名、连接方式 myCon.Open();/打开数据库对象 SqlCommand selectDM = new SqlCommand(); selectDM.Connection = myCon; if (textBox1.Text = ) MessageBox.Show(员工号不能为空!, 提示信息, MessageBoxButtons.OK, MessageBoxIcon.Information); else selectDM.CommandText = insert into 员工信息 values ( + 员工编号 + , + 员工姓名 + , + 性别 + , + 籍贯 + , + 电话 + ); selectDM.ExecuteNonQuery(); MessageBox.Show(添加成功); myCon.Close(); 界面图如下:改:amespace 员工管理系统 public partial class xg : Form public xg() InitializeComponent(); private void xg_Load(object sender, EventArgs e) / TODO: 这行代码将数据加载到表“yGGLDataSet5.信息”中。您可以根据需要移动或删除它。 this.信息TableAdapter2.Fill(this.yGGLDataSet5.信息); private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) String a = textBox1.Text; string b = textBox2 .Text ; string c = textBox3 .Text; string d = textBox4 .Text ; string i = textBox5 .Text ; string q = textBox6.Text; SqlConnection myCon = new SqlConnection(); myCon.ConnectionString = data source=LIBINGCHUAN-PC; initial catalog=YGGL; integrated security=true;/设置数据库连接参数,依次是服务器名、数据库名、连接方式 myCon.Open();/打开数据库对象 SqlCommand selectDM = new SqlCommand(); selectDM.Connection = myCon; if (textBox6.Text = ) MessageBox.Show(输入有误!, 提示信息, MessageBoxButtons.OK, MessageBoxIcon.Information); else selectDM.CommandText = update 信息 set 编号= +Convert.ToInt32(a) + , 姓名=+b+ , 性别=+c +,籍贯 = +d+ ,电话=+i+ where 编号=+Convert.ToInt32 (q) +; selectDM.ExecuteNonQuery(); MessageBox.Show(修改成功); myCon.Close(); private void button2_Click(object sender, EventArgs e) this.Hide(); cx frm = new cx(); frm.Show(); private void fillByToolStripButton_Click(object sender, EventArgs e) try this.信息TableAdapter3.FillBy(this.yGGLDataSet2.信息); catch (System.Exception ex) System.Windows.Forms.MessageBox.Show(ex.Message); 界面如下:删:代码:namespace 员工管理系统 public partial class sc : Form public sc() InitializeComponent(); private void button1_Click(object sender, EventArgs e) string z = textBox1.Text; SqlConnection myCon = new SqlConnection(); myCon.ConnectionString = data source=LIBINGCHUAN-PC; initial catalog=YGGL; integrated security=true;/设置数据库连接参数,依次是服务器名、数据库名、连接方式 myCon.Open();/打开数据库对象 SqlCommand selectDM = new SqlCommand(); selectDM.Connection = myCon; if (textBox1.Text = ) MessageBox.Show(员工编号不能为空!, 提示信息, MessageBoxButtons.OK, MessageBoxIcon.Information); else selectDM.CommandText = delete from 信息 where 编号= + Convert.ToInt32(z) + ; selectDM.ExecuteNonQuery(); MessageBox.Show(删除成功); private void button2_Click(object sender, EventArgs e) this.Hide(); cx frm = new cx(
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025届高考物理大一轮复习课件 第八章 第41课时 机械波
- 2025年人大“复印报刊资料”数据库服务合同协议
- 2025企业管理资料范本阿里巴巴员工服务合同范本
- 西昌邦泰置业有限公司邦泰·花园城一期竣工验收监测报告表
- 2025合同范本股东与管理层股权分配协议设计模板
- 2025数据管理系统软件开发合同模板(标准版)
- 2025电大合同法精要速记版帮你掌握合同法律知识
- 2025合同样本企业员工的劳动合同模板
- 2025中国矿业大学徐海学院技术转让合同范本
- 四年级上学期音乐教学计划(4篇)
- 车辆抵顶合同协议
- 2025春 新人教版美术小学一年级下册致敬平凡
- 统编版六年级下册语文期末课内总复习必背知识点提纲
- 钢贸行业供应链分析及金融服务方案
- 学美容管理制度
- 内河旅客运输安全风险评估与控制-全面剖析
- 2025年河南省郑州市中考一模英语试题
- GB/T 13511.2-2025配装眼镜第2部分:渐变焦定配眼镜
- 2024演出经纪人资格考试重要试题及答案
- 2025年防疫员笔试题库及答案
- TCNCIA 01036-2024 变压器用无溶剂防腐涂料
评论
0/150
提交评论