采用VS2010和Microsoft office access来设计实现
一、 系统分析
1. 功能图
|
2. 数据表结构
1) 读者管理表
序号 | 字段名 | 数据类型 | 长度 | 备注 |
1 | 读者编号 | 字符串 | 255 | 主键 |
2 | 读者名称 | 字符串 | 255 |
|
3 | 读者手机号码 | 字符串 | 255 |
|
4 | 读者性别 | 字符串 | 255 |
|
5 | 读者年龄 | 字符串 | 255 |
|
2) 罚款信息表
序号 | 字段名 | 数据类型 | 长度 | 备注 |
1 | 图书编号 | 字符串 | 255 | 主键 |
2 | 读者编号 | 字符串 | 255 |
|
3 | 借书是否超期 | 字符串 | 255 |
|
4 | 罚款金额 | 字符串 | 255 |
|
3) 还书表
序号 | 字段名 | 数据类型 | 长度 | 备注 |
1 | 图书编号 | 字符串 | 255 | 主键 |
2 | 读者编号 | 字符串 | 255 |
|
3 | 借书日期 | 字符串 | 255 |
|
4 | 指定还书日期 | 字符串 | 255 |
|
5 | 实际还书日期 | 字符串 | 255 |
|
4) 借书表
序号 | 字段名 | 数据类型 | 长度 | 备注 |
1 | 图书编号 | 字符串 | 255 | 主键 |
2 | 读者编号 | 字符串 | 255 |
|
3 | 借书日期 | 字符串 | 255 |
|
4 | 指定还书截止日期 | 字符串 | 255 |
|
5 | 借书数量 | 数字 | 自动 |
|
6 | 备注 | 字符串 | 255 |
|
5) 图书管理表
序号 | 字段名 | 数据类型 | 长度 | 备注 |
1 | 图书编号 | 字符串 | 255 | 主键 |
2 | 图书名称 | 字符串 | 255 |
|
3 | 图书作者 | 字符串 | 255 |
|
4 | 出版社 | 字符串 | 255 |
|
5 | 图书价格 | 字符串 | 255 |
|
6) 账号表
序号 | 字段名 | 数据类型 | 长度 | 备注 |
1 | 账号 | 字符串 | 255 | 主键 |
2 | 密码 | 字符串 | 255 |
|
二、系统设计
1、用户登录
A. 说明
用户账号与密码与数据库相连,输入正确则显示“登陆成功!”,输入错误则显显示“您输入的账号不存在或密码有误,请重新输入!”。点击取消按钮则跳出询问框询问“你是否真的要退出系统?”。
B. 核心代码
Private Sub btndenglu_Click(ByValsender As System.Object, ByVal e As System.EventArgs) Handles btndenglu.Click
Dim strID As String = String.Empty
Dim strpass As String = String.Empty
Dim ret As Boolean
Dim manager As New Manager.Manager
Dim BookFMain15 As New BookFMain15
'获取用户输入的账号和密码
strID = txtID.Text.Trim()
strpass = txtpass.Text.Trim()
ret = manager.isUserExist(strID,strpass)
If ret = True Then
Me.Hide()
BookFMain15.Show()
MessageBox.Show("登录成功!")
Else
MessageBox.Show("您输入的帐号不存在或密码有误,请重新输入","警告", MessageBoxButtons.OK,MessageBoxIcon.Warning)
txtID.Text = ""
txtpass.Text = ""
End If
End Sub
PrivateSub btncancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles btncancel.Click
'设置一个值
Dim ret As DialogResult
ret = MessageBox.Show("你是否真的要退出系统?","询问", MessageBoxButtons.YesNo,MessageBoxIcon.Question)
If ret = Windows.Forms.DialogResult.YesThen
Me.Close()
Else
txtID.Text = ""
txtpass.Text = ""
End If
End Sub
① 控件设计
序号 | 项目名 | 类型 | 文字 | 备注 |
1 | BookFMainLogin | Form | 图书管理登录界面 |
|
2 | btncancel | Button | 取消 |
|
3 | btndenglu | Button | 登录 |
|
4 | lblbiaoti | Label | 图书管理系统 |
|
5 | lblID | Label | 账号 |
|
6 | lblpass | Label | 密码 |
|
7 | llbforget | Label | 忘记密码 |
|
8 | llbzhuce | Label | 注册账号 |
|
9 | txtID | TextBox |
|
|
10 | txtpass | TextBox |
|
|
11 | StatusStrip1 | StatusStrip | StatusStrip1 |
|
12 | Timer1 | Timer |
|
|
13 | ToolStripStatusLabel1 | ToolStripStatusLabel |
|
|
14 | tsslbanquan | ToolStripStatusLabel | 版权所有:图书馆 |
|
15 | tssltime | ToolStripStatusLabel | ToolStripStatusLabel2 |
|
2、用户注册和忘记密码
1) 用户注册
A. 核心代码
Private Subbtnzhuce_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)Handles btnzhuce.Click
Dim zhanghao As String
Dim mima As String
'获取用户输入的账号和密码
zhanghao = txtzhanghao.Text.Trim()
mima = txtmima.Text.Trim()
'生成一个用户的信息
Dim yonghu As New yonghu
yonghu.zhanghao = zhanghao
yonghu.mima = mima
'调用业务逻辑层里面的一个添加用户的方法
Dim ret As Boolean
Dim manager As New Manager.Manager
ret = manager.zhuceyonghu(yonghu)
If ret = True Then
MessageBox.Show("用户信息添加成功!","提示", MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
MessageBox.Show("用户信息添加失败!","提示", MessageBoxButtons.OK,MessageBoxIcon.Warning)
End If
① 控件设计
序号 | 项目名 | 类型 | 文字 | 备注 |
1 | BookFMainzhuce | Form | BookFMainzhuce |
|
2 | btntuichu | Button | 退出注册重新登录 |
|
3 | btnzhuce | Button | 注册 |
|
4 | lblmima | Label | 密码 |
|
5 | lblzhanghao | Label | 账号 |
|
6 | StatusStrip1 | StatusStrip | StatusStrip1 |
|
7 | Timer1 | Timer |
|
|
8 | ToolStripStatusLabel1 | ToolStripStatusLabel |
|
|
9 | tsslbanquan | ToolStripStatusLabel | 版权所有:图书馆 |
|
10 | ToolStripStatusLabel2 | ToolStripStatusLabel | ToolStripStatusLabel2 |
|
11 | txtmima | TextBox |
|
|
12 | txtzhanghao | TextBox |
|
|
① 控件设计
序号 | 项目名 | 类型 | 文字 | 备注 |
1 | BookFMainforget | Form | BookFMainforget |
|
2 | btnsure | Button | 确认 |
|
3 | btntuichu | Button | 退出 |
|
4 | Label1 | Label | 账号 |
|
5 | Label2 | Label | 密码 |
|
6 | txtmima | TextBox |
|
|
7 | txtzhanghao | TextBox |
|
|
8 | StatusStrip1 | StatusStrip |
|
|
9 | Timer1 | Timer |
|
|
10 | ToolStripStatusLabel1 | ToolStripStatusLabel |
|
|
11 | tsslbanquan | ToolStripStatusLabel | 版权所有:图书馆 |
|
12 | tssltime | ToolStripStatusLabel | ToolStripStatusLabel2 |
|