use of cn.bmob.v3.exception.BmobException in project expression by happy-yuxuan.
the class KDDQInfomationActivity method addInfo.
// 将数据保存到数据库(Bmob) ?????
private void addInfo() {
String phoneNumber = et_phoneNumber.getText().toString().trim();
String name = et_name.getText().toString().trim();
String addr = et_addr.getText().toString().trim();
String status = et_status.getText().toString().trim();
String other = et_other.getText().toString().trim();
// 获取代取用户的手机号,即送件人
String dq_phone = getIntent().getStringExtra("dq_phone");
BmobUser user = MyUser.getCurrentUser();
String username = user.getUsername();
UserDqInfomation DqInfo = new UserDqInfomation();
DqInfo.setUsername(username);
DqInfo.setPhone(phoneNumber);
DqInfo.setName(name);
DqInfo.setAddr(addr);
DqInfo.setStatus(status);
DqInfo.setOther(other);
DqInfo.setSuccess(false);
if (!TextUtils.isEmpty(dq_phone)) {
DqInfo.setDq_phone(dq_phone);
}
DqInfo.save(new SaveListener<String>() {
@Override
public void done(String objectId, BmobException e) {
if (e == null) {
// Toast.makeText(KDDQInfomationActivity.this, "创建数据成功:" + objectId, Toast.LENGTH_SHORT).show();
L.i("添加ok");
dialog.dismiss();
new AlertDialog.Builder(KDDQInfomationActivity.this).setTitle("注意").setMessage("代取信息填写成功\n请到 '我的订单' 中查看详细信息\n我们稍后联系您,请保持信息畅通").setPositiveButton("我的订单?", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startActivity(new Intent(KDDQInfomationActivity.this, UMyOrdersActivity.class));
finish();
}
}).setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).show();
} else {
L.i("代取信息添加失败:" + e.getMessage());
Toast.makeText(KDDQInfomationActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
}
use of cn.bmob.v3.exception.BmobException in project expression by happy-yuxuan.
the class KDGerenZhuceActivity method dealResult.
// 加入成功后处理当前页面
private void dealResult() {
List<BmobQuery<MyUser>> queries = new ArrayList<BmobQuery<MyUser>>();
BmobQuery<MyUser> q1 = new BmobQuery<MyUser>();
q1.addQueryKeys("teamFlag");
BmobUser user = MyUser.getCurrentUser();
String username = user.getUsername();
BmobQuery<MyUser> q2 = new BmobQuery<MyUser>();
q2.addWhereEqualTo("username", username);
queries.add(q1);
queries.add(q2);
BmobQuery<MyUser> query = new BmobQuery<MyUser>();
query.and(queries);
query.findObjects(new FindListener<MyUser>() {
@Override
public void done(List<MyUser> object, BmobException e) {
if (e == null) {
MyUser u = object.get(0);
if (!u.getTeamFlag().equals("")) {
setET(u.getMobilePhoneNumber(), u.getEmail(), u.getRealName(), u.getIdCard());
}
} else {
L.i("error dealResult" + e.getMessage() + e.getErrorCode());
}
}
});
}
use of cn.bmob.v3.exception.BmobException in project expression by happy-yuxuan.
the class MyInfoFragment method uploadImageHead.
// 上传图片到bmob
private void uploadImageHead(String bmString) {
BitmapDrawable bitmap = (BitmapDrawable) getResources().getDrawable(R.drawable.add_pic);
String addPicImgString = UtilTools.bitmapToString(getActivity(), bitmap);
if (!bmString.equals(addPicImgString)) {
MyUser newUser = new MyUser();
newUser.setImgHead(bmString);
BmobUser bmobUser = MyUser.getCurrentUser();
newUser.update(bmobUser.getObjectId(), new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
L.i("上传头像成功");
} else {
L.i("上传头像失败" + e);
}
}
});
}
}
use of cn.bmob.v3.exception.BmobException in project expression by happy-yuxuan.
the class RegiestActivity method registFromBmob.
/**
* 注册到 bmob云端
*
* @param username
* @param password
*/
private void registFromBmob(final String username, final String password) {
MyUser myUser = new MyUser();
myUser.setUsername(username);
myUser.setPassword(password);
// 注意:不能用save方法进行注册
myUser.signUp(new SaveListener<MyUser>() {
@Override
public void done(MyUser s, BmobException e) {
dialog.dismiss();
if (e == null) {
Toast.makeText(RegiestActivity.this, "注册成功", Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.putExtra("username", username);
intent.putExtra("password", password);
setResult(RESULT_OK, intent);
finish();
} else {
Toast.makeText(RegiestActivity.this, "注册失败", Toast.LENGTH_SHORT).show();
}
}
});
}
use of cn.bmob.v3.exception.BmobException in project expression by happy-yuxuan.
the class KDTeamRegister method regiestTeam.
private void regiestTeam() {
String team_phone = et_team_teleohone.getText().toString().trim();
String team_mail = et_team_mail.getText().toString().trim();
String tname = et_tname.getText().toString().trim();
if (!TextUtils.isEmpty(team_phone) && !TextUtils.isEmpty(team_mail) && !TextUtils.isEmpty(tname)) {
if (UtilTools.checkMobileNumber(team_phone) && UtilTools.checkEmail(team_mail)) {
MyUser u = new MyUser();
u.setMobilePhoneNumber(team_phone);
u.setEmail(team_mail);
u.setTeamFlag(tname);
BmobUser bmobUser = MyUser.getCurrentUser();
u.update(bmobUser.getObjectId(), new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
Toast.makeText(KDTeamRegister.this, "注册成功", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(KDTeamRegister.this, e.getMessage(), Toast.LENGTH_SHORT).show();
L.i(e.getMessage() + e.getErrorCode());
}
}
});
} else {
if (!UtilTools.checkMobileNumber(team_phone)) {
Toast.makeText(KDTeamRegister.this, "电话格式不正确", Toast.LENGTH_SHORT).show();
} else if (!UtilTools.checkEmail(team_mail)) {
Toast.makeText(KDTeamRegister.this, "邮箱格式不正确", Toast.LENGTH_SHORT).show();
}
}
} else {
Toast.makeText(KDTeamRegister.this, "信息不能为空", Toast.LENGTH_SHORT).show();
}
}
Aggregations