-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlood_Mangement_Manger_Interface_Controller.java
More file actions
114 lines (91 loc) · 3.53 KB
/
Blood_Mangement_Manger_Interface_Controller.java
File metadata and controls
114 lines (91 loc) · 3.53 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
import com.mysql.cj.protocol.Resultset;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.*;
public class Blood_Mangement_Manger_Interface_Controller {
public static boolean mangerAccess = false;
@FXML
private Button butt1;
@FXML
private Button butt2;
@FXML
private Button butt3;
@FXML
private Button butt4;
@FXML
private Button butt5;
@FXML
private Label l1;
@FXML
private Label l2;
@FXML
void exitButtIsClicked(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("Blood_Mangement_System_Home.fxml"));
Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 600, 400);
stage.setScene(scene);
stage.setResizable(false);
}
@FXML
void ADDREP(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("Blood_Mangement_System_Remove_Edit_Interface.fxml"));
Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 600, 400);
stage.setScene(scene);
stage.setResizable(false);
}
@FXML
void GenreateRBC(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("Report_interface.fxml"));
Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 600, 400);
stage.setScene(scene);
stage.setResizable(false);
}
@FXML
void PendingRequest(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("Requests_Interface.fxml"));
Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 600, 400);
stage.setScene(scene);
stage.setResizable(false);
}
@FXML
void SearchMH(ActionEvent event) throws IOException {
Parent root = FXMLLoader.load(getClass().getResource("Search_Medical_History_Manger_Interface.fxml"));
Stage stage = (Stage)((Node)event.getSource()).getScene().getWindow();
Scene scene = new Scene(root, 600, 400);
stage.setScene(scene);
stage.setResizable(false);
}
@FXML
void SendBCA(ActionEvent event) throws SQLException, IOException {
l2.setText("Emails has been sent to donors");
Connection connection = DriverManager.getConnection(
"jdbc:mysql://127.0.0.1:3306/system_schema","root","FARISSQL20ics321"
);
File infile = new File("C://Users//faris//OneDrive//Desktop//New_Project//ICS321-PV0.1//src//Donors_Messages.txt");
FileWriter fw = new FileWriter(infile);
PrintWriter pw = new PrintWriter(fw);
Statement statement = connection.createStatement();
// to get donors emails
String SqlCommand = "Select Email from donor";
ResultSet resultset = statement.executeQuery(SqlCommand);
pw.println("The donation period is open please start donating your bloods\nto:");
while (resultset.next()){
pw.println(resultset.getString("Email"));
}
pw.close();
}
}