public void editBusinessInformation() { RequestContext context = RequestContext.getCurrentInstance(); boolean checkImage = true; if (!imageLogo.equalsIgnoreCase(business.getBusinessLogo().toString().trim())) { checkImage = upload.deleteImage(business.getBusinessLogo().toString().trim()); business.setBusinessLogo(imageLogo); } boolean checkUpdate = commonEJB.updateData(business); if (checkUpdate == true) { showMessage("Success", "Information details have changed successful", "info"); context.addCallbackParam("editBusiness", "yes"); } else { showMessage("Fail", "Cannot persist to database", "error"); context.addCallbackParam("editBusiness", ""); } }
public void changePassword() { RequestContext context = RequestContext.getCurrentInstance(); Business b = (Business) commonEJB.getSingleInfo( "select b from Business b where b.username = '******'"); if (b.getPassword().toString().trim().equals(oldPassword.trim())) { b.setPassword(newPassword); boolean checkChangePass = commonEJB.updateData(b); if (checkChangePass == true) { showMessage("Success", "Password has changed successful", "info"); } else { showMessage("Fail", "Cannot persist to database", "error"); } context.addCallbackParam("changedPass", "yes"); } else { showMessage("Old password is incorrect", null, "error"); context.addCallbackParam("changedPass", ""); } }