Skip to content

Commit

Permalink
Added entry validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tanvir10029 committed May 12, 2021
1 parent 2369dab commit 9c2c74c
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 20 deletions.
Empty file added Expedia/hashTableData.txt
Empty file.
74 changes: 54 additions & 20 deletions Expedia/src/application/Main.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package application;

import java.util.Date;
import java.util.Optional;

import javafx.application.Application;
import javafx.application.Platform;
Expand All @@ -10,14 +11,6 @@
import javafx.event.EventHandler;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Background;
Expand All @@ -27,7 +20,6 @@
import javafx.scene.text.Text;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;
import javafx.scene.control.ScrollPane;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.control.*;
Expand Down Expand Up @@ -64,17 +56,17 @@ public void start(Stage primaryStage)
clock.setPrefHeight(30);
clock.setPrefWidth(900);

//DepartTimes
GridPane right = new GridPane();
Label lb1 = new Label("Depart Times: "
+ " ");
TextArea times = new TextArea();
times.setEditable(false);
times.setPrefHeight(300);
times.setPrefWidth(30);
times.setText("Waiting for Input");
right.add(lb1, 0, 0);
right.add(times, 0, 1);
//DepartTimes
GridPane right = new GridPane();
Label lb1 = new Label("Depart Times: "
+ " ");
TextArea times = new TextArea();
times.setEditable(false);
times.setPrefHeight(300);
times.setPrefWidth(30);
times.setText("Waiting for Input");
right.add(lb1, 0, 0);
right.add(times, 0, 1);


//body
Expand Down Expand Up @@ -278,10 +270,50 @@ public void start(Stage primaryStage)
{
@Override public void handle(ActionEvent e)
{

Platform.runLater(new Runnable()
{
public void run()
{
if (nameF.getText().isEmpty() || startLocTF.getValue()== null || endLocTF.getValue()== null || emailF.getText().isEmpty()
|| CardF.getText().isEmpty()) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);

alert.setTitle("Incomplete Data");
if(startLocTF.getValue() == null) {
alert.setHeaderText("Starting Location Cannot Be Empty");
alert.setContentText("Please fill in your starting location.");
}
else if(nameF.getText().isEmpty()) {
alert.setHeaderText("Name Field Cannot Be Empty");
alert.setContentText("Please fill in your name.");
}
else if(endLocTF.getValue() == null) {
alert.setHeaderText("Ending Location Cannot Be Empty");
alert.setContentText("Please fill in your desired ending location.");
}
else if(emailF.getText().isEmpty()) {
alert.setHeaderText("Email Field Cannot Be Empty");
alert.setContentText("Please fill in your email address.");
}
else if(CardF.getText().isEmpty()) {
alert.setHeaderText("Card Field Cannot Be Empty");
alert.setContentText("Please fill in your card number.");
}
Optional<ButtonType> result = alert.showAndWait();

if (result.get() == ButtonType.OK)
{

}
else
{
// ... user chose CANCEL or closed the dialog
}
}


else {
String rs=null;
socketUtils su = new socketUtils();

Expand Down Expand Up @@ -357,9 +389,11 @@ public void run()

alert.showAndWait();
}
}
}
});
}

});

//Gridpane for payment
Expand Down
16 changes: 16 additions & 0 deletions Expedia/transactionLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,19 @@
05-12-2021 00.20.46 : SERVER : Email: Bill
05-12-2021 00.20.46 : SERVER : Card #: [email protected]
05-12-2021 00.20.47 : SERVER : quit
05-12-2021 14.01.34 : SERVER : Transaction>kiosk#001,0,0.00
05-12-2021 14.01.34 : SERVER : Name: ef
05-12-2021 14.01.34 : CLIENT : Transaction>kiosk#001,0,0.00
05-12-2021 14.01.35 : SERVER : Starting Location: New York City
05-12-2021 14.01.35 : SERVER : Ending Location: Los Angeles
05-12-2021 14.01.36 : SERVER : Email: eeff
05-12-2021 14.01.36 : SERVER : Card #: dwa
05-12-2021 14.01.36 : SERVER : Transaction>kiosk#001,0,0.00
05-12-2021 14.01.37 : SERVER : quit
05-12-2021 14.01.37 : SERVER : Name: ef
05-12-2021 14.01.37 : CLIENT : Transaction>kiosk#001,0,0.00
05-12-2021 14.01.37 : SERVER : Starting Location: New York City
05-12-2021 14.01.38 : SERVER : Ending Location: Los Angeles
05-12-2021 14.01.38 : SERVER : Email: eeff
05-12-2021 14.01.39 : SERVER : Card #: dwa
05-12-2021 14.01.40 : SERVER : quit

0 comments on commit 9c2c74c

Please sign in to comment.