摘 要
信息技术的飞速发展,尤其是网络通讯技术、数据库技术及自动化技术的日新月异,为单位、企业的办公带来了极大的便利。但是由于单位、企业的工作性质众多,工作流程各有差异,企业、单位、部门之间的管理机制各不相同,从而使单位、企业不能对工作计划流程进行有效的控制,导致各种资源的浪费,因此工作计划流程管理系统应运而生。
本设计着重解决了三方面的问题:(1)、根据人员的权限实现对工作计划的创建;(2)、根据人员的权限实现对工作完成情况的录入;(3)、根据人员的权限实现对工作的审查。工作计划流程管理系统主要分为工作计划的创建区、工作人员的工作区与工作的审查区三个模块,其中工作区是整个工作计划流程管理系统的核心。
本文共五章,第一章对当前背景与国内外现状进行分析;第二章对数据库技术、面向对象的技术进行简单介绍;第三章对当前单位、企业进行了需求分析并提出解决方案;第四章根据解决方案对系统进行设计;第五章对工作计划流程管理系统进行测试并得出测试结果。
**关键词:**工作计划流程;创建;工作区;审查;权限
2.1 数据库技术
关系数据库解决了网状数据库和层次数据库在数据的独立性和抽象级别上的缺陷,SQL就属于关系数据库。SQL有Internet 集成、可伸缩性和可用性、企业级数据库功能、易于安装,部署和使用、数据仓库的特性。SQL是专为数据库而建立的操作命令集,是一种功能齐全的数据库语言。是目前使用最广泛的数据库,它与windows网络操作系统的无缝继承,智能化的内容管理,强大的功能,使它得到广大用户的喜爱。
2.2 面向对象技术
工作计划流程管理系统采用了C#语言,C#语言是从面向对象语言C++派生出来的,是为.net量身定做的编程语言,功能非常强大,是asp.net的编程基础。C#本身并无类库,而是直接使用.net框架所提供的类库。C#不仅具有C++的强大功能,而且具有Visual Basic简单易用的特性。C#的语法与C++基本相同,最大的变化是没有了C和C++中的指针,C#只支持其中的一个"."。C#具有面向对象的编程语言所应用的一切特性,如封装、继承和多态。在C#的类型系统中,每种类型都可以看作一个对象,但C#只允许单继承,即一个类不会有多个基类,从而避免了类型定义的混乱。 C#没有全局函数、全局变量和全局常量,所有的变量、常量和函数都必须封装在一个类中。因此,用C#编写代码具有更好的可读性,而且减少了发生命名冲突的可能。
2.3 B/S架构的WEB程序设计技术
B/S(Browser/Server)结构即浏览器和服务器结构。B/S(浏览器/服务器模式)是随着Internet技术的兴起,对C/S结构的一种改进。在这种结构下,软件应用的业务逻辑完全在应用服务器端实现,用户表现完全在Web服务器实现,客户端只需要浏览器即可进行业务处理,是一种全新的软件系统构造技术,这种结构更成为当今应用软件的首选体系结构。
4.3 系统功能模块设计
4.3.1 登录
图4-4 登录界面
图4-5 登录失败界面
图4-6 主页面(登录成功后显示)
图4-4中利用"登录"按钮来接收数据的具体代码如下:
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ............ //创建连接对象和命令对象 SqlConnection myConnection=new SqlConnection(ConfigurationSettings.AppSettings["connectionString"]); SqlCommand myCommand=new SqlCommand("UserLogin",myConnection); //定义命令对象的类型为存储过程 myCommand.CommandType=CommandType.StoredProcedure; //向存储过程中添加参数 SqlParameter parameterLoginName=new SqlParameter("@login_id", SqlDbType.Int); parameterLoginName.Value=TextBox1.Text; myCommand.Parameters.Add(parameterLoginName); //参数集合的对象,专门用于接收数据 SqlParameter parameterPassword=new SqlParameter("@customer_passwd", SqlDbType.NVarChar,16); parameterPassword.Value=TextBox2.Text; myCommand.Parameters.Add(parameterPassword); SqlParameter parameterSuccess=new SqlParameter("@success",SqlDbType.Int); parameterSuccess.Direction=ParameterDirection.Output; myCommand.Parameters.Add(parameterSuccess); ............ | |
对登录有两种处理,首先根据parameterSuccess.Value的值判断输入的用户名与密码是否在数据库中有相对应的,如果有则转入图4-6;如果没有则转入图4-5,并生成相应的错误信息。具体代码如下:
|---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| |
| | |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ............ if ((int)parameterSuccess.Value>0) { //登陆成功 FormsAuthentication.SetAuthCookie (TextBox1.Text,false); Response.Redirect("seeworks.aspx"); else { Label3.Text="登录失败,请检查你的帐号和密码.";//提示错误信息 } ............ | |
4.3.2 录入系统
图4-7 录入工作界面
根据录入权限进行了两种处理,具有录入权限(即luru字段为1)的员工进入录入界面图4-7,不具有录入权限的员工进入无权的提示页面。具体代码如下:
|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| |
| | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ............ string rb=Context.User.Identity.Name; //获取当前用户名 SqlConnection conn1=new SqlConnection("server=(local);database=jihua;user id='sa';password='123';"); conn1.Open(); SqlDataAdapter myAdapter=new SqlDataAdapter("select b.luru as 权限 from users a,bumen b where a.group_id=b.group_id and a.login_id='"+rb+"'",conn1); //取出当前用户权限 DataSet ds=new DataSet(); DataTable dt=new DataTable(); dt=ds.Tables.Add("A"); DataColumn dc=new DataColumn(); dc=dt.Columns.Add("权限"); myAdapter.Fill(ds.Tables["A"]); int i=Convert.ToInt32(ds.Tables["A"].Rows[0]["权限"]); if(i==0) //对用户权限进行判断 {Response.Redirect("error.aspx");} conn1.Close(); ............ | |
进入录入系统的人员将能对工作、人员、部门分别进行创建、修改、删除的操作。图4-7界面为创建工作。创建的具体代码如下:
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ............ string zt=DropDownList1.SelectedItem.Value; //获取状态信息 string jj=DropDownList2.SelectedItem.Value; //获取紧急程度信息 string ctime=TextBox3.Text; //获取创建时间信息 string cname=TextBox7.Text; //获取创建者信息 string contain1=TextBox7.Text; //获取内容信息 SqlConnection conn=new SqlConnection("server=(local);database=jihua;user id='sa';password='123';"); string strcomm="insert into works (work_name,zhuangtai,jingji,contain,creattime,creatname) values ('"+name+"','"+zt+"','"+jj+"','"+contain1+"','"+ctime+"','"+cname+"')"; //创建工作操作 SqlCommand comm=new SqlCommand(strcomm,conn); conn.Open(); comm.ExecuteNonQuery(); //将信息入库 conn.Close(); Response.Redirect("luru.aspx"); ............ | |
在新创建一个工作后,要为指定该工作的第一个工作人员,具体代码如下:
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ............ string gb=TextBox1.Text; //获取工作编号 string rb=TextBox8.Text; //获取人员编号 SqlConnection conn=new SqlConnection("server=(local);database=jihua;user id='sa';password='123';"); string strcomm="insert into wcqk (work_id,login_id) values ('"+gb+"','"+rb+"')";//指定某工作的第一个工作人员 SqlCommand comm=new SqlCommand(strcomm,conn); conn.Open(); comm.ExecuteNonQuery();//将信息入库 conn.Close(); Response.Redirect("luru.aspx"); } ............... | |
图4-8 修改工作界面
在创建了工作后,发现工作信息有误或需要进行修改,则进入修改工作界面(图4-8),修改的具体代码:
|---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| |
| | |----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ............ string bh=TextBox1.Text; //获取工作编号 string name=TextBox2.Text;//获取工作名称 string zt=DropDownList1.SelectedItem.Value;//获取状态值 string jj=DropDownList2.SelectedItem.Value;//获取紧急程度值 string ctime=TextBox5.Text;//获取创建时间 string cname=TextBox6.Text;//获取创建者 string contain1=TextBox7.Text;//获取内容 SqlConnection conn=new SqlConnection("server=(local);database=jihua;user id='sa';password='123';"); string strcomm="update works set work_name='"+name+"',zhuangtai='"+zt+"',jingji='"+jj+"',contain='"+contain1+"',creattime='"+ctime+"',creatname='"+cname+"' where work_id='"+bh+"'";//定义修改字符串 SqlCommand comm=new SqlCommand(strcomm,conn); conn.Open(); comm.ExecuteNonQuery();//执行修改库 conn.Close(); Response.Redirect("workxg.aspx"); ............ | |
图4-9 删除工作界面
当需要对工作进行删除时,需要首先删除该工作的完成情况表与审查表中的内容,再进行工作的删除,具体代码:
|---|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| |
| | |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ............ string bh=TextBox1.Text; SqlConnection conn=new SqlConnection("server=(local);database=jihua;user id='sa';password='123';"); string strcomm1="delete sc where work_id='"+bh+"'";//删除审查表中的相关工作评价 string strcomm2="delete wcqk where work_id='"+bh+"'";//删除工作表中的工作情况 string strcomm="delete works where work_id='"+bh+"'";//删除工作 SqlCommand comm1=new SqlCommand(strcomm1,conn); SqlCommand comm2=new SqlCommand(strcomm2,conn); SqlCommand comm=new SqlCommand(strcomm,conn); conn.Open(); comm1.ExecuteNonQuery(); comm2.ExecuteNonQuery(); comm.ExecuteNonQuery(); conn.Close(); Response.Redirect("worksc.aspx"); ............ | |
4.3.3 工作系统
图4-10 工作系统(a)
对进入工作系统的人员进行权限的判别,其具体代码前面已给出,在此不再重复。对进入了工作系统的人员显示需要该工作人员完成的工作。具体代码如下:
|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| |
| | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ............ string a=Context.User.Identity.Name;//获取用户名 SqlConnection conn=new SqlConnection("server=(local);database=jihua;user id='sa';password='123';"); SqlDataAdapter da=new SqlDataAdapter("select a.id as 编号,a.login_id as 工作人员编号,a.work_id as 工作号,a.wanchengf as 完成否,a.qingkuang as 完成情况,b.work_name as 工作名称,b.contain as 内容,c.login_name as 人员名称 from wcqk a,works b,users c where a.work_id=b.work_id and a.login_id=c.login_id and c.login_id='"+a+"'",conn); DataSet dx=new DataSet(); conn.Open(); da.Fill(dx); DataGrid1.DataSource=dx; DataGrid1.DataBind(); conn.Close(); ............ | |
在完成工作后实现对该工作的完成情况进行记录,使工作的完成过程有个完整的记录。具体代码如下:
|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| |
| | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ............ string gb=TextBox1.Text;//获取工作编号 string rb=Context.User.Identity.Name;//获取人员编号 string wc=RadioButtonList1.SelectedItem.Value;//获取完成度 string qk=TextBox3.Text;//获取完成情况 SqlConnection conn=new SqlConnection("server=(local);database=jihua;user id='sa';password='123';"); string strcomm="update wcqk set wanchengf='"+wc+"',qingkuang='"+qk+"' where work_id='"+gb+"'and login_id= '"+rb+"'";//修改字符串 SqlCommand comm=new SqlCommand(strcomm,conn); conn.Open(); comm.ExecuteNonQuery();//执行数据库修改 conn.Close(); Response.Redirect("next.aspx"); ............ | |
图4-11 工作系统(b)
同时在完成工作后能对该工作进行状态的修改,使工作进度与工作的实际状态相符。具体代码如下:
|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| |
| | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ............ string gb=TextBox1.Text;//获取人员编号 string wt=DropDownList1.SelectedItem.Value;//获取完成度 string ft=TextBox2.Text;//获取完成时间 string zt=DropDownList2.SelectedItem.Value;//获取状态 SqlConnection conn=new SqlConnection("server=(local);database=jihua;user id='sa';password='123';"); string strcomm="update works set wancheng='"+wt+"',flishtime='"+ft+"',zhuangtai='"+zt+"' where work_id='"+gb+"'";//修改字符串 SqlCommand comm=new SqlCommand(strcomm,conn); conn.Open(); comm.ExecuteNonQuery();//执行对工作的修改 conn.Close(); Response.Redirect("next1.aspx"); ............ | |
对该页面有两种处理,当工作已经完成点击"结束",当工作还需要安排下一个工作人员,就点击"提交",进入图4-12页面。
图4-12 工作系统(c)
录入该工作的下一步工作人员的具体代码如下:
|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| |
| | |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ............ string gb=TextBox1.Text;//获取工作编号 string rb=TextBox2.Text;//获取人员编号 SqlConnection conn=new SqlConnection("server=(local);database=jihua;user id='sa';password='123';"); string strcomm="insert into wcqk (work_id,login_id) values ('"+gb+"','"+rb+"')";//录入某工作下一步工作人员 SqlCommand comm=new SqlCommand(strcomm,conn); conn.Open(); comm.ExecuteNonQuery();//执行入库 conn.Close(); Response.Redirect("wcgz.aspx"); ............ | |
4.3.4 审查系统
图4-13 审查系统
当工作完成后,相关工作人员将对工作进行审查,只有具有审查权限的人员方可进入,具体的权限判断代码前面已经给出。具有审查权的工作人员可以看到所有已经完成的工作,并能根据所提供的信息,对工作进行评价。具体代码如下:
|---|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| | |
| | |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | //初始化页面代码 ............ SqlConnection conn=new SqlConnection("server=(local);database=jihua;user id='sa';password='123';"); SqlDataAdapter da=new SqlDataAdapter("select a.id as 编号,b.work_id as 工作编号,b.work_name as 工作名称,b.contain as 工作内容,sc_name as 人员编号,b.wancheng as 完成度,a.yijian as 审查意见 from sc a, works b where a.work_id=*b.work_id and b.wancheng='100%'",conn);//查询字符串 DataSet dx=new DataSet(); conn.Open(); da.Fill(dx); DataGrid1.DataSource=dx; DataGrid1.DataBind(); conn.Close(); ............... | |
| |
| | |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | //记录审查情况 ............ string rb=Context.User.Identity.Name;//获取当前人员编号 string gb=TextBox1.Text;//获取工作编号 string yj=TextBox2.Text;//获取审查意见 SqlConnection conn=new SqlConnection("server=(local);database=jihua;user id='sa';password='123';"); string strcomm="insert into sc (work_id,sc_name,yijian) values ('"+gb+"','"+rb+"','"+yj+"')";//创建意见字符串 SqlCommand comm=new SqlCommand(strcomm,conn); conn.Open(); comm.ExecuteNonQuery();//执行入库 conn.Close(); Response.Redirect("sc.aspx"); ............ | |