private void save() { boolean status = true; if (valid.isEmpty(textField1.getText())) { status = false; new ValidationMSG(this, "Please Insert Start Year"); } else if (valid.isEmpty(textField2.getText())) { status = false; new ValidationMSG(this, "Please Insert End Year"); } else if (Integer.parseInt(textField1.getText()) >= Integer.parseInt(textField2.getText())) { status = false; new ValidationMSG(this, "Start year should be less then End year"); } else if (valid.isEmpty(textField3.getText())) { status = false; new ValidationMSG(this, "Please Insert Vat %"); } if (status) { VatModel vatModel = new VatModel(); vatModel.setVatId(0); vatModel.setVatPercent(Float.parseFloat(textField3.getText())); vatModel.setYearId( tableid.getYearId( Integer.parseInt(textField1.getText()), Integer.parseInt(textField2.getText()))); vatModel.setFirmId(1); vatModel.setVatUpdated(0); if (!dbinsert.insertVat(vatModel)) { new ValidationMSG(this, "Do not insert duplicate value"); } reset(); loadTableData(); } }
// used to save a new record private void save() { // check validation for empty field boolean status = true; if (valid.isEmpty(textField1.getText())) { status = false; new ValidationMSG(this, "Please Insert Rack Name"); } // /insert rack when all inputs are valid if (status) { RackModel rack = new RackModel(); rack.setRackId(0); rack.setRackName(textField1.getText()); if (!valid.isEmpty(textArea1.getText())) rack.setRackDesc(textArea1.getText()); rack.setFirmId(1); rack.setStoreId(tableid.getStoreId(comboBox1.getSelectedItem().toString())); dbinsert.insertRack(rack); rack.setDefault(); loadTableData(); reset(); } }