资源描述
数据库原理
课程设计方案设计
设计题目:工资管理系统
专 业
班 级
学 生
学 号
指导教师
完成日期 2014/6/23-2014/6/26
2014年 春季 学期
设计任务
3、工资管理系统
建库:1个———-工资管理数据库.
建表:3个————档案表、工资总表、工资变动表。
编程:5个———-输入、修改、查询、计算、输出等五个子系统.
要求:(1)每组3个人,每人完成一个子系统,每人都要建立库及全部表;
(2)每人写出各自的课程设计报告;
(3)程序用选定的语言编写,且上交上机调试通过的源程序。
评语(教师填写)
目录
⒈ 系统规划 。。.......。。。..。.。。..。。...。。.。.。。。.。。。。。.。。7
1。1 任务分配 。.。..。。。..。。。..。。。。。。。.。。。.。。.。。。。。。..。. 7
1。2 可行性分析..。.。.。。。。。...。...。.。。。...。...。.。。.。。。.。7
1.2.1 运行可行性 。。..。.。。.。.。.。。。。。..。。..。。...。。。.。。。 7
1。2。2 技术可行性 。。。。。.。。。.。....。..。.。。.。。。。。.。...。.. 7
1.3 划分子系统 .。。。。..。。。。。。。。。。。。....。。.。。..。..。。。。. 8
1。4 制定信息系统开发方案及日程安排 ..。。。。.。。。。.。。。。。。。。。。 8
1。4.1 对各子系统的评价 。。。。。.。。.。。.。。..。。。。..。。.。。。。。.。 8
1.4.2 信息系统资源分配计划 。。。。..。。。。。..。。.。.。.。...。..。. 8
⒉ 系统分析 ..。。.。.。.。。。。.。。。.。。.。..。.。.。。。。。..。.。。。..。 9
2。1 需求确定 。.。。..。.。.。。。.。.。。。.。。。。。。。。。.。。。.。。。。. 9
2.1。1概念模型 E—R图.。..。。。。.。。。.。。。..。。。。。。.。..。。.。 9
2.2 需求分析 ....。.。。..。。。..。。。。。。。。。..。。。。.。。.。。。。。. 11
2.2。1系统需求分析.。..。。.。。。..。。。。。.。.。。.。.。.。。。 11
2。2.2 数据库表.。。。。。.。。...。.。。。..。。.。。。.。。。。。..。..。。。 12
⒊ 系统设计 。.。..。。。。。。。。.。.。。。。.。..。...。。。。.。。。。。。。。. 13
3。1数据库表设计 .。。..。。。。。。。.。。..。。。..。。。 13
3。2 代码设计。。。。。。。..。。。。.。。。.。。。。。。.。.。。。。..。.。。。.。。 14
⒋ 系统实施 .。。。。.。.。。。。...。..。。...。。...。.。。。。。。。。。。 38
4。1 程序设计说明书.。。.。.。。.。。。.。。.。..。。。。。。..。。..。。。。。 38
4。2 用户手册。。.。。。。。。。。..。。.。。.。。。.。.。。。..。...。。。..。。 38
5. 写出收获和体会(重点) 。。.。.。。。。。。。。。。.。。.。.。。..。。。 39
5.1 已解决和尚未解决的问题.。。。。。。。.。.。.。。。.。。。。。.。。..。。 39
5。2 进一步完善的设想与建议。。..。。...。。。。。。。。。。。.。.。。。。。。 40
6。 参考文献。.。。。.。。.。。.。。.。。..。.。。.。..。。..。。。.。.。。。。.。 40
⒈ 系统规划
1。1 任务分配
组长:***
组员:******
任务分配:
***:建立用户登录界面,员工信息录入,做最后完
善工作.
***:负责员工信息子系统和修改子系统,实验报告的编写.
***:负责数据库的建立和计算子系统,显示子系统,配合编写实验报告.
1。2 可行性分析
1。2.1 运行可行性
随着计算机技术的飞速发展,计算机在企业管理中的应用越来 越普及,利用计算机实现企业工资的管理显得越来越重要。对于大中型企业来说,利用计算机支持企业高效率完成劳动人事管理的日常事务,是适应现代企业制度要 求、推动企业劳动人事管理走向科学化、规范化的必要条件;而工资管理是一项琐碎、复杂而又十分细致的工作,工资计算、发放、核算的工作量很大,一般不允许 出错,如果实行手工操作,每月发放工资须手工填制大量的表格,这就会耗费工作人员大量的时间和精力,计算机进行工资发放工作,不仅能够保证工资核算准确无 误、快速输出,而且还可以利用计算机对有关工资的各种信息进行统计,服务于财务部门其他方面的核算和财务处理,同时计算机具有手工管理所无法比拟的优点。 例如:检索迅速、查找方便、可靠性高、存储量大、保密性好、寿命长、成本低等。这些优点能够极大地提高人事工资管理的效率,也是企业的科学化、正规化管 理,与世界接轨的重要条件。
企业的工资管理是公司管理的一个重要内容。随着当今企业人员数量增加,企业的工资计算也变得越来越复杂。如果能够实现工资管理的自动化,无疑是给企业管理部门带来很大的方便。
资金是企业生存的主要元素。资金的流动影响到企业的整体运 作,企业员工的工资是企业资金管理的一个重要的组成部分,因为企业每个月都要涉及发放企业员工工资的问题.企业员工的人数越多,工资的统计工作就越多,工 资的发放困难就越大。最初的工资统计和发放都是使用人工方式处理,工作的时候,出现错误的机率也随之升高。工资管理系统就是使用电脑代替大量的人工统计和 计算,完成众多工资信息的处理,同时使用电脑还可以安全地保存大量的工资记录。
企业工资管理系统,为个人提供工资查询服务,为企业提供工 资计算,工资统计等服务.传统的纸张材料的数据信息管理已经不适合现代企业公司的发展了,实现工资管理的系统化、规范化、自动化,将成为现在公司管理工资 的首选.本系统实现的工资管理系统基本上能够满足现代化企业工资管理的需求。
1。2.2 技术可行性
该系统采用的是数据库技术和C#技术之间建立连接,使用SQL语句建立表格,C#语句编写程序,数据库服务器负责数据的输入,C#负责数据输入,修改,查询,统计,输出.在这两个系统之间建立连接,好处是数据运算集中在服务器端进行,在网络上传输的只是检索式与运算结果。使数据的传输具有可靠性,不用担心数据在处理过程中丢失.
1.3。1 划分子系统
根据需求分析阶段得到的功能需求,管理员通过输入用户名号和密码进下该系统后,可以进行一些基本查询(员工信息查询,工资信息查询,工资变动信息查询)、还可以进行员工删除和添加员工的操作,管理员通过登录并输入密码,可以进行查询的员工的信息(工资,工资变动)。
模块功能大概可以分为如下7个方面:这几个模块登陆,输入员工信息,查询员工信息,修改员工信息,计算员工的总工资,显示员工信息,退出。综上所述,得到客户端功能模块图如下图所示。
1.4 制定信息系统开发方案及日程安排
1。4.1 对各子系统的评价
输入:输入基本数据并且添加新的数据成员,补全数据库。
修改:对已存在的数据库中的信息进行修改操作,更改数据。
查询:查询数据库中的数据信息,明确要查找的资料。
计算:对于要计算的某项内容进行查找并且计算,得出总工资.
输出:输出员工信息,并且展示出来。
1。4。2 信息系统资源分配计划
运用登录界面进行信息保护,允许业主和物业管理处进行信息的维护和查询,而其他外界不能进入信息系统,实现信息保护与个人隐私维护[3].
将用户资料等内容放入业主信息表里面,包括业主编号,姓名楼盘编号等内容,可以通过业主编号查看业主的缴费情况,通过楼盘编号查看业主的房子的信息;将楼盘信息放入房产资源表中,可以查看楼盘信息;将收费信息放入收费信息表中,可以了解所有的收费项目;将缴费信息放入缴费信息表里,并且可以通过业主编号查看业主缴费情况,通过收费编号查看缴费的项目。并且通过各个子系统对四个项目进行输入,修改,查询,统计,输出等操作,实现数据的应用。
登陆
输入
显示
计算
修改
查询
(1)。 选择[登陆] 以管理员的身份进入登陆界面。点击确定显示功能菜单
(2)。 选择[输入] 输入员工信息,工资信息,工资变动信息
(3)。 选择[查询] 按员工号查询相应信息
(4). 选择[修改] 按员工号修改相应信息
(5). 选择[计算] 计算总工资
(6)。 选择[显示] 显示所有信息
(7)。 选择[返回]将返回整个系统。
⒉ 系统分析
2.1 需求确定
2。1。1。 数据库的E-R图及合并部分视图生成E—R 图
员工号
员工信息E-R图:
员工名
部门
Worker
年龄
性别
日期
员工号
总工资
基本工资
奖金
Salary
员工工资信息E-R图:
管理员E—R图:
员工号
Usename
密码
工资变动E—R图:
加班费
加班时间
误工时间
Salarychange
员工号
误工费
2.2 需求分析
2。2.1 系统性需求分析
本系统的开发宗旨以及总体任务就是帮助企业的财务主管部门提高工作效率,实现企业工资信息管理的自动化、规范化和系统化。所以为了能够实现编制这个系统所设定的目标,在程序的开发之前,需求分析是必不可少的.
需求分析的第一步描述工资管理系统的功能,即定义用例,以此确定系统的功能需求.工资管理系统的用例分析主要是找出系统中所有的用例,因此要和工资管理系统的潜在用户进行讨论.系统最终实现的主要功能如下:
a 员工基本信息模块
员工基本信息模块具有员工信息输入、员工增删和员工信息查询三个功能。员工基本信息包括员工编号、员工姓名、员工性别、所在部门、年龄等信息。员工增删实现了对数据库中员工信息的增加和删除。
b 工资结构设置模块
根据该公司的工资管理实际情况,本系统将工资结构分为基础工资、实发工资、奖金和年月四部分.该模块可以对这两个工资类型设置工资等级,并对每个等级设置工资标准.
c 员工工资变动模块
用户在员工工资变动模块可查询员工变动的基本记录。
2.2.2 数据库结构设计
根据上面概念结构设计阶段得到的E—R图,下一步应该将它转化为关系模型.可以得到对应的关系模式为:
Worker(员工号,员工名,性别,年龄,部门)
Salary(员工号,基本工资,奖金,年月,总工资)
Usename(用户号,密码)
Salarychange(员工号,加班时间,加班费用,误工数,误工费)
⒊ 系统设计
3。1数据库表设计
登录表
Worker表
Salary表
Salarychange表
3。2数据库代码设计
代码:
登陆代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System。Linq;
using System。Text;
using System.Windows。Forms;
using System.Data。SqlClient;
namespace SALARY
{
publicpartialclassForm1 : Form
{
public Form1()
{
InitializeComponent();
}
privatevoid Form1_Load(object sender, EventArgs e)
{
string connstring = @”Data Source=dell—pc\ sqlexpress;Initial Catalog=tianling;Integrated Security=True”;
SqlConnection connection = newSqlConnection(connstring);
connection.Open();
}
privatevoid OK_Click(object sender, EventArgs e)
{
if(notxt.Text==” ” || pswtxt.Text==” ”)
{
MessageBox.Show("用?户§名?或ò密ü码?不?为a空?!?”, "提?示?”, MessageBoxButtons。OK, MessageBoxIcon。Information);
return;
}
else
{
string username = notxt。Text;
string password = pswtxt。Text;
string connstring = @"Data Source=dell—pc\sqlexpress;Initial Catalog=tianling;Integrated Security=True";
SqlConnection connection = newSqlConnection(connstring);
string Sql = String。Format(”select count(*) from [user] where username=’{0}’and password='{1}’”, username, password);
try
{
connection。Open();
SqlCommand cmd = newSqlCommand(Sql, connection);
int num = (int)cmd。ExecuteScalar();
if (num 〉 0)//判D断?是?否?包悒?含?数簓据Y
{
//MessageBox。Show(”欢?迎?进?入?工¤资哩?管ü理え?系μ统?", "登?陆?成é功|", MessageBoxButtons.OK, MessageBoxIcon。Information);
this。Hide();
Form2 a = newForm2();
a。Show();
}
else
{
notxt。Text = ””;
pswtxt 。Text = ””;
MessageBox。Show(”用?户§名?或ò密ü码?错洙?误ó!?”, ”提?示?”, MessageBoxButtons。OK, MessageBoxIcon.Exclamation);
}
}
catch(Exception ex)
{
MessageBox。Show(ex。Message ,”操ù作痢?数簓据Y库a错洙?误ó!?”, MessageBoxButtons。OK, MessageBoxIcon。Exclamation);
}
}
}
privatevoid cancle_Click(object sender, EventArgs e)
{
notxt.Text = "”;
pswtxt。Text = ”";
notxt.Focus();
this.Close();
}
}
}
登录截图:
菜单代码:
using System;
using System。Collections.Generic;
using System。ComponentModel;
using System.Data;
using System。Drawing;
using System。Linq;
using System。Text;
using System。Windows.Forms;
using System.Data.SqlClient;
namespace SALARY
{
publicpartialclassForm2 : Form
{
public Form2()
{
InitializeComponent();
}
privatevoid input_Click(object sender, EventArgs e)
{
this。Close();
Form3 add = newForm3();
add.Show();
}
privatevoid change_Click(object sender, EventArgs e)
{
this。Close();
Form4 add = newForm4();
add.Show();
}
privatevoid select_Click(object sender, EventArgs e)
{
this.Close();
Form5 add = newForm5();
add。Show();
}
privatevoid calculate_Click(object sender, EventArgs e)
{
this。Close();
Form6 add = newForm6();
add.Show();
}
privatevoid diplay_Click(object sender, EventArgs e)
{
this。Close();
Form7 add = newForm7();
add。Show();
}
privatevoid exit_Click(object sender, EventArgs e)
{
this。Close();
}
}
}
菜单截图:
输入信息代码:
using System;
using System。Collections。Generic;
using System。ComponentModel;
using System.Data;
using System。Drawing;
using System.Linq;
using System.Text;
using System.Windows。Forms;
using System.Data。SqlClient;
namespace SALARY
{
publicpartialclassForm3 : Form
{
public Form3()
{
InitializeComponent();
}
privatevoid yes_Click(object sender, EventArgs e)
{
string no = notxt。Text;
string name = nametxt。Text;
string sex = sextxt。Text;
string age = agetxt。Text;
string dept = depttxt.Text;
if (notxt。Text == ”” || nametxt。Text == ”” || sextxt.Text == ”” || agetxt。Text == ”" || depttxt。Text == ”” || textBox8。Text == ”” || textBox7.Text == ”" || textBox6。Text == "” || textBox2.Text == ”” || textBox18.Text == ”" || textBox17.Text == ”" || textBox16.Text == ”” || textBox15.Text == ”" )
{
MessageBox。Show(”员±工¤信?息¢不?能ü为a空?!?”, "提?示?”, MessageBoxButtons。OK, MessageBoxIcon.Information);
return;
}
string Sql = String。Format(”insert into worker (no,name,sex,age,dept) values (’{0}’,'{1}',’{2}','{3}',’{4}')", notxt。Text, nametxt.Text, sextxt。Text, agetxt.Text, depttxt。Text);
try
{
string connstring = @"Data Source=dell—pc\sqlexpress;Initial Catalog=tianling;Integrated Security=True";
SqlConnection connection = newSqlConnection(connstring);
connection。Open();
SqlCommand command = newSqlCommand(Sql,connection);
int count = command.ExecuteNonQuery();
if(count 〉 0 )
{
MessageBox。Show (”添?加ó信?息¢成é功|”, ”添?加ó成é功|”, MessageBoxButtons。OK,MessageBoxIcon。Information);
}
else
{
MessageBox.Show("添?加ó信?息¢失骸?败悒?, ”添?加ó失骸?败悒?, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch (Exception ex)
{
MessageBox。Show(ex。Message,”操ù作痢?数簓据Y库a出?错洙?!?",MessageBoxButtons.OK,MessageBoxIcon。Exclamation);
}
}
privatevoid close_Click(object sender, EventArgs e)
{
this.Close();
Form2 re = newForm2();
re。Show();
}
privatevoid button1_Click(object sender, EventArgs e)
{
string no = notxt。Text;
string basic = textBox8。Text;
string total = textBox7.Text;
string date = textBox6.Text;
string bonus = textBox2.Text;
if (notxt.Text == "” || textBox8。Text == ”” || textBox7.Text == ”" || textBox6。Text == "” || textBox2.Text == ”” )
{
MessageBox。Show(”员±工¤信?息¢不?能ü为a空?!?”, ”提?示?”, MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
string connstring = @”Data Source=dell—pc\sqlexpress;Initial Catalog=tianling;Integrated Security=True";
string Sql1 = String。Format(”insert into salary (no,basic,total,date,bonus) values (’{0}’,’{1}’,’{2}’,’{3}','{4}')”, notxt。Text, textBox8。Text, textBox7.Text, textBox6.Text, textBox2。Text);
SqlConnection connection1 = newSqlConnection(connstring);
connection1。Open();
SqlCommand command1 = newSqlCommand(Sql1, connection1);
int count = command1。ExecuteNonQuery();
if (count 〉 0)
{
MessageBox。Show("添?加ó信?息¢成é功|”, ”添?加ó成é功|”, MessageBoxButtons.OK, MessageBoxIcon。Information);
}
else
{
MessageBox。Show(”添?加ó信?息¢失骸?败悒?, ”添?加ó失骸?败悒?, MessageBoxButtons。OK, MessageBoxIcon。Exclamation);
}
}
privatevoid button2_Click(object sender, EventArgs e)
{
string no = notxt。Text;
string overtime = textBox18.Text;
string extrapay = textBox17。Text;
string delaytime = textBox16。Text;
string delaymoney = textBox15。Text;
if (notxt.Text == ”” || textBox18。Text == ”” || textBox17.Text == ”” || textBox16.Text == "” || textBox15.Text == ”" )
{
MessageBox。Show(”员±工¤信?息¢不?能ü为a空?!?”, "提?示?", MessageBoxButtons。OK, MessageBoxIcon。Information);
return;
}
string connstring = @”Data Source=dell-pc\sqlexpress;Initial Catalog=tianling;Integrated Security=True";
string Sql2 = String。Format(”insert into salarychange (no,overtime,extrapay,delaytime,delaymoney) values ('{0}',’{1}',’{2}’,'{3}’,’{4}’)", notxt。Text, textBox18。Text, textBox17。Text, textBox16.Text, textBox15。Text);
SqlConnection connection2 = newSqlConnection(connstring);
connection2.Open();
SqlCommand command2 = newSqlCommand(Sql2, connection2);
int count = command2.ExecuteNonQuery();
if (count 〉 0)
{
MessageBox。Show(”添?加ó信?息¢成é功|”, ”添?加ó成é功|”, MessageBoxButtons。OK, MessageBoxIcon。Information);
}
else
{
MessageBox。Show(”添?加ó信?息¢失骸?败悒?, ”添?加ó失骸?败悒?, MessageBoxButtons.OK, MessageBoxIcon。Exclamation);
}
}
privatevoid button3_Click(object sender, EventArgs e)
{
string connstring = @”Data Source=dell—pc\sqlexpress;Initial Catalog=tianling;Integrated Security=True”;
string Sql3 = String。Format(”insert into log(no,psw) values (’{0}',’123’)”, notxt。Text);
SqlConnection connection3 = newSqlConnection(connstring);
connection3.Open();
SqlCommand command3= newSqlCommand(Sql3, connection3);
int count = command3.ExecuteNonQuery();
if (count 〉 0)
{
MessageBox。Show("初?始?化ˉ成é功|", "成é功|”, MessageBoxButtons。OK, MessageBoxIcon。Information);
}
else
{
MessageBox。Show("初?始?化ˉ失骸?败悒?, ”失骸?败悒?, MessageBoxButtons.OK, MessageBoxIcon。Exclamation);
}
}
}
}
输入截图:
修改代码:using System;
using System。Collections。Generic;
using System。ComponentModel;
using System。Data;
using System。Drawing;
using System。Linq;
using System.Text;
using System。Windows。Forms;
using System。Data。SqlClient;
namespace SALARY
{
publicpartialclassForm4 : Form
{
public Form4()
{
InitializeComponent();
}
privatevoid Form4_Load(object sender, EventArgs e)
{
button6。Visible = false;
button7.Visible = false;
textBox9.Visible = textBox8。Visible = textBox7.Visible=textBox6。Visible = false;
textBox2。Visible = textBox3.Visible = textBox4。Visible = textBox5。Visible = false;
}
privatevoid button3_Click(object sender, EventArgs e)
{
textBox6.Visible = textBox7.Visible = textBox8.Visible = textBox9。Visible = true;
textBox2.Enabled = textBox3。Enabled = textBox4。Enabled = textBox5。Enabled =true;
button6。Visible = false;
button7。Visible = false;
}
privatevoid button1_Click(object sender, EventArgs e)
{
try
{
string a = textBox1。Text。ToString();
string b = textBox2。Text。ToString();
string c = textBox3.Text。ToString();
string d = textBox4。Text.ToString();
string f = textBox5。Text.ToString();
string connstring = @”Da
展开阅读全文