资源简介
用C#模仿银行ATM自动取款机系统,边学边做的 登陆用户名 t ,p,x 密码和用户名相同
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
namespace Atm
{
public partial class BussinessForm : Form
{
public BussinessForm()
{
InitializeComponent();
}
//确定
private void btnConfirm_Click(object sender EventArgs e)
{
string name = txtName.Text;
if (name == null)
{
MessageBox.Show(“请输入预转账卡号“);
return;
}
string money = txtMoney.Text;
if (money == null)
{
MessageBox.Show(“请输入转账金额“);
return;
}
if (name.Equals(UserInfo.user.UserName))
{
MessageBox.Show(“转账卡号不能为当前卡号“);
return;
}
double m = 0;
try
{
m = Convert.ToDouble(money);
}
catch (Exception ex)
{
MessageBox.Show(“转账金额必须为数字“);
return;
}
List listUser = new List();
bool flag = true; //查看预转账卡号是否存在
//创建文件输出流
FileStream fs = new FileStream(“login.txt“FileMode.Open);
StreamReader sr = new StreamReader(fs);
while (true)
{
string message = sr.ReadLine();
if (message == null)
{
break;
}
string[] info = message.Split(‘^‘);
if (info[0].Equals(name))
{
info[2] = (Convert.ToDouble(info[2]) + m).ToString();
flag = false;
}
if (info[0].Equals(UserInfo.user.UserName))
{
if (Convert.ToDouble(info[2]) < m)
{
MessageBox.Show(“转账失败账户余额不足“);
sr.Close();
fs.Close();
return;
}
info[2] = (Convert.ToDouble(info[2]) - m).ToString();
}
User u = new User();
u.UserName = info[0];
u.Pass = info[1];
u.Balance = Convert.ToDouble(info[2]);
}
sr.Close();
fs.Close();
if (flag)
{
MessageBox.Show(“预转账卡号不存在“);
return;
}
//创建文件输入流
fs = new FileStream(“login.txt“FileMode.Open);
StreamWriter sw = new StreamWriter(fs);
foreach (User u in listUser)
{
sw.WriteLine(u.UserName + “^“ + u.Pass + “^“ + u.Balance);
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 898 2009-01-07 13:39 Atm\Atm.sln
..A..H. 18432 2009-01-07 20:41 Atm\Atm.suo
文件 5270 2009-01-07 20:39 Atm\Atm\Atm.csproj
文件 4764 2009-01-07 20:39 Atm\Atm\BussinessForm.cs
文件 4780 2009-01-07 20:12 Atm\Atm\BussinessForm.Designer.cs
文件 348 2009-01-07 14:17 Atm\Atm\FindBalanceForm.cs
文件 1169 2009-01-07 14:17 Atm\Atm\FindBalanceForm.Designer.cs
文件 4276 2009-01-07 20:06 Atm\Atm\GetForm.cs
文件 3829 2009-01-07 19:53 Atm\Atm\GetForm.Designer.cs
文件 5814 2009-01-07 19:53 Atm\Atm\GetForm.resx
文件 2601 2009-01-07 19:22 Atm\Atm\LoginForm.cs
文件 4773 2009-01-07 13:59 Atm\Atm\LoginForm.Designer.cs
文件 5814 2009-01-07 13:59 Atm\Atm\LoginForm.resx
文件 2092 2009-01-07 19:18 Atm\Atm\MainForm.cs
文件 7056 2009-01-07 14:42 Atm\Atm\MainForm.Designer.cs
文件 12133 2009-01-07 14:42 Atm\Atm\MainForm.resx
文件 466 2009-01-07 13:39 Atm\Atm\Program.cs
文件 4791 2009-01-07 19:49 Atm\Atm\SaveForm.cs
文件 3842 2009-01-07 19:18 Atm\Atm\SaveForm.Designer.cs
文件 2966 2009-01-07 15:01 Atm\Atm\UpdatePassForm.cs
文件 5929 2009-01-07 14:29 Atm\Atm\UpdatePassForm.Designer.cs
文件 5814 2009-01-07 14:29 Atm\Atm\UpdatePassForm.resx
文件 1184 2009-01-07 13:39 Atm\Atm\Properties\AssemblyInfo.cs
文件 2860 2009-01-07 13:39 Atm\Atm\Properties\Resources.Designer.cs
文件 5612 2009-01-07 13:39 Atm\Atm\Properties\Resources.resx
文件 1086 2009-01-07 13:39 Atm\Atm\Properties\Settings.Designer.cs
文件 249 2009-01-07 13:39 Atm\Atm\Properties\Settings.settings
文件 424 2009-01-07 20:41 Atm\Atm\obj\Atm.csproj.FileList.txt
文件 1161 2009-01-07 20:39 Atm\Atm\obj\Debug\Atm.csproj.GenerateResource.Cache
文件 40960 2009-01-07 20:39 Atm\Atm\obj\Debug\Atm.exe
............此处省略27个文件信息
相关资源
- c# 如何删除datagridview中数据并删除数
- C#读取AD域组织架构及用户
- asp.net用OpenPop.dll获取邮件列表和内容
- ESP8266 调试工具 C#开发
- C#资源\\修改文件备注源码
- c# 解压zip完整demo 带进度条
- PC/SC 微软智能卡C#开发框架库
- C#数据同步源代码
- C# outline 2013
- C#使用七牛云存储上传文件
- 基于GDI+的 图元绘制拾取 C#实现
- C# CoreAudioApi封装库
- C#winform画图程序附解决方案,挺不错
- c# AE 基于excel生成点线面shp矢量
- sa-C#自定义控件usercontrol--美化单选按
- Lx-C#自定义控件---实现带行数和标尺的
-
Af-C#操作xm
l文件完整源码.rar - NF-C#版本口令加密BAT源码.rar
- 添加缓存区的C#串口接收
- c#单击按钮、滑轮滚动放大、缩小pi
- C#RDLC动态加载图片
- 一个简单的C#日历控件(源码)
- C# TCP网络通信小助手
- C#设计的一键更换IPDNS网关子网掩码还
- c#设计的 LED 字显示程序,使用方法较
- 用C#做的一个画图板工具,可以打开图
- GtkSharp开发教程(Linux&C#)
- C#中DataGridView控件DateTime列插入DateTi
- 个人理财管理系统C#
- C#课程设计班级通知系统
评论
共有 条评论