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_Image_MTurk, price);

                entry = taskTableDB.getMinimumTriedNewEntryForWorkerIDByTemplateAndPrice(Hidden_AmazonWorkerID.Value,
                                                                                         TaskConstants.Counting_Image_MTurk, price);
            }
            else
            {
                entry = taskTableDB.getMinimumTriedEntryByTemplate(TaskConstants.Counting_Image_MTurk);
            }

            if (entry != null)
            {
                taskTableDB.IncrementDoneScore(entry.ID);
                SatyamTask task = JSonUtils.ConvertJSonToObject <SatyamTask>(entry.TaskParametersString);
                string     uri  = task.SatyamURI;
                DisplayImage.ImageUrl = 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("SINGLE_OBJECT_LABLING_MTURK", price);
                entry = taskTableDB.getMinimumTriedNewEntryForWorkerIDByTemplateAndPrice(Hidden_AmazonWorkerID.Value,
                                                                                         TaskConstants.Classification_Video_MTurk, price);
            }
            else
            {
                entry = taskTableDB.getMinimumTriedEntryByTemplate(TaskConstants.Classification_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;
                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);
            }
        }
        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;

            //Thread.Sleep(5000);

            if (SubmitButton.Enabled == true)
            {
                //entry = taskTableDB.getMinimumTriedEntryByTemplateAndPrice(TaskConstants.Detection_Image_MTurk, price);
                //entry = taskTableDB.getMinimumTriedNewEntryForWorkerIDByTemplateAndPrice(Hidden_AmazonWorkerID.Value,
                //    TaskConstants.Detection_Image_MTurk, price, doneScore);
                entry = taskTableDB.getMinimumTriedNewEntryForWorkerIDByTemplateAndPrice(Hidden_AmazonWorkerID.Value,
                                                                                         TaskConstants.Segmentation_Image_MTurk, price);
            }
            else
            {
                entry = taskTableDB.getMinimumTriedEntryByTemplate(TaskConstants.Segmentation_Image_MTurk);
            }
            taskTableDB.close();

            if (entry == null)
            {
                return(false);
            }

            taskTableDB = new SatyamTaskTableAccess();
            taskTableDB.IncrementDoneScore(entry.ID);
            taskTableDB.close();

            SatyamTask task = JSonUtils.ConvertJSonToObject <SatyamTask>(entry.TaskParametersString);
            string     uri  = task.SatyamURI;

            TheImage.ImageUrl = uri;

            SatyamJob jobDefinitionEntry      = task.jobEntry;
            ImageSegmentationSubmittedJob job = JSonUtils.ConvertJSonToObject <ImageSegmentationSubmittedJob>(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));
            }

            Hidden_BoundaryLines.Value = JSonUtils.ConvertObjectToJSon(job.BoundaryLines);

            Hidden_TaskEntryString.Value = JSonUtils.ConvertObjectToJSon <SatyamTaskTableEntry>(entry);
            Hidden_PageLoadTime.Value    = DateTime.Now.ToString();

            return(true);
        }