工资管理系统c#sqlserver.docx

上传人:b****7 文档编号:11412813 上传时间:2023-02-28 格式:DOCX 页数:43 大小:196.91KB
下载 相关 举报
工资管理系统c#sqlserver.docx_第1页
第1页 / 共43页
工资管理系统c#sqlserver.docx_第2页
第2页 / 共43页
工资管理系统c#sqlserver.docx_第3页
第3页 / 共43页
工资管理系统c#sqlserver.docx_第4页
第4页 / 共43页
工资管理系统c#sqlserver.docx_第5页
第5页 / 共43页
点击查看更多>>
下载资源
资源描述

工资管理系统c#sqlserver.docx

《工资管理系统c#sqlserver.docx》由会员分享,可在线阅读,更多相关《工资管理系统c#sqlserver.docx(43页珍藏版)》请在冰豆网上搜索。

工资管理系统c#sqlserver.docx

工资管理系统c#sqlserver

 

数据库课程设计

 

设计题目:

工资管理系统

班级:

学号:

姓名:

 

任务分配表

第一组

学号

姓名

负责部分

成绩

组长

数据库的建表与连接

组员

实验报告完善与界面设计

一绪论··········································3

二需求分析·······································3

三概要设计·······································4

四物理设计·······································5

五详细设计·······································6

六调试分析·······································9

七小结··········································16

八附件············································16

 

一、绪论

随着计算机技术的飞速发展和经济体制改革的不断深入,传统企业管理方法、手段以及工作效率已不能适应新的发展需要,无法很好地完成员工工资管理工作。

提高公司企业管理水平的主要途径是更新管理者的思想,增强对管理活动的科学认识。

基于C#与SQLserver数据库技术建立一个通用工资管理系统,该系统为提供了查询、增加记录、删除等功能,功能比较的齐全,并对工资进行了统计如津贴管理、报表统计等。

基本上能满足管理员和公司的要求。

此次数据库课程设计的主要设计如下:

原理分析、程序设计过程、程序实现和程序调试以及数据库的设计。

需求分析、概要结构设计、逻辑结构设计、物理结构设计和数据库的实施和维护。

主要包括两大大功能模块:

1.管理员管理界面设计。

2.员工管理界面设计。

 

二、需求分析

功能需求分析:

该通用工资管理系统具备下列功能:

管理员通过输入用户名和密码进下该系统后,可以进行一些基本查询(员工信息查询、工资奖金信息查询)、工资管理(计算总工资、奖金管理);通过输入密码,可以进行查询员工的数据(工资,奖金,税收等)。

具体功能的详细描述如下

1、在首页进行选择,员工与管理员通道

2、点击[管理员登陆]

3、用户名和密码即可进入[工资管理]功能窗体,在此可以选择功能,添加,查询,人员列表

4、点击[添加]功能窗体,添加员工工资信息。

5、点击[查询]功能窗体,输入员工号即可查询员工信息。

6、点击[人员列表]功能窗体,可查看所有员工的列表,这界面内可以进行删除操作。

7、点击[员工登陆]

8、用户名和密码即可进入[员工工资查询]功能窗体,在此可以选择查询基本信息,查询工资信息。

9、在[查询基本信息],员工可自己查看自己的信息。

10、在[查询工作信息],员工可自己查看自己的工作信息。

数据流需求分析:

登陆信息返回信息

用户

登录

操作

数据库

错误信息寻找信息

数据库需求分析——数据流图

 

三、概要设计

根据需求分析阶段得到的功能需求,管理员、员工通过输入用户名号和密码进下该系统后,可以进行一些基本查询(员工工资信息查询、信息查询)、还可以进行员工删除和添加员工的操作,员工通过登录并输入密码,可以进行查询自己的数据(工资,基本信息)。

模块功能大概可以分为如图下几个个方面:

图如下图所示

四、物理设计

1.选择[登陆]则会进入相应登陆界面。

2.选择[员工登陆][管理员登陆]按钮命令

3.选择[管理员登陆]按钮命令即可进入[管理]功能窗体。

4.选择[员工登陆]按钮命令即可进入[员工查询]功能窗体。

5.在[添加],管理员对员工的信息进行添加。

6.在[查询],可以对员工查询并进行修改。

7.在[列表],可以查看所有员工的列表。

 

五、详细设计

(1)数据库的E-R图及合并部分视图生成E-R图

员工信息E-R图:

病假天数

工作天数

Empinfotale

姓名

工龄

银行卡

年龄

工种名称

用户名

性别

 

员工工资信息E-R图:

银行卡号

退休工资

国家税收

 

管理员用户E-R图:

admin

用户

用户号

密码

 

(2)数据库结构设计

根据上面概念结构设计阶段得到的E-R图,下一步应该将它转化为关系模型。

可以得到对应的关系模式为:

Empinfotale([cin],[name],[year],[sex],[workyear],[position],[creditcard],[workday],[illday])

Salaryinfo([cin],[bonus],[salary],[individual],[individual2],[workout],[workday],[Reality],[creditcar])

admin([id],[cin],[password])

数据库表的建立:

(sql语句及截图)

语句如下:

CREATETABLE[dbo].[Admin](

[id][int]IDENTITY(1,1)NOTNULL,

[cin][int]NULL,

[password][char](20)NULL,

);

CREATETABLE[dbo].[Empinfotale](

[cin][int]NOTNULL,

[name][char](8)NULL,

[year][int]NULL,

[sex][char](4)NULL,

[workyear][int]NULL,

[position][char](18)NULL,

[creditcard][char](19)NULL,

[workday][int]NULL,

[illday][int]NULL,

);

 

CREATETABLE[dbo].[Admin](

[id][int]IDENTITY(1,1)NOTNULL,

[cin][int]NULL,

[password][char](20)NULL,

);

 

六、调试分析

(1)数据库的表的建立与实现

admin表的建立:

 

Salaryinfo表的建立:

Empinfotale表的建立:

 

1.数据库的运行和截图:

选择登录界面截图:

管理员登录后:

查询界面:

添加界面:

显示所有信息:

 

(2)调试与运行程序分析及存在的主要问题

在此次课程设计中的主要数据库部分为数据库的连接部分,该部分直接影响到数据库与应用程序的接口实现,而且必须注意数据库的名称与连接数据库是取的名称一致。

 

七、小结

该工资管理系统总体说来功能不是很齐全齐全,只具备管理员和员工的一些基本的功能;数据库的设计方面,建有员工信息表、个人信息表、工资表。

数据库中存在一些问题,如数据冗余,不够完善。

但在做课程设计的过程中也遇到很多问题,一开始时其中最大的问题是不知道用哪种编译工具,后来选择了MicrosoftVisualStudio,在编写程序时,编写程序起来也有点困难,但是也越来越顺利了。

经过调试后终于把自已想到实现的功能一步步实现了,通过这次课程设计使我收获了好多,熟悉了C#的运用,还复习了数据库相关语句的编写。

此次课程设计让我感受颇多:

做一个数据库其实是一件很有趣的事情。

想到自己可以创建一个小型的数据库系统,有点学习后的满足感。

数据库的建立并非难事,难点在于数据库的连接和编程语言的选择。

C#的功能很强大,这也是我以后需要学习的课程,于是我毅然选择了它。

再就是建立数据库系统的步骤,我的经验就是要先总体规划,再局部整理。

先做好总的界面,再通过该界面的布置一步一步实现其功能!

同时我体会到:

熟练的编程能力,对知识运用的强烈渴望及其创新和团队的合作精神设做好一个大型数据库的基础。

因此通过此次课程设计我明显感觉到自身的不足,并希望以后能更加用心地运用所学知识和学习新的知识。

在这个系统中我主要负责了数据库的建立和管理员管理的页面设计,虽然做的不是很好的,但是让我们学到了很多关于数据库连接方面的知识。

我会继续完善下去的。

 

八、附件

一、程序代码

选择登陆页面

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Configuration;

namespaceGZMS

{

publicpartialclassindex:

Form

{

publicindex()

{

InitializeComponent();

}

privatevoidbutton1_Click(objectsender,EventArgse)

{

Form1indexform=newForm1();

indexform.Owner=this;

indexform.Show();

this.Hide();

}

privatevoidbutton2_Click(objectsender,EventArgse)

{

Form11indexform=newForm11();

indexform.Owner=this;

indexform.Show();

this.Hide();

}

}

}

验证用户名登陆页面

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

usingSystem.Configuration;

namespaceGZMS

{

publicpartialclassForm1:

Form

{

publicForm1()

{

InitializeComponent();

}

protectedoverridevoidOnClosed(EventArgse)

{

Application.Exit();

}

privatevoidindex_Click(objectsender,EventArgse)

{

stringusername=txusername.Text;

stringusrepaw=txuserpaw.Text;

if(username==""||usrepaw=="")

{

MessageBox.Show("请输入用户名或密码","提示");

return;

}

SqlConnectionsqlCon=newSqlConnection(ConfigurationManager.ConnectionStrings["GZB.Properties.Settings.ConnectionString"].ConnectionString);

//stringConnectionString=@"DataSource=(local);InitialCatalog=GZB;User=sa;Password=admin;IntegratedSecurity=True";

//SqlConnectionsqlCon=newSqlConnection(ConnectionString);//创建Connection对象

//DataSource=.;InitialCatalog=数据库名;IntegratedSecurity=Trueid=用户名password=密码

try

{

sqlCon.Open();

stringsql=String.Format("selectcin,passwordfromAdminwherecin='{0}'andpassword='{1}'",username,usrepaw);

SqlCommandcomm=newSqlCommand(sql,sqlCon);

SqlDataReaderc=comm.ExecuteReader();

if(c.Read())

{

this.DialogResult=DialogResult.OK;//触发确定¨

//MessageBox.Show("成功|","登陆成功|",MessageBoxButtons.OK);

searchadd=newsearch();

add.Owner=this;

add.Show();

this.Hide();

}

else

{

MessageBox.Show("成功","登陆成功|",MessageBoxButtons.OK);

}

}

catch(SqlExceptionex)

{

MessageBox.Show("数据库错误","错误");

}

finally

{

sqlCon.Close();

}

}

privatevoidquet_Click(objectsender,EventArgse)

{

Application.Exit();

}

}

}

功能选择页面

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

usingSystem.Configuration;

namespaceGZMS

{

publicpartialclassForm1:

Form

{

publicForm1()

{

InitializeComponent();

}

protectedoverridevoidOnClosed(EventArgse)

{

Application.Exit();

}

privatevoidindex_Click(objectsender,EventArgse)

{

stringusername=txusername.Text;

stringusrepaw=txuserpaw.Text;

if(username==""||usrepaw=="")

{

MessageBox.Show("请输入用户名或密码","提示");

return;

}

SqlConnectionsqlCon=newSqlConnection(ConfigurationManager.ConnectionStrings["GZB.Properties.Settings.ConnectionString"].ConnectionString);

//stringConnectionString=@"DataSource=(local);InitialCatalog=GZB;User=sa;Password=admin;IntegratedSecurity=True";

//SqlConnectionsqlCon=newSqlConnection(ConnectionString);//创建Connection对象

//DataSource=.;InitialCatalog=数据库名;IntegratedSecurity=Trueid=用户名password=密码

try

{

sqlCon.Open();

stringsql=String.Format("selectcin,passwordfromAdminwherecin='{0}'andpassword='{1}'",username,usrepaw);

SqlCommandcomm=newSqlCommand(sql,sqlCon);

SqlDataReaderc=comm.ExecuteReader();

if(c.Read())

{

this.DialogResult=DialogResult.OK;//触发确定

//MessageBox.Show("成功","登陆成功",MessageBoxButtons.OK);

searchadd=newsearch();

add.Owner=this;

add.Show();

this.Hide();

}

else

{

MessageBox.Show("no成功|","登陆no成功|",MessageBoxButtons.OK);

}

}

catch(SqlExceptionex)

{

MessageBox.Show("数据库错误","错误");

}

finally

{

sqlCon.Close();

}

}

privatevoidquet_Click(objectsender,EventArgse)

{

Application.Exit();

}

}

}

添加员工信息页面

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SqlClient;

usingSystem.Configuration;

namespaceGZMS

{

publicpartialclassadd:

Form

{

publicadd()

{

InitializeComponent();

}

protectedoverridevoidOnClosed(EventArgse)

{

Application.Exit();

}

privatevoidbutton2_Click(objectsender,EventArgse)

{

this.Close();

}

 

privatevoidbutton1_Click(objectsender,EventArgse)

{

try

{

stringname=tbname.Text;

stringnum=tbnum.Text;

stringsex="";

if(rbboy.Checked)

{

sex=rbboy.Text;

}

else

sex=rdgirl.Text;

intyear=Convert.ToInt32(tbyear.Text);

intworkyear=Convert.ToInt32(tbworkyear.Text);

stringposition=cbposition.SelectedItem.ToString();

intworkday=Convert.ToInt32(tbworkday.Text);

intillday=Convert.ToInt32(tbillday1.Text);

stringcredit=tbcredit.Text;

//stringconstring=@"server=(local);database=GZB;UID=sa;Password=admin;integratedsecurity=True";

//SqlConnectionconn=newSqlConnection(constring);

SqlConnectionconn=newSqlConnection(ConfigurationManager.ConnectionStrings["GZB.Properties.Settings.ConnectionString"].ConnectionString);

conn.Open();

stringsql=string.Format("insertintoEmpinfotale(cin,name,year,sex,workyear,position,creditcard,workday,illday)VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}',{8})",num,name,year,sex,workyear,position,credit,workday,illday);

SqlCommandcom=newSqlCommand(sql,conn);

inti=com.ExecuteNonQuery();

if(i!

=0)

{

MessageBox.Show("成功","插入成功|",MessageBoxButtons.OK,MessageBoxIcon.None);

}

}

catch(FormatExceptionex)

{

MessageBox.Show("请重新输入空白地方","输入错误",MessageBoxButtons.OK);

}

catch(SqlExceptionex)

{

MessageBox.S

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 简历

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

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