提取金额.cs

来自「atm取款机,源代码」· CS 代码 · 共 767 行 · 第 1/3 页

CS
767
字号
					frm.Show();
					this.Close();
				}
				else

					MessageBox.Show("余额不足,或你今天已经取足了,不能再取!", "超支错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);


			}
			sqlConnection1.Close();
		
		}

		private void button3_Click(object sender, System.EventArgs e)
		{
			sqlConnection1.Open();
			string strin1="select 金额,最大金额 from 用户表 where 用户帐号='" + ATM取款机.Form1.kanum + "'";
			SqlCommand cmd2=new SqlCommand(strin1,sqlConnection1);
			SqlDataReader dr2=cmd2.ExecuteReader();
			if(dr2.Read())
			{
				
				label10.Text=dr2.GetString(0).ToString();
				label11.Text=dr2.GetString(1).ToString();
				dr2.Close();
				int c;
				int d;
				c=int.Parse(label10.Text);
				d=int.Parse(label11.Text);
				if(c>0 && d>=200)
				{
					string strin2 = "select 金额,最大金额 from 用户表 where 用户帐号='" + ATM取款机.Form1.kanum + "'";
					SqlCommand cmd=new SqlCommand(strin2,sqlConnection1);
					cmd.CommandText=strin2;
					cmd.ExecuteNonQuery();
					SqlDataReader dr=cmd.ExecuteReader();
					if(dr.Read())
					{
						this.label8.Text=dr.GetString(0).ToString();
						this.label9.Text=dr.GetString(1).ToString();
      
					}

					dr.Close();

					int a =int.Parse(label8.Text);
					int b=int.Parse(label9.Text);
					a=a-200;
					b=b-200;
					label8.Text=a.ToString();
					label9.Text=b.ToString();
					//					MessageBox.Show("看看对吧!");
					string strin3="Update  用户表 set 金额 = '" + label8.Text + "',最大金额='"+label9.Text+"'  where 用户帐号='" +ATM取款机.Form1.kanum + "'";
					SqlCommand cmd1=new SqlCommand(strin3,sqlConnection1);

					cmd1.ExecuteNonQuery();

			

					Form5 frm =new Form5();
					frm.Show();
					this.Close();
				}
				else

					MessageBox.Show("余额不足,或你今天已经取足了,不能再取!", "超支错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);


			}
			sqlConnection1.Close();
		}

		private void button4_Click(object sender, System.EventArgs e)
		{
			sqlConnection1.Open();
			string strin1="select 金额,最大金额 from 用户表 where 用户帐号='" + ATM取款机.Form1.kanum + "'";
			SqlCommand cmd2=new SqlCommand(strin1,sqlConnection1);
			SqlDataReader dr2=cmd2.ExecuteReader();
			if(dr2.Read())
			{
				
				label10.Text=dr2.GetString(0).ToString();
				label11.Text=dr2.GetString(1).ToString();
				dr2.Close();
				int c;
				int d;
				c=int.Parse(label10.Text);
				d=int.Parse(label11.Text);
				if(c>0 && d>=300)
				{
					string strin2 = "select 金额,最大金额 from 用户表 where 用户帐号='" + ATM取款机.Form1.kanum + "'";
					SqlCommand cmd=new SqlCommand(strin2,sqlConnection1);
					cmd.CommandText=strin2;
					cmd.ExecuteNonQuery();
					SqlDataReader dr=cmd.ExecuteReader();
					if(dr.Read())
					{
						this.label8.Text=dr.GetString(0).ToString();
						this.label9.Text=dr.GetString(1).ToString();
      
					}

					dr.Close();
					int a =int.Parse(label8.Text);
					int b=int.Parse(label9.Text);
					a=a-300;
					b=b-300;
					label8.Text=a.ToString();
					label9.Text=b.ToString();
					//					MessageBox.Show("看看对吧!");
					string strin3="Update  用户表 set 金额 = '" + label8.Text + "',最大金额='"+label9.Text+"'  where 用户帐号='" +ATM取款机.Form1.kanum + "'";
					SqlCommand cmd1=new SqlCommand(strin3,sqlConnection1);

					cmd1.ExecuteNonQuery();

			

					Form5 frm =new Form5();
					frm.Show();
					this.Close();
				}
				else

					MessageBox.Show("余额不足,或你今天已经取足了,不能再取!", "超支错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);


			}
			sqlConnection1.Close();
		}

		private void button5_Click(object sender, System.EventArgs e)
		{
			sqlConnection1.Open();
			string strin1="select 金额,最大金额 from 用户表 where 用户帐号='" + ATM取款机.Form1.kanum + "'";
			SqlCommand cmd2=new SqlCommand(strin1,sqlConnection1);
			SqlDataReader dr2=cmd2.ExecuteReader();
			if(dr2.Read())
			{
				
				label10.Text=dr2.GetString(0).ToString();
				label11.Text=dr2.GetString(1).ToString();
				dr2.Close();
				int c;
				int d;
				c=int.Parse(label10.Text);
				d=int.Parse(label11.Text);
				if(c>0 && d>=400)
				{
					string strin2 = "select 金额,最大金额 from 用户表 where 用户帐号='" + ATM取款机.Form1.kanum + "'";
					SqlCommand cmd=new SqlCommand(strin2,sqlConnection1);
					cmd.CommandText=strin2;
					cmd.ExecuteNonQuery();
					SqlDataReader dr=cmd.ExecuteReader();
					if(dr.Read())
					{
						this.label8.Text=dr.GetString(0).ToString();
						this.label9.Text=dr.GetString(1).ToString();
      
					}

					dr.Close();

					int a =int.Parse(label8.Text);
					int b=int.Parse(label9.Text);
					a=a-400;
					b=b-400;
					label8.Text=a.ToString();
					label9.Text=b.ToString();

					string strin3="Update  用户表 set 金额 = '" + label8.Text + "',最大金额='"+label9.Text+"'  where 用户帐号='" +ATM取款机.Form1.kanum + "'";
					SqlCommand cmd1=new SqlCommand(strin3,sqlConnection1);

					cmd1.ExecuteNonQuery();


					Form5 frm =new Form5();
					frm.Show();
					this.Close();
				}
				else

					MessageBox.Show("余额不足,或你今天已经取足了,不能再取!", "超支错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);


			}
			sqlConnection1.Close();
		}

		private void button6_Click(object sender, System.EventArgs e)
		{
			sqlConnection1.Open();
			string strin1="select 金额,最大金额 from 用户表 where 用户帐号='" + ATM取款机.Form1.kanum + "'";
			SqlCommand cmd2=new SqlCommand(strin1,sqlConnection1);
			SqlDataReader dr2=cmd2.ExecuteReader();
			if(dr2.Read())
			{
				
				label10.Text=dr2.GetString(0).ToString();
				label11.Text=dr2.GetString(1).ToString();
				dr2.Close();
				int c;
				int d;
				c=int.Parse(label10.Text);
				d=int.Parse(label11.Text);
				if(c>0 && d>=500)
				{
					string strin2 = "select 金额,最大金额 from 用户表 where 用户帐号='" + ATM取款机.Form1.kanum + "'";
					SqlCommand cmd=new SqlCommand(strin2,sqlConnection1);
					cmd.CommandText=strin2;
					cmd.ExecuteNonQuery();
					SqlDataReader dr=cmd.ExecuteReader();
					if(dr.Read())
					{
						this.label8.Text=dr.GetString(0).ToString();
						this.label9.Text=dr.GetString(1).ToString();
      
					}

					dr.Close();

					int a =int.Parse(label8.Text);
					int b=int.Parse(label9.Text);
					a=a-500;
					b=b-500;
					label8.Text=a.ToString();
					label9.Text=b.ToString();
					//					MessageBox.Show("看看对吧!");
					string strin3="Update  用户表 set 金额 = '" + label8.Text + "',最大金额='"+label9.Text+"'  where 用户帐号='" +ATM取款机.Form1.kanum + "'";
					SqlCommand cmd1=new SqlCommand(strin3,sqlConnection1);

					cmd1.ExecuteNonQuery();


					Form5 frm =new Form5();
					frm.Show();
					this.Close();
				}
				else

					MessageBox.Show("余额不足,或你今天已经取足了,不能再取!", "超支错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);


			}
			sqlConnection1.Close();
		}

		private void button7_Click(object sender, System.EventArgs e)
		{
			Form2 frm =new Form2();
			frm.Show();
			this.Close();
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?