Last active
May 6, 2016 11:33
-
-
Save jsdevjournal/088cba847e6c314f4f2f6f967e1abb02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private final String CUSTOMER_KEY = "customer_id"; | |
private final String SUPPORTER_KEY = "supporter_id"; | |
private final String JOB_TYPE_KEY = "job_type"; | |
private final String LEVEL_KEY = "level"; | |
private final String BOOK_KEY = "book"; | |
private final String GENDER_KEY = "gender"; | |
private final String EXPECT_HR_KEY = "expect_hr"; | |
private final String SCHEDULE_KEY = "schedule"; | |
private final String LAUNDRY_KEY = "laundry"; | |
private final String CLEANING_KEY = "cleaning"; | |
private final String IRONING_KEY = "ironing"; | |
private final String FLOORS_KEY = "floors"; | |
private final String ROOMS_KEY = "rooms"; | |
private final String STATUS_KEY = "status"; | |
private final String ENGLISH_KEY = "english"; | |
private final String PICK_LOCATION_KEY = "pick_location"; | |
private final String DROP_LOCATION_KEY = "drop_location"; | |
private final String DROP_CONTACT_NAME_KEY = "drop_contact_name"; | |
private final String DROP_CONTACT_NUMBER_KEY = "drop_contact_number"; | |
private final String AGE_KEY = "age_range"; | |
private final String ITEM_DESCRIPTION_KEY = "item_description"; | |
private final String CUSTOMER_REVIEW_KEY = "customer_review"; | |
public static void createTutorJob(int level, | |
int expectHr, | |
boolean book, | |
@NonNull String gender, | |
@NonNull Date schedule, | |
@Nullable final Callback.ResultCallback<Job> callback){ | |
Validate.notNullOrEmpty(gender, "gender"); | |
final Job job = new Job(); | |
job.setJobType(Supporter.TYPE_TUTOR); | |
job.setLevel(level); | |
job.setBook(book); | |
job.setGender(gender); | |
job.setExpectHr(expectHr); | |
job.setSchedule(schedule); | |
job.setCustomerId(ParseApi.user.getCustomerId()); | |
job.getObject().saveInBackground(new SaveCallback() { | |
@Override | |
public void done(ParseException e) { | |
if(e == null){ | |
ParseApi.user.getCustomerId().setCurrentJob(job); | |
ParseApi.user.getCustomerId().getObject().saveInBackground(new SaveCallback() { | |
@Override | |
public void done(ParseException e) { | |
if(e == null){ | |
callbackInMainThread(job, null, callback); | |
}else{ | |
callbackInMainThread(null, e.getMessage(), callback); | |
} | |
} | |
}); | |
}else{ | |
callbackInMainThread(null, e.getMessage(), callback); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment