資源簡介
用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])?????????????????????{
????????????????????????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個文件信息
評論
共有 條評論