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
|
if(e.getSource()==bdepot) {
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 {
double m = Double.parseDouble(txtdepot.getText());
FileReader fic = new FileReader(fichier);
BufferedReader b = new BufferedReader(fic);
String p = b.readLine();
String n = b.readLine();
double s = Double.parseDouble(b.readLine());
double d = Double.parseDouble(b.readLine());
long c1 = Long.parseLong(b.readLine());
b.close();
fic.close();
Compte compte = new Compte(p,n,s,d,c1);
boolean bool = fichier.delete();
if(bool==true){
zone.setText("Fichier supprimé");
new ThreadCompteDepot("Dépot",compte,m).start();
}
else
JOptionPane.showMessageDialog (this,"Impossible de supprimer"+fichier,"Erreur compte",JOptionPane.INFORMATION_MESSAGE, null);
}
catch(NumberFormatException lException) {}
catch(IOException o) {}
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