public string saveTrialBlock(TrialBlockData results) { DataAccessor database = new DataAccessor(); results.parseStrings(); bool complete = database.recordTrialBlock(results); if (complete) return "You have now completed the study. Thank you for participating."; bool? offerAnother = database.allowTrial(database.getUserByID(results.userID)); if (offerAnother == null) return "You have now completed the study. Thank you for participating."; else if (offerAnother == true) return "Your results have been recorded. Please participate again today. <INPUT TYPE=\"button\" onClick=\"history.go(0)\" VALUE=\"Go again now.\">"; return "Thank you for your continuing participation. That will be all for today."; }
public string userUpdate(int userID, bool userActive, string userPassword, int studyID, int studyUserGroupID) { DataAccessor database = new DataAccessor(); User u = database.getUserByID(userID); User uu = database.login(u.Username, userPassword); StudiesUser su = database.studiesUserFromUser(u); bool movable = database.userEligibileToMove(userID); if (database.studyIDFromUser(u) != studyID || su.UserGroupID != studyUserGroupID) { if (!movable) return "Error: Cannot move user."; database.updateStudiesUser(userID, studyID, studyUserGroupID); } if(uu == null || (u.Active != userActive) ) { database.updateUser(userID, userActive, userPassword); } return "Update successful."; }
public string userDelete(int userID) { DataAccessor database = new DataAccessor(); User u = database.getUserByID(userID); string username = u.Username; if (database.deleteUser(userID)) { return username + " was successfully deleted."; } return "Error."; }