ImageVerifierCode 换一换
格式:DOCX , 页数:40 ,大小:708.96KB ,
资源ID:12741258      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/12741258.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C#实验报告人事管理系统.docx)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C#实验报告人事管理系统.docx

1、C#实验报告人事管理系统C#实验报告(人事管理系统)学 号149074353姓 名程裕博班 级物141指导教师夏敏工业大学计算机学院2016年12月一程序步骤先设置一个登录界面(连接数据库),登录时进行判断,根据不同的错误信息进行报错,如密码错误。登陆成功后,进入主界面。主界面通过树和表格来显示数据。可以对人员,班组,部门进行增删改查操作,数据保存在数据库中。二程序源码1.数据库表结构2、登录界面using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy

2、stem.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;using CCWin;using System.Data.SqlClient;namespace 实验_人事管理系统 public partial class Form_login : CCSkinMain public Form_login() InitializeComponent(); string src = Data Source=(LocalDB)v11.0;AttachD

3、bFilename=c:users博博documentsvisual studio 2013Projects实验人事管理系统实验人事管理系统MyData.mdf;Integrated Security=True; private void Form1_Load(object sender, EventArgs e) private void button_login_Click(object sender, EventArgs e) string user = this.skinTextBox.Text; string password = this.skinTextBox2.Text; in

4、t sign1 = 0; int sign2 = 0; if (user = | password = ) MessageBox.Show(您输入的数据不完整!); else string sql1 = string.Format(select USERNAME from Table_login where USERNAME=N0;, user); using (SqlConnection coon = new SqlConnection(src) SqlCommand cmd = new SqlCommand(sql1, coon); coon.Open(); using (SqlDataR

5、eader dr = cmd.ExecuteReader() while (dr.Read() sign1+; if (sign1 = 0) MessageBox.Show(未查询到您的用户信息!); if (sign1 != 0) string sql2 = string.Format(select PASSWORD from Table_login where USERNAME=N0;, user); using (SqlConnection coon = new SqlConnection(src) SqlCommand cmd = new SqlCommand(sql2, coon);

6、 coon.Open(); using (SqlDataReader dr = cmd.ExecuteReader() while (dr.Read() if (password = drPASSWORD.ToString() sign2+; if (sign1 != 0 & sign2 = 0) MessageBox.Show(您的密码输入错误!); if (sign2 != 0) Form_show f1 = new Form_show(user, this); f1.Show(); this.Visible = false; 3、主界面using System;using System.

7、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.Timers;using System.Data.SqlClient;using CCWin;namespace 实验_人事管理系统 public partial class Form_show : Form pub

8、lic Form_show() InitializeComponent(); public Form_show(string name1,Form_login f) login_name=name1; fl = f; InitializeComponent(); string login_name=xx; Form_login fl =null ; TreeNode t = new TreeNode(); int ID=-1; public List list = new List(); string name; string birth; string sex; string educati

9、on; string adminisitrator; string manegetime; / string category_name; string src = Data Source=(LocalDB)v11.0;AttachDbFilename=c:users博博documentsvisual studio 2013Projects实验人事管理系统实验人事管理系统MyData.mdf;Integrated Security=True; private void Form_show_Load(object sender, EventArgs e) toolStripStatusLabel

10、_name.Text = 管理员: + this.login_name; toolStripStatusLabel_time.Text = 登录时间: + DateTime.Now.ToLongTimeString(); Addparent(); this.dataGridView1.ClearSelection(); private void toolStripStatusLabel_name_Click(object sender, EventArgs e) private void Form_show_FormClosed(object sender, FormClosedEventAr

11、gs e) fl.Close(); public void Addparent() string sql = select * from Table_tree where PR_NUMBER=-1; using (SqlConnection coon = new SqlConnection(src) SqlCommand cmd = new SqlCommand(sql, coon); coon.Open(); using (SqlDataReader dr = cmd.ExecuteReader() while (dr.Read() string name = drNAME.ToString

12、(); string number = drNUMBER.ToString(); / string category=drCATEGORY.ToString(); TreeNode tn = new TreeNode(); tn.Text = name; tn.Tag = number; tn.ImageIndex = 1; AddChild(number, tn); treeView_jiegou.Nodes.Add(tn); / skinTreeView1.Nodes.Add(tn); private void AddChild(string pnumber, TreeNode pnode

13、) if (Convert.ToInt32(pnode.Tag) = 0 | (pnode.Parent!=null & Convert.ToInt32(pnode.Parent.Tag) = 0) string sql = select * from Table_tree where PR_NUMBER= + pnumber + order by NAME desc; using (SqlConnection conn = new SqlConnection(src) SqlCommand cmd = new SqlCommand(sql, conn); conn.Open(); using

14、 (SqlDataReader dr = cmd.ExecuteReader() while (dr.Read() string name = drNAME.ToString(); string number = drNUMBER.ToString(); / string category = drCATEGORY.ToString(); TreeNode tn = new TreeNode(); tn.Text = name; tn.Tag = number; tn.ImageIndex = 1; AddChild(number, tn); pnode.Nodes.Add(tn); else

15、 string sql = select * from Table_tree where PR_NUMBER= + pnumber + order by NAME desc; using (SqlConnection conn = new SqlConnection(src) SqlCommand cmd = new SqlCommand(sql, conn); conn.Open(); using (SqlDataReader dr = cmd.ExecuteReader() while (dr.Read() string name = drNAME.ToString(); string n

16、umber = drNUMBER.ToString(); / string category = drCATEGORY.ToString(); TreeNode tn = new TreeNode(); tn.Text = name; tn.Tag = number; tn.ImageIndex = 0; AddChild(number, tn); pnode.Nodes.Add(tn); private void skinButton_add_Click(object sender, EventArgs e)/无用的按钮 private void skinButton_add_Click_1

17、(object sender, EventArgs e) /MessageBox.Show(添加!); if (t.Parent.Parent!=null & t.Parent!=null) Form_Addperson fp = new Form_Addperson(t, toolStripStatusLabel_name.Text, DateTime.Now.ToString(); fp.Owner = this; fp.Show(); list.Clear(); else MessageBox.Show(请到班组添加人员!); / reshow(); private void treeV

18、iew_jiegou_AfterSelect(object sender, TreeViewEventArgs e) string sql = select * from Table_person where CATEGORY_NUMBER= + e.Node.Tag; List list = new List(); using (SqlConnection conn = new SqlConnection(src) SqlCommand cmd = new SqlCommand(sql, conn); conn.Open(); using (SqlDataReader dr = cmd.Ex

19、ecuteReader() while (dr.Read() person p = new person(); p.Person_name = drPERSON_NAME.ToString(); p.Category_name = drCATEGORY_NAME.ToString(); p.Sex = drSEX.ToString(); string dt=drBIRTH.ToString().Split( ); p.Birth = dt0; p.Education = drEDUCATION.ToString(); p.Adminisitrator = drADMINISITRATOR.To

20、String(); p.Manegetime=drMANEGETIME.ToString(); list.Add(p); this.dataGridView1.ClearSelection(); this.dataGridView1.DataSource = list; ID = -1; private void 添加部门ToolStripMenuItem_Click(object sender, EventArgs e) if (t.Parent = null | t.Parent.Parent = null) Form_Add fa = new Form_Add(t); fa.Owner

21、= this; fa.Show(); else Form_Addperson fp = new Form_Addperson(t, toolStripStatusLabel_name.Text, DateTime.Now.ToString(); fp.Owner = this; fp.Show(); list.Clear(); this.dataGridView1.DataSource = list; private void treeView_jiegou_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) this.t

22、= e.Node; / MessageBox.Show(t.Name); public void reshow() treeView_jiegou.Nodes.Clear(); Addparent(); private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) /string name; /string birth; /string education; /string adminisitrator; /string manegetime; if (e.RowIndex != -1) nam

23、e = this.dataGridView1.Rowse.RowIndex.Cells0.Value.ToString(); birth = this.dataGridView1.Rowse.RowIndex.Cells2.Value.ToString(); education = this.dataGridView1.Rowse.RowIndex.Cells4.Value.ToString(); adminisitrator = this.dataGridView1.Rowse.RowIndex.Cells5.Value.ToString(); manegetime = this.dataG

24、ridView1.Rowse.RowIndex.Cells6.Value.ToString(); sex = this.dataGridView1.Rowse.RowIndex.Cells3.Value.ToString(); /MessageBox.Show(name+birth+education+adminisitrator+manegetime+sex); string sql = string.Format(select ID from Table_person where PERSON_NAME=N0 and BIRTH=N1 and ADMINISITRATOR=N2 and M

25、ANEGETIME=N3, name, birth, adminisitrator, manegetime); / MessageBox.Show(sql); using (SqlConnection coon = new SqlConnection(src) SqlCommand cmd = new SqlCommand(sql, coon); coon.Open(); using (SqlDataReader dr = cmd.ExecuteReader() while (dr.Read() ID = (int)drID; private void skinButton_delete_Cl

26、ick(object sender, EventArgs e) if (ID != -1) string sql = delete from Table_person where ID=+ID.ToString()+; using (SqlConnection coon = new SqlConnection(src) SqlCommand cmd = new SqlCommand(sql,coon); coon.Open(); int n=cmd.ExecuteNonQuery(); if(n=1) MessageBox.Show(删除成功!); reshowview(); reshow()

27、; /foreach (person p in list) / / if (p.Adminisitrator = adminisitrator & p.Birth = birth & p.Person_name = name & p.Manegetime = manegetime) / / list.Remove(p); / / /this.dataGridView1.DataSource = list; else MessageBox.Show(未选定行!); private void skinButton_rewrite_Click(object sender, EventArgs e)

28、if (ID != -1) Form_rewrite fr = new Form_rewrite(name, sex, birth, education, toolStripStatusLabel_name.Text, manegetime, ID); fr.Owner = this; fr.Show(); else MessageBox.Show(未选定行!); /list.Clear(); / this.dataGridView1.DataSource=list; private void skinButton1_search_Click(object sender, EventArgs e) string sql = select * from Table_person where 1=1; List list1 = new List(); / list1.Clear(); if (this.textBox1.Text.Trim() != ) sql = sql + and PERSON_NAME like N% + this.textBox1.Text.Trim()+ %; if (th

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1