?? dbaccess.java
字號(hào):
try{
if(rsSQLSelect.next())
{
No_50=Integer.parseInt(rsSQLSelect.getString("NO_50"));
No_100=Integer.parseInt(rsSQLSelect.getString("NO_100"));
}
}
catch(Exception er){System.out.println("查詢ATM機(jī)信息出錯(cuò)!");}
x_100=fetchmoney/100;
if(No_100<x_100)
{
mo=fetchmoney-No_100*100;
x_50=mo/50;
if(x_50>No_50)
{
t9.setText("取款機(jī)現(xiàn)鈔不足!");
text2.setText("");
cl.show(c,"6");
return;
}
else
{
No_50=No_50-x_50;
No_100=0;
}
}
else
{
No_100=No_100-x_100;
x_50=(fetchmoney-x_100*100)/50;
if(x_50>No_50)
{
t9.setText("取款機(jī)50面值現(xiàn)鈔不足!");
text2.setText("");
cl.show(c,"6");
return;
}
else
{No_50=No_50-x_50;}
}
String str2="update ATM set NO_50="+No_50+" where ATM_ID='"+ATM_id+"'";
String str3="update ATM set NO_100="+No_100+" where ATM_ID='"+ATM_id+"'";
d.executeUpdate(str2);
d.executeUpdate(str3);
setmoney(fetchmoney,IC_Number);
t12.setText(Float.toString(fetchmoney));
cl.show(c,"7");
text2.setText("");
}
if(e.getSource()==z14) //打印
{ t14.setText(Long.toString(opNum));
opNum=opNum+1;
IC_Number=text1.getText().trim();
t16.setText(IC_Number);
t18.setText(Float.toString(fetchmoney));
Date dd=new Date();
String tt=""+dd;
t20.setText(tt);
cl.show(c,"8");
}
if(e.getSource()==z13||e.getSource()==z15||e.getSource()==z17||e.getSource()==z20||e.getSource()==z21||e.getSource()==z29||e.getSource()==z30)
{
cl.show(c,"4");
}
if(e.getSource()==z19)
{ DBAccess d=new DBAccess();
IC_Number=text1.getText().trim();
IC_No=text3.getText().trim();
if(IC_No.equals(IC_Number))
{
t23.setText("您輸入的帳號(hào)為現(xiàn)登錄帳號(hào)!");
text3.setText("");
text4.setText("");
cl.show(c,"9");
return;
}
moneys=Float.parseFloat(text4.getText());
if(moneys<=0)
{
t23.setText("轉(zhuǎn)帳金額非法!");
text3.setText("");
text4.setText("");
cl.show(c,"9");
return;
}
leftmoney=getmoney(IC_Number);
if(!getname(IC_No))
{
text3.setText("");
text4.setText("");
t23.setText("您輸入的帳號(hào)錯(cuò)誤!");
cl.show(c,"9");
return;
}
if(leftmoney<moneys)
{
t23.setText("您的余額不足,請(qǐng)重新輸入!");
text4.setText("");
cl.show(c,"9");
return;
}
mon=getmoney(IC_No);
money1=leftmoney-moneys;
money2=mon+moneys;
String str1="";
String str2="";
str1="update IC set money="+money1+"WHERE IC_ID='"+IC_Number+"'";
str2="update IC set money="+money2+"WHERE IC_ID='"+IC_No+"'";
if(d.executeUpdate(str1)&&d.executeUpdate(str2))
{
t23.setText("轉(zhuǎn)帳成功! 您的轉(zhuǎn)帳金額為"+moneys);
text3.setText("");
text4.setText("");
cl.show(c,"9");
return;
}
}
if(e.getSource()==z23)
{
IC_Number=text1.getText().trim();
fetchmoney=100;
int No_50=0,No_100=0,x_50=0,x_100=0,mo=0;
String str1="select NO_50,NO_100 from ATM where ATM_ID='123456789'";
ResultSet rsSQLSelect=executeQuery(str1);
try{
if(rsSQLSelect.next())
{
No_50=Integer.parseInt(rsSQLSelect.getString("NO_50"));
No_100=Integer.parseInt(rsSQLSelect.getString("NO_100"));
}
}
catch(Exception er){System.out.println("查詢ATM機(jī)信息出錯(cuò)!");}
x_100=fetchmoney/100;
if(No_100<x_100)
{
mo=fetchmoney-No_100*100;
x_50=mo/50;
if(x_50>No_50)
{
t33.setText("取款機(jī)現(xiàn)鈔不足!");
z30.setVisible(true);
cl.show(c,"5");
return;
}
else
{
No_50=No_50-x_50;
No_100=0;
}
}
else
{
No_100=No_100-x_100;
x_50=(fetchmoney-x_100*100)/50;
if(x_50>No_50)
{
t33.setText("取款機(jī)50面值現(xiàn)鈔不足!");
cl.show(c,"5");
return;
}
else
{No_50=No_50-x_50;}
}
String str2="update ATM set NO_50="+No_50+" where ATM_ID='"+ATM_id+"'";
String str3="update ATM set NO_100="+No_100+" where ATM_ID='"+ATM_id+"'";
executeUpdate(str2);
executeUpdate(str3);
if(setmoney(fetchmoney,IC_Number))
{
t12.setText("100");
cl.show(c,"7");
}
}
if(e.getSource()==z24)
{
IC_Number=text1.getText().trim();
fetchmoney=200;
int No_50=0,No_100=0,x_50=0,x_100=0,mo=0;
String str1="select NO_50,NO_100 from ATM where ATM_ID='123456789'";
ResultSet rsSQLSelect=executeQuery(str1);
try{
if(rsSQLSelect.next())
{
No_50=Integer.parseInt(rsSQLSelect.getString("NO_50"));
No_100=Integer.parseInt(rsSQLSelect.getString("NO_100"));
}
}
catch(Exception er){System.out.println("查詢ATM機(jī)信息出錯(cuò)!");}
x_100=fetchmoney/100;
if(No_100<x_100)
{
mo=fetchmoney-No_100*100;
x_50=mo/50;
if(x_50>No_50)
{
t33.setText("取款機(jī)現(xiàn)鈔不足!");
z30.setVisible(true);
cl.show(c,"5");
return;
}
else
{
No_50=No_50-x_50;
No_100=0;
}
}
else
{
No_100=No_100-x_100;
x_50=(fetchmoney-x_100*100)/50;
if(x_50>No_50)
{
t33.setText("取款機(jī)50面值現(xiàn)鈔不足!");
cl.show(c,"5");
return;
}
else
{No_50=No_50-x_50;}
}
String str2="update ATM set NO_50="+No_50+" where ATM_ID='"+ATM_id+"'";
String str3="update ATM set NO_100="+No_100+" where ATM_ID='"+ATM_id+"'";
executeUpdate(str2);
executeUpdate(str3);
if(setmoney(fetchmoney,IC_Number))
{t12.setText("200");
cl.show(c,"7");
}
}
if(e.getSource()==z25)
{
IC_Number=text1.getText().trim();
fetchmoney=300;
int No_50=0,No_100=0,x_50=0,x_100=0,mo=0;
String str1="select NO_50,NO_100 from ATM where ATM_ID='123456789'";
ResultSet rsSQLSelect=executeQuery(str1);
try{
if(rsSQLSelect.next())
{
No_50=Integer.parseInt(rsSQLSelect.getString("NO_50"));
No_100=Integer.parseInt(rsSQLSelect.getString("NO_100"));
}
}
catch(Exception er){System.out.println("查詢ATM機(jī)信息出錯(cuò)!");}
x_100=fetchmoney/100;
if(No_100<x_100)
{
mo=fetchmoney-No_100*100;
x_50=mo/50;
if(x_50>No_50)
{
t33.setText("取款機(jī)現(xiàn)鈔不足!");
z30.setVisible(true);
cl.show(c,"5");
return;
}
else
{
No_50=No_50-x_50;
No_100=0;
}
}
else
{
No_100=No_100-x_100;
x_50=(fetchmoney-x_100*100)/50;
if(x_50>No_50)
{
t33.setText("取款機(jī)50面值現(xiàn)鈔不足!");
cl.show(c,"5");
return;
}
else
{No_50=No_50-x_50;}
}
String str2="update ATM set NO_50="+No_50+" where ATM_ID='"+ATM_id+"'";
String str3="update ATM set NO_100="+No_100+" where ATM_ID='"+ATM_id+"'";
executeUpdate(str2);
executeUpdate(str3);
if(setmoney(fetchmoney,IC_Number))
{t12.setText("300");
cl.show(c,"7");
}
}
if(e.getSource()==z26)
{
IC_Number=text1.getText().trim();
int fetchmoney=500;
int No_50=0,No_100=0,x_50=0,x_100=0,mo=0;
String str1="select NO_50,NO_100 from ATM where ATM_ID='123456789'";
ResultSet rsSQLSelect=executeQuery(str1);
try{
if(rsSQLSelect.next())
{
No_50=Integer.parseInt(rsSQLSelect.getString("NO_50"));
No_100=Integer.parseInt(rsSQLSelect.getString("NO_100"));
}
}
catch(Exception er){System.out.println("查詢ATM機(jī)信息出錯(cuò)!");}
x_100=fetchmoney/100;
if(No_100<x_100)
{
mo=fetchmoney-No_100*100;
x_50=mo/50;
if(x_50>No_50)
{
t33.setText("取款機(jī)現(xiàn)鈔不足!");
z30.setVisible(true);
cl.show(c,"5");
return;
}
else
{
No_50=No_50-x_50;
No_100=0;
}
}
else
{
No_100=No_100-x_100;
x_50=(fetchmoney-x_100*100)/50;
if(x_50>No_50)
{
t33.setText("取款機(jī)50面值現(xiàn)鈔不足!");
cl.show(c,"5");
return;
}
else
{No_50=No_50-x_50;}
}
String str2="update ATM set NO_50="+No_50+" where ATM_ID='"+ATM_id+"'";
String str3="update ATM set NO_100="+No_100+" where ATM_ID='"+ATM_id+"'";
executeUpdate(str2);
executeUpdate(str3);
if(setmoney(fetchmoney,IC_Number))
{t12.setText("500");
cl.show(c,"7");
}
}
if(e.getSource()==z27)
{
t9.setText("");
cl.show(c,"6");
}
if(e.getSource()==z28)
{
String password1="";
String password2="";
IC_Number=text1.getText().trim();
password1=pw2.getText().trim();
password2=pw3.getText().trim();
if(password1.equals(password2))
{ if(alterpassword(password1,IC_Number))
{
t28.setText("密碼修改成功!");
pw2.setText("");
pw3.setText("");
cl.show(c,"11");
}
}
else
{
t28.setText("您輸入的密碼不一致,請(qǐng)重新輸入!");
pw2.setText("");
pw3.setText("");
cl.show(c,"11");
}
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -