Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @FXML
- public void addProductToOrder(){
- String nameOfProduct=selectedProduct.getSelectionModel().getSelectedItem().getName();
- String count = countOfProduct.getText();
- int amountOfProduct = Integer.parseInt(count);
- double priceOfProduct =selectedProduct.getSelectionModel().getSelectedItem().getPrice();
- Product product = new Product(nameOfProduct,amountOfProduct,priceOfProduct);
- if(DataBase.getInstance().reduceProductAmountIfPossible(selectedProduct.getSelectionModel().getSelectedItem(),amountOfProduct)){
- tableViewOrder.getItems().add(product);
- }
- else{
- Alert alert = new Alert(Alert.AlertType.ERROR);
- alert.setHeaderText("Nie mamy tyle towaru");
- alert.showAndWait();
- }
- costOfOrder.setText(sumOfOrder()+ " zł");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement