一、作业信息

博客班级

软件工程

作业要求 作业要求
作业目标 你理解的作业目标具体内容
学号 3180701218

二、题目要求

编写一个ATM管理系统,语言不限,要求应包括以下主要功能:
(1)开户,销户
(2)查询账户余额
(3)存款
(4)取款
(5)转账(一个账户转到另一个账户)等...

三、代码

这次作业用SQL sever+VS2019写的,主要想复习一下去年学的SQL语言,再熟悉熟悉VS2019编写环境。

1、SQL代码

(1)首先建立ATM数据库和银行账户信息表masge,信息表存有用户的姓名、银行卡号、身份证号、电话、密码、余额等信息。

create database ATM

create table masge
(
name char(10) not null--姓名,
id char(18) primary key--身份证号,
cnode char(19) not null unique--银行卡号,
cal char(11) not null unique--电话号码,
code char(50) not null,--这里银行卡和注册密码一样
balance int--余额
)
go

(2)ATM管理系统需要实现开户、注销、查询、存款、取款、转账等功能,这里都使用存储过程来实现。

①开户

用户输入姓名、身份证号、银行卡号、电话号码、密码,并判断该用户是否已注册。其中result和msg是存储过程的输出变量,result是布尔变量,用作开户是否成功的标志;msg是字符串变量,存放开户是否成功的信息。

create proc login
@name char(10),
@id char(18),
@cnode char(19),
@cal char(11),
@code char(50),
@result bit out,
@msg char(200) out
as
begin
if exists(select id from masge where id=@id)begin
select @result=0,@msg='用户已存在!'
end else begin
begin try
insert into masge(name,id,cnode,cal,code)
values(@name,@id,@cnode,@cal,@code)
end try
begin catch
select @result=0,@msg=error_message()
end catch
end
end
go

②注销

create proc logout
@id char(18)
as
begin
delete
from masge
where id=@id
end
go

③查询

create proc inquire
@id char(18),
@balance int output
as
begin
select @balance=balance from masge where id=@id
end
go

④存款

create proc saves
@id char(18),
@balance int
as
begin
update masge
set balance=balance+@balance
where id=@id
end
go

⑤取款

create proc withdraw
@id char(18),
@m int
as
begin
update masge
set balance=balance-@m
where id=@id
end
go

⑥转账

这里使用了事务,若用户身份证号输入错误,事务回滚转,不执行账操作;如果用户操作正确,继续执行。

create proc transfer
@id char(18),
@id_ char(18),--被转的账户
@m int,
@result bit out,
@msg char(200) out
as
begin
begin tran --开始事务
begin try
if not exists(select * from masge where id=@id_)begin
select @result=0,@msg='用户不存在'
end else begin
update masge
set balance=balance-@m
where id=@id
update masge
set balance=balance+@m
where id=@id_
select @result=1,@msg=''
end
end try
begin catch
select @result=0,@msg=error_message()
end catch
if(@result=0)begin
rollback tran --执行出错,回滚事务
end else begin
commit tran --没有异常,提交事务
end
end
go

⑦登录

create proc logon
@id char(18),
@code char(50),
@result bit out,--返回值
@msg char(200) out--返回信息
as
begin
begin try
if not exists(select id from masge where id=@id)begin
select @result=0,@msg='用户不存在!'
end else if not exists(select * from masge where code=@code and id=@id)begin
select @result=0,@msg='密码错误!'
end else begin
select @result=1,@msg=''
end
end try
begin catch
select @result=0,@msg=error_message()
end catch
end
go

2、VS2019连接SQL数据库

VS2019连接SQL数据库,以及相关的网页项目操作,这里就不多说了,感兴趣的话可以看看下面up主的视频
SQL Server项目实战

四、运行截图

①登录与注册









②查询



③存款



④取款



⑤转账



⑥注销

五、psp表格

psp2.1 任务内容 计划完成需要的时间(min) 实际完成需要的时间(min)
Planning 计划 10 10
Estimate 估计这个任务需要多少时间,
并规划大致工作步骤
10 5
Development 开发 100 120
Analysis 需求分析(包括学习新技术) 12 5
Design Spec 生成设计文档 5 10
Design Review 设计复审 5 5
Coding Standard 代码规范 3 2
Design 具体设计 10 20
Coding 具体编码 36 50
Code Review 代码复审 5 7
Test 测试(自我测试,修改代码,提交修改) 10 20
Reporting 报告 9 6
Test Report 测试报告 3 2
Size Measurement 计算工作量 2 1
Postmortem & Process Improvement Plan 事后总结,并提出过程改进计划 3 3

六、总结

功能不太完善,由于时间原因,该系统只能检测用户是否存在,没有判断输入的银行卡号和该人信息是否符合;

操作繁琐,该系统是在web窗体执行的,ASP.net项目中,点击Button,就会发生页面刷新,之前定义的全局变量的值就会消失,因此用户登录时输入的身份证号无法保存,用户进行查询、转账等操作时需要频繁输入身份证号。

最新文章

  1. 使用 Google Fonts 为网页添加美观字体
  2. Python Opearte SQLAlchemy Do Something
  3. 【Android 开源】:最火的Android开源项目 第02期
  4. Number对象
  5. Codeforce 217 div2
  6. 第一章 工欲善其事 其利润—Android SDK工具(2)
  7. iOS 8 AutoLayout与Size Class自悟(转载)
  8. MySQL远程訪问的两个问题
  9. 有用的linux命令笔记
  10. [总结] fhq_Treap 学习笔记
  11. 特殊字符的过滤,防止xss攻击
  12. chrome extensions notifications
  13. vue中常用的指令
  14. Java - "JUC" CountDownLatch源码分析
  15. BEM
  16. XML_CPP_资料_libXml2_01_Code_ZC(?.pro)
  17. Java并发编程原理与实战十九:AQS 剖析
  18. android 模拟器无法ping通主机
  19. 平面ray trace的数据结构加速
  20. postgres_fdw

热门文章

  1. flink 处理实时数据的三重保障
  2. linux 手动配置ip地址方法
  3. 使用Pytorch搭建模型
  4. vue table切换 (不使用路由功能)
  5. 在Linux系统中安装Chrome浏览器
  6. Mysql优化建议
  7. 浅谈分布式共识算法raft
  8. NB-IOT的应用场景有哪些
  9. 我的 Redis 被入侵了
  10. AQS解析