Search in sources :

Example 1 with DeleteUserCredentials

use of system.DeleteUserCredentials in project Money-Manager by krHasan.

the class RegistrationIssueController method btnDelete.

@FXML
private void btnDelete(ActionEvent event) {
    if (!txtUsername.getText().equals(getUsername())) {
        lblMsgInformation.setText("Information did't match");
        txtUsername.clear();
        passPassword.clear();
        loadSQuestion();
        txtAnswer.clear();
    } else if (!passPassword.getText().equals(getPassword())) {
        lblMsgInformation.setText("Information did't match");
        txtUsername.clear();
        passPassword.clear();
        loadSQuestion();
        txtAnswer.clear();
    } else if (!securityQuestionAnswerIsOk(txtAnswer.getText())) {
        lblMsgInformation.setText("Information did't match");
        txtUsername.clear();
        passPassword.clear();
        loadSQuestion();
        txtAnswer.clear();
    } else if (!cmboSecurityQuestion.getValue().equals(getSavedSecurityQuestion())) {
        lblMsgInformation.setText("Information did't match");
        txtUsername.clear();
        passPassword.clear();
        loadSQuestion();
        txtAnswer.clear();
    } else {
        new DeleteUserCredentials().initializeApplication();
        Stage RegistrationIssueStage = (Stage) btnDelete.getScene().getWindow();
        (new GoToOperation()).goToSignIn(RegistrationIssueStage);
        Alert confirmationMsg = new Alert(AlertType.INFORMATION);
        confirmationMsg.setTitle("Operation Successful");
        confirmationMsg.setHeaderText(null);
        confirmationMsg.setContentText("User Information Deleted Successfully");
        confirmationMsg.setX(RegistrationIssueStage.getX() + 200);
        confirmationMsg.setY(RegistrationIssueStage.getY() + 170);
        Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent event) {
                confirmationMsg.hide();
            }
        }));
        idlestage.setCycleCount(1);
        idlestage.play();
        confirmationMsg.showAndWait();
    }
}
Also used : Timeline(javafx.animation.Timeline) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) GoToOperation(operation.GoToOperation) KeyFrame(javafx.animation.KeyFrame) Alert(javafx.scene.control.Alert) DeleteUserCredentials(system.DeleteUserCredentials) FXML(javafx.fxml.FXML)

Aggregations

KeyFrame (javafx.animation.KeyFrame)1 Timeline (javafx.animation.Timeline)1 ActionEvent (javafx.event.ActionEvent)1 FXML (javafx.fxml.FXML)1 Alert (javafx.scene.control.Alert)1 Stage (javafx.stage.Stage)1 GoToOperation (operation.GoToOperation)1 DeleteUserCredentials (system.DeleteUserCredentials)1