コード例 #1
0
  // --------------------------------------------------------------------------------
  // Name: IsValidData
  // Abstract: Check all the data and warn the user if it's bad
  // --------------------------------------------------------------------------------
  private boolean IsValidData() {
    // Assume data is good easier to code that way
    boolean blnIsValidData = true;
    try {
      String strErrorMessage = "Please correct the following error(s):\n";

      // Trim all textboxes
      CUtilities.TrimAllFormTextBoxes(this);

      // Team
      if (m_txtTeam.getText().equals("") == true) {
        strErrorMessage += "-Team cannot be blank\n";
        blnIsValidData = false;
      }

      // Mascot
      if (m_txtMascot.getText().equals("") == true) {
        strErrorMessage += "-Mascot cannot be blank\n";
        blnIsValidData = false;
      }

      // Bad data
      if (blnIsValidData == false) {
        CMessageBox.Show(this, strErrorMessage, getTitle() + " Error", enuIconType.Warning);
      }

    } catch (Exception excError) {
      // log and display errors
      CUtilities.WriteLog(excError);
    }

    return blnIsValidData;
  }