Example #1
0
        public TaskDetails GetTask(string sBotID, string sTaskType)
        {
            OptimizationTask oTask = oDB.OptimizationTasks.Where(x => x.TaskStaus == "available" && x.TaskType == sTaskType).FirstOrDefault();

            if (oTask == null)
            {
                return(null);
            }
            else
            {
                oTask.AllottedOn = DateTime.UtcNow;
                oTask.DoneBy     = sBotID;
                oTask.TaskStaus  = "processing";
                oDB.SaveChanges();

                return(new TaskDetails()
                {
                    TaskID = oTask.TaskID,
                    TaskType = oTask.TaskType,
                    Name = oTask.Name,
                    InputValues = oTask.InputValues,
                    ReferenceValues = oTask.ReferenceValues,
                    Notes = oTask.Notes
                });
            }
        }
Example #2
0
        public string CreateAdditionTask(string sTaskName, AdditionInput oInput)
        {
            try
            {
                string sID = ((LoginAccount)Session["loggedInUser"]).AccountID;

                OptimizationTask oOT = new OptimizationTask()
                {
                    TaskID      = GenerateTaskID(),
                    IssuedOn    = DateTime.UtcNow,
                    Name        = sTaskName,
                    TaskStaus   = "available",
                    TaskType    = "addition",
                    IssuedBy    = sID,
                    Logs        = "",
                    Notes       = "",
                    InputValues = oDF.ObjectToXmlString(oInput)
                };
                oDB.OptimizationTasks.Add(oOT);
                oDB.SaveChanges();
                return(oOT.TaskID);
            }
            catch
            {
                return("0");
            }
        }
Example #3
0
        public void SubmitResult(string sTaskID, string sOutputValues, string sLogs, string sStatus)
        {
            OptimizationTask oTask = oDB.OptimizationTasks.Where(x => x.TaskID == sTaskID).FirstOrDefault();

            oTask.OutputValues = sOutputValues;
            oTask.Logs         = sLogs;
            oTask.TaskStaus    = sStatus;
            oTask.CompletedOn  = DateTime.UtcNow;

            oDB.SaveChanges();
        }
Example #4
0
 public string DeleteTask(string sTaskID)
 {
     try
     {
         OptimizationTask oTask = oDB.OptimizationTasks.Where(x => x.TaskID == sTaskID).FirstOrDefault();
         oDB.OptimizationTasks.Remove(oTask);
         oDB.SaveChanges();
         return("1");
     }
     catch
     {
         return("Error Processing Request");
     }
 }//
Example #5
0
 public string ResetTask(string sTaskID)
 {
     try
     {
         OptimizationTask oTask = oDB.OptimizationTasks.Where(x => x.TaskID == sTaskID).FirstOrDefault();
         oTask.TaskStaus    = "available";
         oTask.OutputValues = null;
         oTask.Logs         = null;
         oTask.IssuedOn     = DateTime.UtcNow;
         oTask.AllottedOn   = null;
         oTask.CompletedOn  = null;
         oTask.DoneBy       = "";
         oDB.SaveChanges();
         return("1");
     }
     catch
     {
         return("Error Processing Request");
     }
 }//
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Request["ID"].IsNull())
            {
                string sTaskID = Request["ID"].Trim();
                oTask = oDB.OptimizationTasks.Where(x => x.TaskID == sTaskID).FirstOrDefault();

                if (oTask != null)
                {
                    if (oTask.TaskStaus == "completed" || oTask.TaskStaus == "failed")
                    {
                        Response.Redirect("~/" + oTask.TaskType + "/ResultView.aspx?id=" + oTask.TaskID);
                    }
                }
                else
                {
                    Response.Redirect("~/ListTasks.aspx");
                }
            }
            else
            {
                Response.Redirect("~/ListTasks.aspx");
            }
        }