public void getRegisterUsers() { if (AssertValue.isNotNullAndNotEmpty(phonenumbers)) { final ProgressDialog registerDialog = ProgressDialog.show( OrgPhoneUserActivity.this, null, getResources().getString(R.string.app_wating), true); Resource resource = resourceFactory.create("QueryUsersByPhones"); resource.param("instid", instid); resource.param("phones", phonenumbers); resourceFactory.invok( resource, new AsyncHttpResponseCallback() { @Override public void onSuccess(Response response) { users = (List<User>) response.getPayload(); setIsRegister(); } @Override public void onFailure(Response response) {} @Override public void onFinally(Response response) { registerDialog.dismiss(); } }); } }
@Override public void load(String id, final FormUtilFactory.LoadValueCompleted callback) { // final User user = UserCache.getInstance().getUser(id); final User user = null; if (user == null) { ResourceFactory resourceFactory = JupiterApplication.getBeanManager().get(ResourceFactory.class); Resource resource = resourceFactory.create("QueryUserInfoByIdService"); resource.param("userid", id); resource.invok( new AsyncHttpResponseCallback() { @Override public void onSuccess(Response response) { User user = (User) response.getPayload(); callback.callback(user); } @Override public void onFailure(Response response) { System.out.println(response.getCause()); } @Override public void onFinally(Response response) {} }); return; } callback.callback(user); }
private void queryUserByIdAndSetName(final String userid) { Resource resource = resourceFactory.create("QueryUserInfoByIdService"); resource.param("userid", userid); resource.invok( new AsyncHttpResponseCallback() { @Override public void onSuccess(Response response) { User user = (User) response.getPayload(); if (AssertValue.isNotNullAndNotEmpty(user.getName()) && !user.getName().equals("none")) { managerLayout.getSutitleTv().setText(user.getName()); } else { managerLayout.getSutitleTv().setText(user.getNo()); } } @Override public void onFailure(Response response) { Toast.makeText(mContext, response.getCause(), Toast.LENGTH_SHORT).show(); } @Override public void onFinally(Response response) {} }); }
@Override public void onClick(View v) { if (!AssertValue.isNotNullAndNotEmpty(instNoEt.getText().toString())) { Toast.makeText(mContext, getString(R.string.inst_no_input_notice), Toast.LENGTH_SHORT) .show(); } else if (!AssertValue.isNotNullAndNotEmpty(companyNameEt.getText().toString())) { Toast.makeText( mContext, getString(R.string.company_name_input_notice), Toast.LENGTH_SHORT) .show(); } else if (staffNumLayout.getSutitleTv().getVisibility() == View.GONE) { Toast.makeText(mContext, getString(R.string.staff_num_input_notice), Toast.LENGTH_SHORT) .show(); } else if (!isInstNo(instNoEt.getText().toString())) { Toast.makeText( mContext, getString(R.string.inst_no_right_input_notice), Toast.LENGTH_SHORT) .show(); } else { final Resource resource = resourceFactory.create("InstInit"); resource .param("userid", userid) .param("companyName", companyNameEt.getText().toString()) .param("companyNo", instNoEt.getText().toString()) .param("companyScale", staffNumCategory); final ProgressDialog progressDialog = ProgressDialog.show( InitInstActivity.this, null, getString(R.string.app_wating), true); resource.invok( new AsyncHttpResponseCallback() { @Override public void onSuccess(Response response) { Toast.makeText( mContext, getString(R.string.init_inst_success), Toast.LENGTH_SHORT) .show(); setResult(InstCommand.RESULT_CODE_OK); finish(); } @Override public void onFailure(Response response) { Toast.makeText(mContext, response.getCause(), Toast.LENGTH_SHORT).show(); } @Override public void onFinally(Response response) { progressDialog.dismiss(); } }); } }
private void getOptionMap() { Resource resource = resourceFactory.create("QueryMdInstScale"); resource.param("userid", userid); final ProgressDialog progressDialog = ProgressDialog.show(this, null, getString(R.string.app_wating)); resource.invok( new AsyncHttpResponseCallback() { @Override public void onSuccess(Response response) { MdInstScales mdInstScales = (MdInstScales) response.getPayload(); if (AssertValue.isNotNull(mdInstScales) && AssertValue.isNotNullAndNotEmpty(mdInstScales.getBizMdInstScales())) { optionMap = new ArrayList<SerialableEntry<String, String>>(); for (int i = 0; i < mdInstScales.getBizMdInstScales().size(); i++) { optionMap.add( i, new SerialableEntry<String, String>( mdInstScales.getBizMdInstScales().get(i).getType(), mdInstScales.getBizMdInstScales().get(i).getName())); } multiSelectCommand.setOptions(optionMap); } multiSelectCommand.setMaxNum(1); multiSelectCommand.setIsCancelable(true); MultiSelectActivity.start(InitInstActivity.this, multiSelectCommand); } @Override public void onFailure(Response response) { Toast.makeText(mContext, response.getCause(), Toast.LENGTH_SHORT).show(); } @Override public void onFinally(Response response) { progressDialog.dismiss(); } }); }