• 大小: 266KB
    文件类型: .zip
    金币: 2
    下载: 2 次
    发布日期: 2021-07-04
  • 语言: C#
  • 标签: C#  

资源简介

本篇用C#实现ATM自动取款机的一些功能,包含与卡号、密码、可用余额、总余额相关的字段和属性,并提供了存款和取款的方法。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ATMsystem
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int c;
        public static string lockID;
        private void button2_Click(object sender EventArgs e)
        {
            if ((textBox2.Text.Trim() != ““))
            {
                using (SqlConnection conn = new SqlConnection(“Server = GUO\\SQLEXPRESS;Database=Database1;Integrated Security = SSPI“))
                {
                    conn.Open();
                    string ssql = “select * from userinfo where yonghu=‘“ + textBox1.Text.Trim().ToString() + “‘“;
                    SqlCommand ccmd = new SqlCommand(ssql conn);
                    SqlDataReader dr1 = ccmd.ExecuteReader();

                    if (dr1.Read())
                    {
                        dr1.Close();
                        lockID = textBox1.Text.Trim().ToString();
                        string isornot = “select mima from userinfo where yonghu=‘“ + textBox1.Text.Trim().ToString() + “‘ “;
                        SqlCommand cmd0 = new SqlCommand(isornot conn);
                        SqlDataReader drr = cmd0.ExecuteReader();


                        if (drr.Read() && drr[“mima“].ToString() == “1“)
                        {
                            MessageBox.Show(“您的帐号已被锁定,请与银行管理员联系!“);
                            drr.Close();
                        }
                        else
                        {
                            drr.Close();
                            string sql = “select * from userinfo where yonghu=‘“ + textBox1.Text.Trim().ToString() + “‘and mima=‘“ + textBox2.Text.Trim().ToString() + “‘“;
                            SqlCommand cmd = new SqlCommand(sql conn);
                            SqlDataReader dr = cmd.ExecuteReader();
                            if (dr.Read())
                            {

                                textBox1.Text = dr[“yonghu“].ToString();
                                Form2 frm = new Form2();
                                frm.Show();
                                this.Hide();
                            }
                            else
                            {

                                if (this.c++ < 3)
                                {
                                    MessageBox.Show(“您密码不正确,请重新输入!“ “提示!“ MessageBoxButtons.OK MessageBoxIcon.Error);
                                    textBox2.Text = ““;
                                    textBox1.Text = ““;

                                }
                                else
                                {
                                    dr.Clos

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-03-04 17:14  ATMsystem\
     目录           0  2019-03-25 23:29  ATMsystem\ATMsystem\
     目录           0  2019-03-25 23:29  ATMsystem\ATMsystem\.vs\
     目录           0  2019-03-25 23:29  ATMsystem\ATMsystem\.vs\ATMsystem\
     目录           0  2019-03-25 23:30  ATMsystem\ATMsystem\.vs\ATMsystem\v15\
     文件       41472  2019-03-25 23:31  ATMsystem\ATMsystem\.vs\ATMsystem\v15\.suo
     目录           0  2019-03-25 23:30  ATMsystem\ATMsystem\.vs\ATMsystem\v15\Server\
     目录           0  2019-03-25 23:30  ATMsystem\ATMsystem\.vs\ATMsystem\v15\Server\sqlite3\
     文件           0  2019-03-25 23:30  ATMsystem\ATMsystem\.vs\ATMsystem\v15\Server\sqlite3\db.lock
     文件        4096  2019-03-25 23:30  ATMsystem\ATMsystem\.vs\ATMsystem\v15\Server\sqlite3\storage.ide
     文件       32768  2019-03-25 23:30  ATMsystem\ATMsystem\.vs\ATMsystem\v15\Server\sqlite3\storage.ide-shm
     文件      708672  2019-03-25 23:30  ATMsystem\ATMsystem\.vs\ATMsystem\v15\Server\sqlite3\storage.ide-wal
     目录           0  2018-03-04 17:14  ATMsystem\ATMsystem\ATMsystem\
     文件        5770  2017-12-22 15:11  ATMsystem\ATMsystem\ATMsystem\ATMsystem.csproj
     文件         184  2017-12-22 15:11  ATMsystem\ATMsystem\ATMsystem\App.config
     文件        6506  2017-12-20 10:30  ATMsystem\ATMsystem\ATMsystem\Form1.Designer.cs
     文件        4662  2017-12-21 20:46  ATMsystem\ATMsystem\ATMsystem\Form1.cs
     文件        5817  2017-12-20 10:30  ATMsystem\ATMsystem\ATMsystem\Form1.resx
     文件        5947  2017-12-21 20:52  ATMsystem\ATMsystem\ATMsystem\Form2.Designer.cs
     文件        1364  2017-12-21 20:52  ATMsystem\ATMsystem\ATMsystem\Form2.cs
     文件        5817  2017-12-21 20:52  ATMsystem\ATMsystem\ATMsystem\Form2.resx
     文件        4672  2017-12-20 10:30  ATMsystem\ATMsystem\ATMsystem\Form3.Designer.cs
     文件        2691  2017-12-21 20:49  ATMsystem\ATMsystem\ATMsystem\Form3.cs
     文件        5817  2017-12-20 10:30  ATMsystem\ATMsystem\ATMsystem\Form3.resx
     文件        4995  2017-12-20 10:30  ATMsystem\ATMsystem\ATMsystem\Form4.Designer.cs
     文件        2631  2017-12-21 20:49  ATMsystem\ATMsystem\ATMsystem\Form4.cs
     文件        5817  2017-12-20 10:30  ATMsystem\ATMsystem\ATMsystem\Form4.resx
     文件        6132  2017-12-20 14:09  ATMsystem\ATMsystem\ATMsystem\Form5.Designer.cs
     文件        3838  2017-12-21 20:50  ATMsystem\ATMsystem\ATMsystem\Form5.cs
     文件        5817  2017-12-20 14:09  ATMsystem\ATMsystem\ATMsystem\Form5.resx
     文件        6138  2017-12-20 10:49  ATMsystem\ATMsystem\ATMsystem\Form6.Designer.cs
............此处省略46个文件信息

评论

共有 条评论