?? myserver.java
字號:
//JOptionPane.showMessageDialog (null,Double.toString(m_finger1.Match(finger1 , finger2,65,false)),"Match %",JOptionPane.PLAIN_MESSAGE);
//===============End Matching Process==================================
}
con.close();
if(found)
{
retval = "Welcome "+ fname +" "+ lname +","+ accno;
}
else
{
retval = "No Match Found, Invalid Finger Impression";
}
}
catch(Exception e)
{
System.out.println(e);
}
return retval;
}
//============================================================================
public String ProgressJoint(byte buf1[],byte buf2[], String pin) throws RemoteException
{
String upath="", upath1="";
String tpath="", tpath1="";
String retval="";
boolean found = false;
int i=1;
String fname="", fname1="";
String lname="", lname1="";
String balnc="",accno="";
try {
File f1 = new File("Joint/first/thumb1.jpg");
String fullname = f1.getAbsolutePath();
FileOutputStream outStream = new FileOutputStream(fullname);
outStream.write(buf1);
outStream.close();
File f2 = new File("Joint/second/thumb2.jpg");
String fullname1 = f2.getAbsolutePath();
FileOutputStream outStream1 = new FileOutputStream(fullname1);
outStream1.write(buf2);
outStream1.close();
upath= f1.getAbsolutePath();
upath1= f2.getAbsolutePath();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("Jdbc:Odbc:bankodbc");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from Joint_acc_Details where pin="+ pin);
while(rs.next())
{
accno = rs.getString("Acc_no");
fname = rs.getString("Fname1");
lname = rs.getString("Lname1");
tpath=rs.getString("Fingerprint1");
fname1 = rs.getString("Fname2");
lname1 = rs.getString("Lname2");
tpath1=rs.getString("Fingerprint2");
balnc=rs.getString("Init_bal");
//================Matching Process================================
//picture1
//Set picture new
m_bimage1=ImageIO.read(new File(upath)) ;
m_panel1.setBufferedImage(m_bimage1);
//Send image for skeletinization
m_finger1.setFingerPrintImage(m_bimage1) ;
finger1=m_finger1.getFingerPrintTemplate();
//See what skeletinized image looks like
m_bimage1 = m_finger1.getFingerPrintImageDetail();
m_panel1.setBufferedImage(m_bimage1);
//picture2
//Set picture new
// m_bimage2=ImageIO.read(new File(tpath)) ;
m_bimage2=ImageIO.read(new File(tpath)) ;
m_panel2.setBufferedImage(m_bimage2);
//Send image for skeletinization
m_finger2.setFingerPrintImage(m_bimage2) ;
finger2=m_finger2.getFingerPrintTemplate();
//See what skeletinized image looks like
m_bimage2 = m_finger2.getFingerPrintImageDetail();
m_panel2.setBufferedImage(m_bimage2);
double result = m_finger1.Match(finger1 , finger2,65,false);
if(result >= 90)
{
//picture1
//Set picture new
m_bimage1=ImageIO.read(new File(upath1)) ;
m_panel1.setBufferedImage(m_bimage1);
//Send image for skeletinization
m_finger1.setFingerPrintImage(m_bimage1) ;
finger1=m_finger1.getFingerPrintTemplate();
//See what skeletinized image looks like
m_bimage1 = m_finger1.getFingerPrintImageDetail();
m_panel1.setBufferedImage(m_bimage1);
//picture2
//Set picture new
m_bimage2=ImageIO.read(new File(tpath1)) ;
m_panel2.setBufferedImage(m_bimage2);
//Send image for skeletinization
m_finger2.setFingerPrintImage(m_bimage2) ;
finger2=m_finger2.getFingerPrintTemplate();
//See what skeletinized image looks like
m_bimage2 = m_finger2.getFingerPrintImageDetail();
m_panel2.setBufferedImage(m_bimage2);
result = m_finger1.Match(finger1 , finger2,65,false);
if(result >= 90)
{
found = true;
break;
}
}
//JOptionPane.showMessageDialog (null,Double.toString(m_finger1.Match(finger1 , finger2,65,false)),"Match %",JOptionPane.PLAIN_MESSAGE);
//===============End Matching Process=============
}
con.close();
if(found)
{
retval = "Welcome "+ fname +" "+ lname +" and "+ fname1 +" "+ lname1 + " Match Found," + accno;
}
else
{
retval = "No Match Found, Invalid Finger Impression";
}
}
catch(Exception e)
{
System.out.println(e);
}
return retval;
}
public String BalanceCheck(String accno) throws RemoteException
{
String balance="";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("Jdbc:Odbc:bankodbc");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from Single_acc_Details where Acc_no="+ accno);
while(rs.next())
{
balance = rs.getString("Init_bal");
}
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
return balance;
}
public String Withdraw(String accno, String bal) throws RemoteException
{
String result="", balance="";
double initbal, amt;
amt = Double.parseDouble(bal);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("Jdbc:Odbc:bankodbc");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from Single_acc_Details where Acc_no="+ accno);
while(rs.next())
{
balance = rs.getString("Init_bal");
}
initbal = Double.parseDouble(balance);
if((initbal - amt) >= 500)
{
initbal = initbal - amt;
stmt.executeUpdate("update Single_acc_Details set Init_bal='"+ initbal +"' where Acc_no="+ accno);
//stmt.executeUpdate("insert into Transact_Details(Acc_no,Balance) values('"+ accno +"','"+ amt +"')");
result = "Please Collect your cash, Balance is Rs. "+ initbal;
}
else
{
result = "No enough funds to carry the tranaction";
}
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
return result;
}
public String Withdraw2(String accno, String bal) throws RemoteException
{
String result="", balance="";
double initbal, amt;
amt = Double.parseDouble(bal);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("Jdbc:Odbc:bankodbc");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select * from Joint_acc_Details where Acc_no="+ accno);
while(rs.next())
{
balance = rs.getString("Init_bal");
}
initbal = Double.parseDouble(balance);
if((initbal - amt) > 500)
{
initbal = initbal - amt;
stmt.executeUpdate("update Joint_acc_Details set Init_bal='"+ initbal +"' where Acc_no="+ accno);
result = "Please Collect your cash, Balance is Rs. "+ initbal;
}
else
{
result = "No enough funds to carry the tranaction";
}
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
return result;
}
public static void main(String args[])
{
try
{
MyServer ms = new MyServer();
Naming.rebind("BankServer",ms);
}
catch(Exception e)
{
System.out.println(e);
}
}
}
class BJPanel extends JPanel
{
public BufferedImage bi;
public BJPanel (){
this.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent m){
JOptionPane.showMessageDialog (null,"("+Integer.toString(m.getPoint().x)+";"+Integer.toString(m.getPoint().y)+")","Point",JOptionPane.PLAIN_MESSAGE);
}
});
}
public BJPanel (BufferedImage bi){
this.bi = bi;
setPreferredSize(new Dimension(bi.getWidth(),bi.getHeight())) ;
}
public void setBufferedImage(BufferedImage bi)
{
this.bi = bi;
setPreferredSize(new Dimension(bi.getWidth(),bi.getHeight())) ;
this.repaint();
}
public void paintComponent(Graphics g)
{
g.drawImage(bi,0,0,this) ;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -