asp.net课程设计报告网络考勤系统.doc_第1页
asp.net课程设计报告网络考勤系统.doc_第2页
asp.net课程设计报告网络考勤系统.doc_第3页
asp.net课程设计报告网络考勤系统.doc_第4页
asp.net课程设计报告网络考勤系统.doc_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

程序设计课程设计报告书网络考勤系统学院:计算机科学与工程学院 指导老师:罗翌陈 姓名:刘珧姚 学号:1000350103提交日期:2012年9月18日 目 录摘 要-3一、 前言-3二、设计分析-3三、数据库设计-4四、系统部分界面及说明-5五、系统的使用说明书-6六、结论-7附 录-7网络考勤系统的设计和实现 摘 要:我这次的课程设计是网络考勤系统的设计和实现。 具有如下功能: 1、学生可以通过注册时的个人信息生成二维码来进行考勤,考勤过程要借助摄像头和二维码。学生可以通过考勤客户端进行考勤,可以通过浏览网站查看个人信息。2、管理员可以添加,修改,删除学生信息,添加,删除,修改管理员信息。3.可以查看班级考 勤信息,宿舍单元学生考勤信息,全部学生考勤信息,学生信息和管理员信息。为了完成上述功能,我采用了C#语言具体使用了JFrame,JButton等组件。最终我成功的完成了具有以上功能的一个小系统。该系统具有了一个较为简单的界面。在这次课程设计的过程中我第一次尝试了写图形界面系统,虽然最终系统不是很完美,但我的收获也不小。在整个过程中我熟悉了控件的使用,基于 C#的数据库变编程, C#基于客户端服务器模式的编程技巧,接口实现等技术,并成功的应用。总之这次课程设计让我受益颇丰。关键词:课程设计;功能;系统;图形界面; 一、前言 本次课程设计我选的是网络考勤系统的设计和实现。刚开始看到这个题,其他的题目就不想再看了,我本身想做一个这样的系统并将其移植到LPC3250上去,之前想上去可能比较简单,但实际上很有挑战性,但还是熟悉了整个系统实现流程。总之在这次课程设计中,与其说我是在写这个系统不如说我是在学着写这个系统。 二、设计分析 我拿到的这个课题从名称上就可以看出来是一个统计出勤次数的系统,它的要求如下:1. 通过客户端采集学生的考勤信息,比如:学生二维码,考勤时间,IP地址。2. 通过socket发送到服务器。3. 服务器接收数据,并根据学生的二维码,判断是否为本校学生。4. 查询学生住宿单元的IP地址是与学生考勤地点的IP地址相对应。5. 判断学生迟到,缺席等情况后,写入相应的数据库。6. 实现学生个人信息查询。7. 管理员可以添加,删除,修改学生信息。8. 管理员可以修改,查询,删除,添加管理员信息。9. 管理员可以查看各班级学生,各个住宿单元,以及所有学生的考勤信息。10. 实现系统帮助文档。三、实现方法 这个系统我采用了C#语言,用Microsoft Visual Studio 2008和Microsoft SQL Server 2005完成。数据库设计:create table admin/管理员信息(admin_ID char(16) primary key,admin_pwd varchar(16),admin_name varchar(20),admin_sex char(2),admin_unit char(2),foreign key (admin_unit) references unit(unit_ID);create table unit/宿舍单元信息(unit_ID char(2) primary key,/编号unit_IP char(15)/IP地址);create table check_tb/考勤表(stu_ID char(10),check_time varchar(20),check_unit char(2),absent_times int,primary key(stu_ID,check_unit),foreign key (stu_ID) references ST_users (ST_User_id),foreign key (check_unit) references unit (unit_ID);create table ST_users/学生信息(ST_User_id char(10) primary key,ST_User_password varchar(16),ST_User_name varchar(20),ST_User_grade char(8),ST_User_code varchar(50),ST_User_sex char(2),ST_unit char(2);4、 系统部分截图1. 客户端2. 网站登录页面3. 学生界面菜单4. 管理员界面菜单5. 管理员添加5 系统使用说明书系统分为三个大模块:1. 学生模块 1.1学生信息查询 1.2学生考勤2. 管理员模块 2.1管理员信息管理子模块 2.1.1管理员添加 2.1.2管理员信息删除和修改 2.1.3管理员信息查询 2.2学生信息管理子模块 2.2.1学生信息添加 2.2.2学生信息删除和修改 2.2.3学生信息查询 2.3学生考勤信息子模块 2.3.1查询所有考勤记录 2.3.2查询宿舍某单元的考勤记录 2.3.3查询某班级的考勤记录3.系统帮助文档六、结论 完成了这个课题设计,同时我感觉自己的系统设计道路才刚刚起步。前方还有更多的任务等着我去完成。系统设计对我来说还是比较陌生的,在未来的日子里我一定会一点点的进步。 该系统现在时能完成老师对考勤情况统计的要求。而经过修改后就能完成更多的统计任务。相信使用得当能给我的学习生活带来便利。附录:系统源代码客户端:form3.cs源码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.BlueButterFly.QRCodeLib;using System.BlueButterFly.QRCodeLib.Data;using System.IO;using System.Diagnostics;using PMJQRsln;using System.Net;using System.Net.Sockets;using System.Threading;namespace PMJQRsln public partial class Form3 : Form private Socket sender = null; int port = 3988; string ip = ; public Form3() InitializeComponent(); private void button2_Click(object sender, EventArgs e) Process p = new Process(); string apppath = Application.StartupPath; p.StartInfo.FileName = apppath + zb.bat; p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; p.Start(); public void button1_Click(object sender, EventArgs e) try ip = this.textBox1.Text; IPAddress ipAddress = IPAddress.Parse(ip); IPEndPoint remoteEndPoint = new IPEndPoint(ipAddress, port); Socket sender1 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); sender1.Connect(remoteEndPoint); this.textBox3.AppendText(连接成功!); string strSend =this .textBox2.Text; byte bytSend = Encoding.UTF8.GetBytes(strSend); sender1.Send(bytSend); Thread.Sleep(1000); /接收服务器信息 byte byterecv=new byte1024; int lengthrecv = 0; while (lengthrecv = 0) lengthrecv = sender1.Receive(byterecv); string strrecv = Encoding.UTF8.GetString(byterecv, 0, lengthrecv); this.textBox3.AppendText(strrecv); sender1.Close(); catch (Exception e1) 服务器端部分源码:登录页面:default.aspx.cs源码using System;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Collections;using System.ComponentModel;using System.Data.SqlClient;using System.Drawing;using System.Web.SessionState;public partial class _Default : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void Button1_Click1(object sender, EventArgs e) string strconn = Data Source=ADMINISTRATOR-Y;Initial Catalog=考勤;Integrated Security=True; SqlConnection con = new SqlConnection(strconn); SqlCommand mycmd = con.CreateCommand(); mycmd.CommandText = select ST_User_id from ST_users where ST_User_id= + this.TextBox1.Text + + and ST_User_password= + this.TextBox2.Text + ; con.Open(); SqlDataReader dr = mycmd.ExecuteReader(); if (dr.Read() Response.Redirect(ST_query.aspx); else con.Close(); mycmd.CommandText = select admin_ID from admin where admin_ID= + this.TextBox1.Text + + and admin_pwd= + this.TextBox2.Text + ; con.Open(); SqlDataReader dr1 = mycmd.ExecuteReader(); if (dr1 .Read() Response.Redirect(ST_student.aspx); else this.Label1.Text = 用户名或密码错误!; con.Close(); 考勤界面源码:check.aspx.cs源码using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Text;using System.Net.Sockets;using System.Threading;using System.IO;using System.Net;using System.ComponentModel;using System.Data.SqlClient;using System.Data.Sql;public partial class check : System.Web.UI.Page Socket listener = null; int port = 3988; string strText=; string meg = ; string clientip = ; string absent = ; protected void Page_Load(object sender, EventArgs e) protected void Button1_Click(object sender, EventArgs e) IPAddress ipAddress = IPAddress.Parse(35); IPEndPoint localEndPoint = new IPEndPoint(ipAddress, port); Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); / this.Label1.Text = 等连接.; try listener.Bind(localEndPoint); this.Label1.Text = 等连接.; listener.Listen(5); / while (true) / Socket handler = listener.Accept(); this.Label1.Text = 连接成功; clientip = Request.UserHostAddress; byte bytData = new byte1024; int receivedLength = handler.Receive(bytData); strText = System.Text.Encoding.UTF8.GetString(bytData, 0, receivedLength); this.TextBox2.Text = clientip; this.TextBox1.Text = strText; /- /-数据更新- string time = 22:00; DateTime dt1 = Convert.ToDateTime(time); DateTime dt = DateTime.Now;/获取系统时间 string dt24 = dt.ToString(yyyy-MM-dd HH:mm:ss); string strconn4 = Data Source=ADMINISTRATOR-Y;Initial Catalog=考勤;Integrated Security=True; SqlConnection con4 = new SqlConnection(strconn4); con4.Open(); SqlCommand mycmd4 = con4.CreateCommand(); mycmd4.CommandText = select unit_ID from unit where unit_IP= + clientip+; / +dt24 + 0) /添加考勤记录 absent = 否; SqlConnection con1 = new SqlConnection(Data Source=ADMINISTRATOR-Y;Initial Catalog=考勤;Integrated Security=True); if (con1 != null) con1.Open(); try SqlCommand cmd = con1.CreateCommand(); cmd.CommandText = insert into check_tb(stu_ID ,check_time ,check_unit,absent ) values ( + stu_id +,+ dt24 +,+ unit_id +,+ +absent + ); cmd.ExecuteNonQuery(); this.Label1.Text = 添加成功!; con1.Close(); catch (Exception exc) con1.Close(); /-迟到- else if (DateTime.Compare(dt1, dt) 0) /迟到 absent = 迟; SqlConnection con2 = new SqlConnection(Data Source=ADMINISTRATOR-Y;Initial Catalog=考勤;Integrated Security=True); if (con2 != null) con2.Open(); try SqlCommand cmd = con2.CreateCommand(); cmd.CommandText = insert into check_tb(stu_ID ,check_time ,check_unit,absent ) values ( + stu_id + , + + dt24 + , + + unit_id + , + + absent + ); cmd.ExecuteNonQuery(); this.Label1.Text = 添加成功!; con2.Close(); catch (Exception exc) con2.Close(); /-缺席- else absent = 是; SqlConnection con3 = new SqlConnection(Data Source=ADMINISTRATOR-Y;Initial Catalog=考勤;Integrated Security=True); if (con3 != null) con3.Open(); try SqlCommand cmd = con3.CreateCommand(); cmd.CommandText = insert into check_tb(stu_ID ,check_time ,check_unit,absent ) values ( + stu_id + , + + dt24 + , + + unit_id + , + + absent + ); cmd.ExecuteNonQuery(); this.Label1.Text = 添加成功!; con3.Close(); catch (Exception exc) con3.Close(); else meg = failed!; /- try byte bytSend = Encoding.UTF8.GetBytes(meg); handler.Send(bytSend); handler.Close(); catch (Exception exce) handler.Close(); catch (Exception e1) listener.Close(); /发送数据 学生信息添加:stu_add.aspx.cs源码using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.Sql;using System.Data.SqlClient;public partial class std_add : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void 添加_Click(object sender, EventArgs e) /string User = this.TextBox1.Text; / string name = this.TextBox2.Text; / string p

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论