Exemplo n.º 1
0
  // update the claim
  private void buttonUpdateThisClaimActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_buttonUpdateThisClaimActionPerformed
    if (!CheckAllInputText( // check if all required fields not empty
        ThereIsText(EnterRepresentativeName.getText()),
        ThereIsText(jSpinnerEventTime.getValue().toString()),
        EnterDetail0.isVisible() && ThereIsText(EnterDetail0.getText()),
        !EnterDetail1.isVisible()
            || (EnterDetail1.isVisible() && ThereIsText(EnterDetail1.getText())),
        !EnterDetail2.isVisible()
            || (EnterDetail2.isVisible() && ThereIsText(EnterDetail2.getText())),
        !EnterDetail3.isVisible()
            || (EnterDetail3.isVisible() && ThereIsText(EnterDetail3.getText())),
        ThereIsText(EnterEventPlace.getText()))) {
      JOptionPane.showMessageDialog(
          null, "Insert valid values", "Error", JOptionPane.ERROR_MESSAGE);
    } else if ("Update this claim".equals(buttonUpdateThisClaim.getLabel())) {
      claim = new Claim();
      try {
        claim = sngltn.GetClaimById(Long.parseLong(jSpinnerClaimId.getValue().toString()));
      } catch (Exception ex) {
        Logger.getLogger(JustUpdateClaimForm.class.getName()).log(Level.SEVERE, null, ex);
      }

      for (int i = 0; i < receivedDocumnt.size(); i++) {
        receivedDocumnt.remove(i);
      }

      for (int i = 0; i < jTableDocumentsRequired.getRowCount(); i++) {
        if ((boolean) jTableDocumentsRequired.getValueAt(i, 1)) {
          receivedDocumnt.add((String) jTableDocumentsRequired.getValueAt(i, 0));
        }
      }

      claim.setRepresentativeName(EnterRepresentativeName.getText());
      claim.setInsuranceClaimStatus((ClaimStat) ComboBoxInsuranceClaimStatus.getSelectedItem());
      claim.setEventTime((Date) jSpinnerEventTime.getValue());
      claim.setEventPlace(EnterEventPlace.getText());
      claim.setMoreDetails(
          exsitDetailsToList(EnterDetail0, EnterDetail1, EnterDetail2, EnterDetail3));
      claim.setDocumentsReceived(receivedDocumnt);
      try {
        sngltn.UpdateClaim(claim, sngltn.GetMyPersonCstmrCrd(per_id).getPerson());
      } catch (Exception ex) {
        Logger.getLogger(JustUpdateClaimForm.class.getName()).log(Level.SEVERE, null, ex);
      }
      JOptionPane.showMessageDialog(
          null, "Update Claim Successfully", "", JOptionPane.PLAIN_MESSAGE);
    }
  } // GEN-LAST:event_buttonUpdateThisClaimActionPerformed
Exemplo n.º 2
0
 // closing the window
 private void formWindowClosing(
     java.awt.event.WindowEvent evt) { // GEN-FIRST:event_formWindowClosing
   try {
     int counter = 1;
     DefaultTableModel model = (DefaultTableModel) Claimtable.getModel();
     model.setRowCount(0);
     for (Claim Claim : sngltn.GetPerClaims(sngltn.GetMyPersonCstmrCrd(per_id).getPerson())) {
       model.addRow(
           new Object[] {
             String.valueOf(Claim.getId()),
             String.valueOf(Claim.getRepresentativeName()),
             String.valueOf(Claim.getInsuranceClaimStatus()),
             String.valueOf(Claim.getEventType()),
             String.valueOf(Claim.getEventTime()),
             String.valueOf(Claim.getEventPlace())
           });
     }
   } catch (Exception ex) {
     Logger.getLogger(AddCstmrCrdForm.class.getName()).log(Level.SEVERE, null, ex);
   }
 } // GEN-LAST:event_formWindowClosing
Exemplo n.º 3
0
  // Ctor
  public JustUpdateClaimForm(long PerId, Object ClaimID, JTable jtableClaim) throws Exception {
    this.receivedDocumnt = new ArrayList<String>();

    per_id = PerId;
    claim_id = Long.valueOf(ClaimID.toString());
    Claimtable = jtableClaim;

    claim = new Claim();
    claim = sngltn.GetClaimById(claim_id);

    int NumOfDetails = claim.getMoreDetailsSize();

    initComponents();
    java.awt.event.WindowEvent MyWindow = null;
    formWindowOpened(MyWindow);

    ArrayList<Documents> arr = SetReqDucmntsListByEvent(claim.getEventType());

    ComboBoxEventType.setModel(new DefaultComboBoxModel(EvntType.values()));
    ComboBoxInsuranceClaimStatus.setModel(new DefaultComboBoxModel(ClaimStat.values()));

    DetailsFieldsFirstDesplay(NumOfDetails);

    TextPerson_Name_ID.setEnabled(false);
    TextPerson_Name_ID.setText(
        "Person Name: "
            + sngltn.GetMyPersonCstmrCrd(per_id).getPerson().getNamePerson()
            + "\n"
            + "Preson ID: "
            + Long.toString(per_id));
    EnterRepresentativeName.setText(claim.getRepresentativeName());
    jSpinnerClaimId.setValue(claim_id);
    ComboBoxInsuranceClaimStatus.setSelectedItem(claim.getInsuranceClaimStatus());
    jSpinnerOpeningDate.setValue(claim.getOpeningDate());
    ComboBoxEventType.setSelectedItem(claim.getEventType());
    jSpinnerEventTime.setValue(claim.getEventTime());
    EnterEventPlace.setText(claim.getEventPlace());
    if (NumOfDetails == 1) {
      EnterDetail0.setText(claim.getMoreDetailsValues().get(0));
    } else if (NumOfDetails == 2) {
      EnterDetail0.setText(claim.getMoreDetailsValues().get(0));
      EnterDetail1.setText(claim.getMoreDetailsValues().get(1));
    } else if (NumOfDetails == 3) {
      EnterDetail0.setText(claim.getMoreDetailsValues().get(0));
      EnterDetail1.setText(claim.getMoreDetailsValues().get(1));
      EnterDetail2.setText(claim.getMoreDetailsValues().get(2));
    } else if (NumOfDetails == 4) {
      EnterDetail0.setText(claim.getMoreDetailsValues().get(0));
      EnterDetail1.setText(claim.getMoreDetailsValues().get(1));
      EnterDetail2.setText(claim.getMoreDetailsValues().get(2));
      EnterDetail3.setText(claim.getMoreDetailsValues().get(3));
    }
    try {
      int counter = 1;
      DefaultTableModel model = (DefaultTableModel) jTableDocumentsRequired.getModel();
      model.setRowCount(0);
      for (Documents doc : arr) {
        model.addRow(new Object[] {String.valueOf(doc), false});
      }
    } catch (Exception ex) {
      Logger.getLogger(AddCstmrCrdForm.class.getName()).log(Level.SEVERE, null, ex);
    }

    for (int i = 0; i < jTableDocumentsRequired.getRowCount(); i++) {
      for (String doc : claim.getDocumentsReceivedValues()) {
        if (jTableDocumentsRequired.getValueAt(i, 0).toString().equals(doc)) {
          jTableDocumentsRequired.setValueAt(true, i, 1);
        }
      }
    }
  }