private bool getNewRandomJob() { double price = 0; bool success = Double.TryParse(Hidden_Price.Value, out price); if (!success) { price = 0; } SatyamTaskTableAccess taskTableDB = new SatyamTaskTableAccess(); SatyamTaskTableEntry entry = null; if (SubmitButton.Enabled == true) { entry = taskTableDB.getMinimumTriedEntryByTemplateAndPrice(TaskConstants.Counting_Video_MTurk, price); } else { entry = taskTableDB.getMinimumTriedEntryByTemplate(TaskConstants.Counting_Video_MTurk); } if (entry != null) { taskTableDB.IncrementDoneScore(entry.ID); SatyamTask task = JSonUtils.ConvertJSonToObject <SatyamTask>(entry.TaskParametersString); string uri = task.SatyamURI; Hidden_VideoURL.Value = uri; SatyamJob jobDefinitionEntry = task.jobEntry; ObjectCountingSubmittedJob job = JSonUtils.ConvertJSonToObject <ObjectCountingSubmittedJob>(jobDefinitionEntry.JobParameters); ObjectNameLabel.Text = job.ObjectName; ObjectNameLabel1.Text = job.ObjectName; Hidden_TasksPerJob.Value = jobDefinitionEntry.TasksPerJob.ToString(); if (job.Description != "") { DescriptionPanel.Visible = true; DescriptionTextPanel.Controls.Add(new LiteralControl(job.Description)); } Hidden_TaskEntryString.Value = JSonUtils.ConvertObjectToJSon <SatyamTaskTableEntry>(entry); Hidden_PageLoadTime.Value = DateTime.Now.ToString(); NoLabeled.Text = Hidden_NoImagesDone.Value; taskTableDB.close(); return(true); } else { taskTableDB.close(); return(false); } }
private bool getNewRandomJob() { double price = 0; bool success = Double.TryParse(Hidden_Price.Value, out price); if (!success) { price = 0; } SatyamTaskTableAccess taskTableDB = new SatyamTaskTableAccess(); SatyamTaskTableEntry entry = null; if (SubmitButton.Enabled == true) { //entry = taskTableDB.getMinimumTriedEntryByTemplateAndPrice(TaskConstants.Classification_Image_MTurk, price, DoneScore); entry = taskTableDB.getMinimumTriedEntryByTemplateAndPrice(TaskConstants.Classification_Image_MTurk, price); //entry = taskTableDB.getMinimumTriedNewEntryForWorkerIDByTemplateAndPrice(Hidden_AmazonWorkerID.Value, // TaskConstants.Classification_Image_MTurk, price, DoneScore); } else { entry = taskTableDB.getMinimumTriedEntryByTemplate(TaskConstants.Classification_Image_MTurk); } if (entry != null) { //DoneScore = entry.DoneScore;//next time you don't have to start from -1 taskTableDB.IncrementDoneScore(entry.ID); SatyamTask task = JSonUtils.ConvertJSonToObject <SatyamTask>(entry.TaskParametersString); string uri = task.SatyamURI; DisplayImage.ImageUrl = uri; SatyamJob jobDefinitionEntry = task.jobEntry; SingleObjectLabelingSubmittedJob job = JSonUtils.ConvertJSonToObject <SingleObjectLabelingSubmittedJob>(jobDefinitionEntry.JobParameters); List <string> categories = job.Categories; CategorySelection_RadioButtonList.Items.Clear(); for (int i = 0; i < categories.Count; i++) { ListItem l = new ListItem(categories[i]); CategorySelection_RadioButtonList.Items.Add(l); } if (job.Description != "") { DescriptionPanel.Visible = true; DescriptionTextPanel.Controls.Add(new LiteralControl(job.Description)); //DescriptionLabel.Text = job.Description; } Hidden_TasksPerJob.Value = jobDefinitionEntry.TasksPerJob.ToString(); Hidden_TaskEntryString.Value = JSonUtils.ConvertObjectToJSon <SatyamTaskTableEntry>(entry); Hidden_PageLoadTime.Value = DateTime.Now.ToString(); NoLabeled.Text = Hidden_NoImagesDone.Value; taskTableDB.close(); return(true); } else { taskTableDB.close(); return(false); } }