-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModificationController.java
More file actions
146 lines (121 loc) · 4.73 KB
/
Copy pathModificationController.java
File metadata and controls
146 lines (121 loc) · 4.73 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Interfacepackage;
import Myconnection.MyConnection;
import formulaireServices.formulaireServices;
import java.io.IOException;
import java.net.URL;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import static jdk.nashorn.internal.runtime.Debug.id;
import projetpidev.formulaire;
/**
* FXML Controller class
*
* @author LENOVO
*/
public class ModificationController implements Initializable {
@FXML
private TextField tID;
@FXML
private TextField tNom;
@FXML
private TextField tPrenom;
@FXML
private TextField tAdresse;
@FXML
private TextField tDate;
@FXML
private TextField tDesc;
@FXML
private Button btnOk;
private Button btnMOD;
@FXML
private Button btnRetour1;
@FXML
private TextField tSexe;
@FXML
private Button suiv;
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// TODO
}
public Connection cnx;
private PreparedStatement ste;
@FXML
private void ChercherId(ActionEvent event) {
try {
int Id=Integer.parseInt(tID.getText()) ;
cnx = MyConnection.getInstance().getConnection();
ste = cnx.prepareStatement("select * from formulaire where Id='"+Id+"'");
formulaire f =new formulaire();
ResultSet rs = null;
try {
rs = ste.executeQuery();
} catch (SQLException ex) {
Logger.getLogger(SupprimerFormulaireController.class.getName()).log(Level.SEVERE, null, ex);
}
try{
if (rs.next()){
f.setId(Id);
f.setNom(rs.getString("Nom"));
f.setPrenom(rs.getString("Prenom"));
f.setDateNaissance(rs.getString("DateNaissance"));
f.setAdresse(rs.getString("Adresse"));
f.setSexe(rs.getString("Sexe"));
f.setDescriptionSymptomes(rs.getString("descriptionSymptomes"));
}
tNom.setText(f.getNom());
tPrenom.setText(f.getPrenom());
tAdresse.setText(f.getAdresse());
tDate.setText(f.getDateNaissance());
tDesc.setText(f.getDescriptionSymptomes());
tSexe.setText(f.getSexe());
} catch (SQLException ex) {
Logger.getLogger(ModificationController.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (SQLException ex) {
Logger.getLogger(ModificationController.class.getName()).log(Level.SEVERE, null, ex);
}
}
@FXML
private void retour1(ActionEvent event) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("Menu.fxml"));
Parent root = loader.load();
MenuController mc =loader.getController();
btnOk.getScene().setRoot(root);
} catch (IOException ex) {
System.out.println(ex.getMessage()); }
}
@FXML
private void suiv(ActionEvent event) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("SupprimerFormulaire.fxml"));
Parent root = loader.load();
SupprimerFormulaireController sc =loader.getController();
btnOk.getScene().setRoot(root);
} catch (IOException ex) {
System.out.println(ex.getMessage());
}
}}