之前的任务分工表传错了。

This commit is contained in:
qinjiaming_branch 2016-08-22 08:12:26 +08:00
parent 668cd69b6e
commit 56753dcdbd
8 changed files with 3 additions and 26 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 536 KiB

View File

@ -28,34 +28,28 @@ import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.SaveListener;
public class LibraryReservationActivity extends Activity {
private Button btnLogin;
private SimpleDateFormat dateFormat;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_libraryreservation);
TextView tvTitle = (TextView) findViewById(R.id.tv_title);
tvTitle.setText("预定研修室");
final String roomId = getIntent().getStringExtra("roomId");
final String roomName = getIntent().getStringExtra("roomName");
TextView tvRoom = (TextView) findViewById(R.id.tv_room);
tvRoom.setText("研修室:" + roomName);
btnLogin = (Button) findViewById(R.id.btn_login);
dateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
// 查找Person表里面id为6b6c11c537的数据
BmobQuery<Reservation> bmobQuery = new BmobQuery<Reservation>();
bmobQuery.addWhereEqualTo("userId", User.userId);
bmobQuery.addWhereEqualTo("roomId", roomId);
bmobQuery.findObjects(LibraryReservationActivity.this, new FindListener<Reservation>() {
@Override
public void onSuccess(List<Reservation> newsList) {
if (!newsList.isEmpty() /*newsList.size() != 0*/) {
@ -68,7 +62,6 @@ public class LibraryReservationActivity extends Activity {
Reservation gameScore = new Reservation();
gameScore.setObjectId(newsList.get(0).getObjectId());
gameScore.delete(LibraryReservationActivity.this);
} else {
btnLogin.setEnabled(false);
btnLogin.setText("已经预定" + (TextUtils.isEmpty(dateTime) ? "" : (" " + dateTime)));
@ -78,53 +71,39 @@ public class LibraryReservationActivity extends Activity {
//e.printStackTrace();
logger.log(Level.SEVERE, "something may be wrong", e);
}
}
}
@Override
public void onError(int arg0, String arg1) {
toast("查询失败");
}
});
btnLogin.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
DateTimePickDialogUtil dateTimePicKDialog = new DateTimePickDialogUtil(LibraryReservationActivity.this,
dateFormat.format(new Date()));
dateTimePicKDialog.dateTimePicKDialog(new DateTimeListener() {
@Override
public void onDateTimeChane(final String dateTime) {
// TODO Auto-generated method stub
Reservation reservation = new Reservation();
reservation.setRoomId(roomId);
reservation.setRoomName(roomName);
reservation.setUserId(User.userId);
reservation.setDateTime(dateTime);
reservation.save(LibraryReservationActivity.this, new SaveListener() {
@Override
public void onSuccess() {
// TODO Auto-generated method stub
toast("预定成功");
btnLogin.setEnabled(false);
btnLogin.setText("已经预定 " + dateTime);
}
@Override
public void onFailure(int arg0, String arg1) {
// TODO Auto-generated method stub
toast("预定失败");
}
});
}
@ -132,9 +111,7 @@ public class LibraryReservationActivity extends Activity {
}
});
}
private void toast(String toast) {
Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
}