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 bool recordTrialBlock(TrialBlockData results) { DataClasses1DataContext database = new DataClasses1DataContext(); StudiesUser x = (from su in database.StudiesUsers where su.StudyID == results.studyID && su.UserID == results.userID select su).Single(); TrialBlock newBlock = new TrialBlock(); newBlock.StudyID = results.studyID; newBlock.StartTime = results.taken; newBlock.UserID = results.userID; newBlock.TrialTypeID = results.typeID; newBlock.WordListID = x.WordListID; newBlock.WordSublistID = x.WordSublistID; database.TrialBlocks.InsertOnSubmit(newBlock); database.SubmitChanges(); int trialcount = results.clickID1s.Length; for (int i = 0; i < trialcount; i++) { Trial newTrial = new Trial(); newTrial.TrialBlockID = newBlock.ID; newTrial.WordID = results.words[i]; newTrial.TimeFirstIDpresented = results.showID1s[i]; newTrial.TimeFirstIDclicked = results.clickID1s[i]; newTrial.TimeSecondIDpresented = results.showID2s[i]; newTrial.TimeSecondIDclicked = results.clickID2s[i]; newTrial.TimeOptionsPresented = results.optionsShown[i]; newTrial.Option1ID = results.optionIDs[i][0]; newTrial.Option2ID = results.optionIDs[i][1]; newTrial.Option3ID = results.optionIDs[i][2]; newTrial.TimeOptionClicked = results.clickOptionTimes[i]; newTrial.OptionIDClicked = results.optionIDsClicked[i]; database.Trials.InsertOnSubmit(newTrial); database.SubmitChanges(); } return(evalPerformance(database, newBlock.ID, newBlock.Study.TargetWordsPerMinute, results.studyID, results.userID)); }
public bool recordTrialBlock(TrialBlockData results) { DataClasses1DataContext database = new DataClasses1DataContext(); StudiesUser x = (from su in database.StudiesUsers where su.StudyID == results.studyID && su.UserID == results.userID select su).Single(); TrialBlock newBlock = new TrialBlock(); newBlock.StudyID = results.studyID; newBlock.StartTime = results.taken; newBlock.UserID = results.userID; newBlock.TrialTypeID = results.typeID; newBlock.WordListID = x.WordListID; newBlock.WordSublistID = x.WordSublistID; database.TrialBlocks.InsertOnSubmit(newBlock); database.SubmitChanges(); int trialcount = results.clickID1s.Length; for (int i = 0; i < trialcount; i++) { Trial newTrial = new Trial(); newTrial.TrialBlockID = newBlock.ID; newTrial.WordID = results.words[i]; newTrial.TimeFirstIDpresented = results.showID1s[i]; newTrial.TimeFirstIDclicked = results.clickID1s[i]; newTrial.TimeSecondIDpresented = results.showID2s[i]; newTrial.TimeSecondIDclicked = results.clickID2s[i]; newTrial.TimeOptionsPresented = results.optionsShown[i]; newTrial.Option1ID = results.optionIDs[i][0]; newTrial.Option2ID = results.optionIDs[i][1]; newTrial.Option3ID = results.optionIDs[i][2]; newTrial.TimeOptionClicked = results.clickOptionTimes[i]; newTrial.OptionIDClicked = results.optionIDsClicked[i]; database.Trials.InsertOnSubmit(newTrial); database.SubmitChanges(); } return evalPerformance(database, newBlock.ID, newBlock.Study.TargetWordsPerMinute, results.studyID, results.userID); }