예제 #1
0
 @Override
 protected void onPreExecute() {
   super.onPreExecute();
   dialog = new ProgressDialog(UsersInformation.this);
   String message =
       ApplicationSettings.translationSettings.GetTranslation(
           "and_msg_checkingUser", "Checking user....");
   AlertMessage.setAlertHeaderColor(message, getApplicationContext());
   dialog.setCancelable(false);
   dialog.setMessage(AlertMessage.setAlertHeaderColor(message, getApplicationContext()));
   dialog.show();
   super.onPreExecute();
 }
예제 #2
0
    @Override
    protected void onPostExecute(String result) {
      super.onPostExecute(result);
      try {
        if (result != null && result.length() > 0) {
          msg = JSONHelper.getMessageResult("ForgotPasswordResult", "Message", forgotPswResponse);
          if (result.equalsIgnoreCase("SUCCESS")) {

            String title =
                ApplicationSettings.translationSettings.GetTranslation(
                    "and_lbl_recoverPassword", "Recover password");
            new AlertShow(ForgetPassword.this)
                .setTitle(AlertMessage.setAlertHeaderColor(title, getApplicationContext()))
                .setMessage(msg)
                .setPositiveButton(
                    "OK",
                    new DialogInterface.OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                        Intent intent = getIntent();
                        intent.putExtra("EXIT", false);
                        setResult(RESULT_OK, intent);
                        finish();
                      }
                    })
                .setCancelable(false)
                .show();
          } else if (result.equalsIgnoreCase("FAILED")) {
            AlertMessage.Alert(msg, ForgetPassword.this);
          } else {
            AlertMessage.Alert(result, ForgetPassword.this);
          }
        }
        dialog.dismiss();
      } catch (Exception ex) {
        PMWF_Log.fnlog(
            PMWF_Log.ERROR,
            "ForgetPassword: recoverpassword()",
            PMWF_Log.getStringFromStackTrace(ex));
        finish();
      }
    }
예제 #3
0
 @Override
 protected void onPreExecute() {
   super.onPreExecute();
   dialog = new ProgressDialog(ForgetPassword.this);
   String message =
       ApplicationSettings.translationSettings.GetTranslation(
           "and_msg_recoveringPassword", "Recovering password....");
   dialog.setMessage(AlertMessage.setAlertHeaderColor(message, getApplicationContext()));
   dialog.setCancelable(false);
   dialog.show();
 }
예제 #4
0
    @Override
    protected void onPostExecute(String result) {
      super.onPostExecute(result);

      try {
        if (result != null && result.length() > 0) {
          if (result.equalsIgnoreCase("FAILED")) {
            AlertMessage.Alert(msg, UsersInformation.this);
            editUserEmailAddress.requestFocus();
          } else if (result.equalsIgnoreCase("SUCCESS")) {
            if (tempUserInfoList != null) {
              tempUserInfoList.clear();
            }
            UsersInfo usersInfo = getUsersInfo();
            tempUserInfoList.add(usersInfo);
            String userInfoRegister = convertArrayToJsonString();
            registerUser(userInfoRegister != null ? userInfoRegister : "");
            // String pushResponse =
            // WebServiceWrapper.RegisterUser(userInfoRegister);

            // Intent contactInfo = new
            // Intent(getApplicationContext(),ContactInformation.class);
            // contactInfo.putExtra("TEMP_CONTACT_INFO",tempContactInfo);
            // startActivityForResult(contactInfo,
            // INTENT_NEXTWIZARD);
            // overridePendingTransition(R.anim.slide_in_right,R.anim.slide_out_left);
          } else {
            AlertMessage.Alert(result, UsersInformation.this);
          }
        }
        dialog.dismiss();
      } catch (Exception ex) {
        PMWF_Log.fnlog(
            PMWF_Log.ERROR,
            "UsersInformation: user onPostExecute()",
            PMWF_Log.getStringFromStackTrace(ex));
      }
    }
예제 #5
0
  private void registerUser(String usersInfo) {
    final String usersInfoFinal = usersInfo;
    if (NetworkService.hasInternetConnection(getApplicationContext())) {
      ApplicationSettings.isWeberviceReachable = WebServiceWrapper.Ping();
      if (ApplicationSettings.isWeberviceReachable) {

        new AsyncTask<String, Void, String>() {

          ProgressDialog dialog;

          @Override
          protected void onPreExecute() {
            super.onPreExecute();
            dialog = new ProgressDialog(UsersInformation.this);
            String message =
                ApplicationSettings.translationSettings.GetTranslation(
                    "and_msg_registering", "Registering user....");
            dialog.setMessage(AlertMessage.setAlertHeaderColor(message, getApplicationContext()));
            dialog.setCancelable(false);
            dialog.show();
          }

          @Override
          protected String doInBackground(String... result) {
            String pushResponse = WebServiceWrapper.RegisterUser(usersInfoFinal);
            return pushResponse;
          }

          @Override
          protected void onPostExecute(String result) {
            super.onPostExecute(result);

            try {
              if (dialog != null) {
                dialog.dismiss();
              }
            } catch (Exception ex) {

            }
            try {
              Log.i("registeruser", result != null ? result : "Null response");
              if (result != null) {
                String msg = JSONHelper.getMessageResult("RegisterUserResult", "Message", result);

                if (JSONHelper.getJsonObjectValueForRegister("IsSuccessfull", result)) {
                  String message =
                      ApplicationSettings.translationSettings.GetTranslation(
                          "and_lbl_register", "Register");
                  new AlertShow(UsersInformation.this)
                      .setTitle(AlertMessage.setAlertHeaderColor(message, getApplicationContext()))
                      .setMessage(msg)
                      .setPositiveButton(
                          "OK",
                          new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                              finish();
                            }
                          })
                      .setCancelable(false)
                      .show();

                } else {
                  String title =
                      ApplicationSettings.translationSettings.GetTranslation(
                          "and_lbl_register", "Register");
                  new AlertShow(UsersInformation.this)
                      .setTitle(AlertMessage.setAlertHeaderColor(title, getApplicationContext()))
                      .setMessage(msg)
                      .setPositiveButton(
                          "OK",
                          new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                              finish();
                            }
                          })
                      .setCancelable(false)
                      .show();
                }
              } else {
                AlertMessage.Alert(
                    ApplicationSettings.translationSettings.GetTranslation(
                        "and_msg_noInternetAccess", "No internet access."),
                    UsersInformation.this);
              }
            } catch (Exception ex) {
              PMWF_Log.fnlog(
                  PMWF_Log.ERROR,
                  "UsersInformation: register onPostExecute()",
                  PMWF_Log.getStringFromStackTrace(ex));
              finish();
            }
          }
        }.execute();
      } else {
        AlertMessage.Alert(
            ApplicationSettings.translationSettings.GetTranslation(
                "and_msg_couldnotAccessToServer", "Couldnot access the server."),
            UsersInformation.this);
      }
    } else {
      AlertMessage.Alert(
          ApplicationSettings.translationSettings.GetTranslation(
              "and_msg_noInternetAccess", "No internet access."),
          UsersInformation.this);
    }
  }