//protected void Page_Unload(object sender, EventArgs e) //{ // if (!DoneFlag) // { // SatyamTaskTableEntry taskEntry = JSonUtils.ConvertJSonToObject<SatyamTaskTableEntry>(Hidden_TaskEntryString.Value); // if (taskEntry == null) return; // // Decrement the DoneScore, releasing token after latest results are saved. // SatyamTaskTableAccess taskTableDB = new SatyamTaskTableAccess(); // taskTableDB.DecrementDoneScore(taskEntry.ID); // taskTableDB.close(); // } //} protected void SubmitButton_Click(object sender, EventArgs e) { DateTime SubmitTime = DateTime.Now; DateTime PageLoadTime = Convert.ToDateTime(Hidden_PageLoadTime.Value); SatyamTaskTableEntry taskEntry = JSonUtils.ConvertJSonToObject <SatyamTaskTableEntry>(Hidden_TaskEntryString.Value); SatyamResult result = new SatyamResult(); result.TaskParametersString = taskEntry.TaskParametersString; result.TaskStartTime = PageLoadTime; result.TaskEndTime = SubmitTime; result.TaskTableEntryID = taskEntry.ID; AmazonTaskResultInfo amazonInfo = new AmazonTaskResultInfo(); amazonInfo.AssignmentID = ""; amazonInfo.WorkerID = ""; amazonInfo.HITID = ""; result.amazonInfo = amazonInfo; result.TaskResult = Hidden_Result.Value; result.PrevResultID = Convert.ToInt32(Hidden_PrevResultID.Value); string resultString = JSonUtils.ConvertObjectToJSon <SatyamResult>(result); SatyamResultsTableAccess resultdb = new SatyamResultsTableAccess(); resultdb.AddEntry(taskEntry.JobTemplateType, taskEntry.UserID, taskEntry.JobGUID, resultString, taskEntry.ID, PageLoadTime, SubmitTime); resultdb.close(); SatyamTaskTableManagement.UpdateResultNumber(taskEntry.ID); // Decrement the DoneScore, releasing token after latest results are saved. SatyamTaskTableAccess taskTableDB = new SatyamTaskTableAccess(); //taskTableDB.DecrementDoneScore(taskEntry.ID); taskTableDB.UpdateDoneScore(taskEntry.ID, 0); taskTableDB.close(); //DoneFlag = true; //bool NotDone = getNewRandomJob(); //if (NotDone == false) //{ Response.Redirect("AllJobsDone.aspx"); //} }
protected void SubmitButton_Click(object sender, EventArgs e) { DateTime SubmitTime = DateTime.Now; DateTime PageLoadTime = Convert.ToDateTime(Hidden_PageLoadTime.Value); SatyamTaskTableEntry taskEntry = JSonUtils.ConvertJSonToObject <SatyamTaskTableEntry>(Hidden_TaskEntryString.Value); SatyamResult result = new SatyamResult(); result.TaskParametersString = taskEntry.TaskParametersString; result.TaskStartTime = PageLoadTime; result.TaskEndTime = SubmitTime; result.TaskTableEntryID = taskEntry.ID; AmazonTaskResultInfo amazonInfo = new AmazonTaskResultInfo(); amazonInfo.AssignmentID = Hidden_AmazonAssignmentID.Value; amazonInfo.WorkerID = Hidden_AmazonWorkerID.Value; amazonInfo.HITID = Hidden_HITID.Value; amazonInfo.PricePerHIT = Convert.ToDouble(Hidden_Price.Value); result.amazonInfo = amazonInfo; result.TaskResult = Hidden_Result.Value; string resultString = JSonUtils.ConvertObjectToJSon <SatyamResult>(result); SatyamResultsTableAccess resultdb = new SatyamResultsTableAccess(); resultdb.AddEntry(taskEntry.JobTemplateType, taskEntry.UserID, taskEntry.JobGUID, resultString, taskEntry.ID, PageLoadTime, SubmitTime); resultdb.close(); SatyamTaskTableManagement.UpdateResultNumber(taskEntry.ID); if (!Testing) { SatyamAmazonHITTableAccess HITdb = new SatyamAmazonHITTableAccess(); string HITID = result.amazonInfo.HITID; HITdb.UpdateStatusByHITID(HITID, HitStatus.submitted); HITdb.close(); AmazonMTurkNotification.submitAmazonTurkHit(result.amazonInfo.AssignmentID, result.amazonInfo.WorkerID, false); } Response.Redirect("AllJobsDone.aspx"); //} }
//protected void SubmitButton_Click(object sender, EventArgs e) private void storeResult() { DateTime SubmitTime = DateTime.Now; DateTime PageLoadTime = Convert.ToDateTime(Hidden_PageLoadTime.Value); SatyamTaskTableEntry taskEntry = JSonUtils.ConvertJSonToObject <SatyamTaskTableEntry>(Hidden_TaskEntryString.Value); string tracksString = TracksOutput_Hidden.Value; string urlList = Hidden_ImageURLList.Value; string[] fields = urlList.Split(','); DateTime start = DateTime.MinValue; List <DateTime> frameTimes = new List <DateTime>(); //double frameTimeSpanInMiliseconds = (Convert.ToDouble(Hidden_ChunkDuration.Value) / (double)fields.Length) * 1000; double frameTimeSpanInMiliseconds = (double)(1000) / Convert.ToDouble(fps_Hidden.Value); for (int i = 0; i < fields.Length; i++) { DateTime t; t = start.AddMilliseconds(frameTimeSpanInMiliseconds * i); frameTimes.Add(t); } string s = Raw_VATIC_DVA_Crowdsourced_Track_Collection.Raw_VATIC_DVA_Crowdsourced_Track_Collection_ToTrackStrings(tracksString, frameTimes); SatyamResult result = new SatyamResult(); result.TaskParametersString = taskEntry.TaskParametersString; result.TaskStartTime = PageLoadTime; result.TaskEndTime = SubmitTime; result.TaskTableEntryID = taskEntry.ID; AmazonTaskResultInfo amazonInfo = new AmazonTaskResultInfo(); amazonInfo.AssignmentID = Hidden_AmazonAssignmentID.Value; amazonInfo.WorkerID = Hidden_AmazonWorkerID.Value; amazonInfo.HITID = Hidden_HITID.Value; amazonInfo.PricePerHIT = Convert.ToDouble(Hidden_Price.Value); result.amazonInfo = amazonInfo; result.TaskResult = s; string resultString = JSonUtils.ConvertObjectToJSon <SatyamResult>(result); SatyamResultsTableAccess resultdb = new SatyamResultsTableAccess(); resultdb.AddEntry(taskEntry.JobTemplateType, taskEntry.UserID, taskEntry.JobGUID, resultString, taskEntry.ID, PageLoadTime, SubmitTime); resultdb.close(); SatyamTaskTableManagement.UpdateResultNumber(taskEntry.ID); if (!Testing) { SatyamAmazonHITTableAccess HITdb = new SatyamAmazonHITTableAccess(); string HITID = result.amazonInfo.HITID; HITdb.UpdateStatusByHITID(HITID, HitStatus.submitted); HITdb.close(); AmazonMTurkNotification.submitAmazonTurkHit(result.amazonInfo.AssignmentID, result.amazonInfo.WorkerID, false); } Response.Redirect("AllJobsDone.aspx"); }
public static void RunTest() { SatyamTaskTableManagement.PurgeAllAggregatedTasks(); }
protected void SubmitButton_Click(object sender, EventArgs e) { DateTime SubmitTime = DateTime.Now; DateTime PageLoadTime = Convert.ToDateTime(Hidden_PageLoadTime.Value); int count; bool isValidCount = int.TryParse(CountTextBox.Text, out count); if (!isValidCount) { ErrorLabel.Text = "Error : Ivalid Count."; ErrorLabel.ForeColor = System.Drawing.Color.Red; ErrorLabel.Font.Bold = true; } else if (count < 0) { ErrorLabel.Text = "Error : Count cannot be less than zero."; ErrorLabel.ForeColor = System.Drawing.Color.Red; ErrorLabel.Font.Bold = true; } else { ErrorLabel.Text = ""; CountTextBox.Text = ""; SatyamTaskTableEntry taskEntry = JSonUtils.ConvertJSonToObject <SatyamTaskTableEntry>(Hidden_TaskEntryString.Value); SatyamResult result = new SatyamResult(); result.TaskParametersString = taskEntry.TaskParametersString; result.TaskStartTime = PageLoadTime; result.TaskEndTime = SubmitTime; result.TaskTableEntryID = taskEntry.ID; AmazonTaskResultInfo amazonInfo = new AmazonTaskResultInfo(); amazonInfo.AssignmentID = Hidden_AmazonAssignmentID.Value; amazonInfo.WorkerID = Hidden_AmazonWorkerID.Value; amazonInfo.HITID = Hidden_HITID.Value; amazonInfo.PricePerHIT = Convert.ToDouble(Hidden_Price.Value); result.amazonInfo = amazonInfo; ObjectCountingResult sresult = new ObjectCountingResult(); sresult.Count = count; string sresultString = JSonUtils.ConvertObjectToJSon <ObjectCountingResult>(sresult); result.TaskResult = sresultString; string resultString = JSonUtils.ConvertObjectToJSon <SatyamResult>(result); SatyamResultsTableAccess resultdb = new SatyamResultsTableAccess(); resultdb.AddEntry(taskEntry.JobTemplateType, taskEntry.UserID, taskEntry.JobGUID, resultString, taskEntry.ID, PageLoadTime, SubmitTime); resultdb.close(); SatyamTaskTableManagement.UpdateResultNumber(taskEntry.ID); //SatyamTaskTableAccess taskDB = new SatyamTaskTableAccess(); //taskDB.IncrementDoneScore(taskEntry.ID); int noDone = Convert.ToInt32(Hidden_NoImagesDone.Value); noDone++; Hidden_NoImagesDone.Value = noDone.ToString(); bool NotDone = false; int noTasksPerJob = Convert.ToInt32(Hidden_TasksPerJob.Value); if (noDone < noTasksPerJob) { NotDone = getNewRandomJob(); } if (NotDone == false) { if (!Testing) { SatyamAmazonHITTableAccess HITdb = new SatyamAmazonHITTableAccess(); string HITID = result.amazonInfo.HITID; HITdb.UpdateStatusByHITID(HITID, HitStatus.submitted); HITdb.close(); AmazonMTurkNotification.submitAmazonTurkHit(result.amazonInfo.AssignmentID, result.amazonInfo.WorkerID, false); } Response.Redirect("MTurkTaskDonePage.aspx"); } } }
protected void SubmitButton_Click(object sender, EventArgs e) { DateTime SubmitTime = DateTime.Now; DateTime PageLoadTime = Convert.ToDateTime(Hidden_PageLoadTime.Value); if (CategorySelection_RadioButtonList.SelectedIndex != -1) { SatyamTaskTableEntry taskEntry = JSonUtils.ConvertJSonToObject <SatyamTaskTableEntry>(Hidden_TaskEntryString.Value); SatyamResult result = new SatyamResult(); result.TaskParametersString = taskEntry.TaskParametersString; result.TaskStartTime = PageLoadTime; result.TaskEndTime = SubmitTime; result.TaskTableEntryID = taskEntry.ID; AmazonTaskResultInfo amazonInfo = new AmazonTaskResultInfo(); amazonInfo.AssignmentID = Hidden_AmazonAssignmentID.Value; amazonInfo.WorkerID = Hidden_AmazonWorkerID.Value; amazonInfo.HITID = Hidden_HITID.Value; amazonInfo.PricePerHIT = Convert.ToDouble(Hidden_Price.Value); result.amazonInfo = amazonInfo; SingleObjectLabelingResult sresult = new SingleObjectLabelingResult(); sresult.Category = CategorySelection_RadioButtonList.Items[CategorySelection_RadioButtonList.SelectedIndex].Text; string sresultString = JSonUtils.ConvertObjectToJSon <SingleObjectLabelingResult>(sresult); result.TaskResult = sresultString; string resultString = JSonUtils.ConvertObjectToJSon <SatyamResult>(result); SatyamResultsTableAccess resultdb = new SatyamResultsTableAccess(); resultdb.AddEntry(taskEntry.JobTemplateType, taskEntry.UserID, taskEntry.JobGUID, resultString, taskEntry.ID, PageLoadTime, SubmitTime); resultdb.close(); SatyamTaskTableManagement.UpdateResultNumber(taskEntry.ID); //SatyamTaskTableAccess taskDB = new SatyamTaskTableAccess(); //taskDB.IncrementDoneScore(taskEntry.ID); int noDone = Convert.ToInt32(Hidden_NoImagesDone.Value); noDone++; Hidden_NoImagesDone.Value = noDone.ToString(); int noTasksPerJob = Convert.ToInt32(Hidden_TasksPerJob.Value); bool NotDone = false; if (noDone < noTasksPerJob) { NotDone = getNewRandomJob(); } if (NotDone == false) { if (!Testing) { SatyamAmazonHITTableAccess HITdb = new SatyamAmazonHITTableAccess(); string HITID = result.amazonInfo.HITID; HITdb.UpdateStatusByHITID(HITID, HitStatus.submitted); HITdb.close(); AmazonMTurkNotification.submitAmazonTurkHit(result.amazonInfo.AssignmentID, result.amazonInfo.WorkerID, false); } Response.Redirect("MTurkTaskDonePage.aspx"); } } }