1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
if(e.getSource()==bdepot) {
String p = new String(); String n = new String();
double s=0; double d=0; double m=0;
long c1=0;
if(txtnumero2.getText().equals("")||txtdepot.getText().equals("")) {
JOptionPane.showMessageDialog (this,"Veuillez entrer le numero de compte et le montant SVP !","Erreur remplissage",JOptionPane.INFORMATION_MESSAGE, null);
}
else {
String c = txtnumero2.getText();
File fichier = new File("c:\\gestioncompte\\clients\\"+c+".txt");
if(!fichier.exists())
JOptionPane.showMessageDialog (this,"Le compte "+c+" n'existe pas! Veuillez verifier le numero saisi","Erreur compte",JOptionPane.INFORMATION_MESSAGE, null);
else {
try {
m = Double.parseDouble(txtdepot.getText());
FileReader fic = new FileReader(fichier);
BufferedReader b = new BufferedReader(fic);
try{
p = b.readLine();
n = b.readLine();
s = Double.parseDouble(b.readLine());
d = Double.parseDouble(b.readLine());
c1 = Long.parseLong(b.readLine());
}
finally{
b.close();
fic.close();
}
//compte = new Compte(p,n,s,d,c1);
// bool = fichier.delete();
}
catch(NumberFormatException lException) {}
catch(IOException o) {o.printStackTrace();}
compte = new Compte(p,n,s,d,c1);
bool = fichier.delete();
if(bool==true){
zone.setText("Fichier supprimé");
th = new ThreadCompteDepot("Dépot",compte,m);
th.start();
try {
th.join();
}
catch(InterruptedException exc) {}
}
else {
JOptionPane.showMessageDialog (this,"Impossible de supprimer"+fichier,"Erreur compte",JOptionPane.INFORMATION_MESSAGE, null);
System.exit(0);
}
if(fichier.exists())
JOptionPane.showMessageDialog (this,"Opération Depot reussie","Transaction Compte",JOptionPane.INFORMATION_MESSAGE, null);
else
JOptionPane.showMessageDialog (this,"Opération Depot non reussie. Contacter l'administrateur systeme","Transaction Compte",JOptionPane.INFORMATION_MESSAGE, null);
}
}
} |
Partager