Ejemplo n.º 1
0
 // for update a record
 private void update() {
   boolean status = true;
   if (rack == null) {
     status = false;
     new ValidationMSG(
         this, "Please Select A Row from Table Then Click on View to Update Rack Details");
   } else if (valid.isEmpty(textField1.getText())) {
     status = false;
     new ValidationMSG(this, "Please Insert Rack Name");
   }
   if (status) {
     rack.setRackName(textField1.getText());
     if (!valid.isEmpty(textArea1.getText())) rack.setRackDesc(textArea1.getText());
     dbupdate.updateRack(rack);
     reset();
     loadTableData();
     rack = null;
   }
 }
Ejemplo n.º 2
0
  // 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();
    }
  }