public void ErrorEmail(int taskId, string error) { var activeImagingTaskServices = new ActiveImagingTaskServices(); var task = activeImagingTaskServices.GetTask(taskId); activeImagingTaskServices.SendTaskErrorEmail(task, error); }
public void UpdateProgress(int taskId, string progress, string progressType) { var activeImagingTaskServices = new ActiveImagingTaskServices(); if (string.IsNullOrEmpty(progress)) { return; } var task = activeImagingTaskServices.GetTask(taskId); if (progressType == "wim") { task.Elapsed = progress; task.Remaining = ""; task.Completed = ""; task.Rate = ""; } else { var values = progress.Split('*').ToList(); task.Elapsed = values[1]; task.Remaining = values[2]; task.Completed = values[3]; task.Rate = values[4]; } activeImagingTaskServices.UpdateActiveImagingTask(task); }
public void UpdateProgressPartition(int taskId, string partition) { var activeImagingTaskServices = new ActiveImagingTaskServices(); var task = activeImagingTaskServices.GetTask(taskId); task.Partition = partition; task.Elapsed = "Please Wait..."; task.Remaining = ""; task.Completed = ""; task.Rate = ""; activeImagingTaskServices.UpdateActiveImagingTask(task); }
public void PermanentTaskCheckOut(int taskId) { var activeImagingTaskServices = new ActiveImagingTaskServices(); var task = activeImagingTaskServices.GetTask(taskId); task.Status = "0"; task.Partition = ""; task.Completed = ""; task.Elapsed = ""; task.Rate = ""; task.Remaining = ""; activeImagingTaskServices.UpdateActiveImagingTask(task); activeImagingTaskServices.SendTaskCompletedEmail(task); }
public void CheckOut(int taskId, int profileId) { var activeImagingTaskServices = new ActiveImagingTaskServices(); var task = activeImagingTaskServices.GetTask(taskId); if (task.Type.Contains("upload")) { } if (task.Type.Contains("unreg")) { activeImagingTaskServices.DeleteUnregisteredOndTask(task.Id); } else { activeImagingTaskServices.DeleteActiveImagingTask(task.Id); } if (task.Type != "multicast" && task.Type != "ondmulticast") { activeImagingTaskServices.SendTaskCompletedEmail(task); } }
public string CheckQueue(int taskId) { var queueStatus = new QueueStatus(); var activeImagingTaskServices = new ActiveImagingTaskServices(); var thisComputerTask = activeImagingTaskServices.GetTask(taskId); //var computer = new ComputerServices().GetComputer(thisComputerTask.ComputerId); //Check if already part of the queue if (thisComputerTask.Status == "2") { //Delete Any tasks that have passed the timeout value activeImagingTaskServices.CancelTimedOutTasks(); //Check if the queue is open yet var inUse = activeImagingTaskServices.GetCurrentQueue(thisComputerTask); var totalCapacity = 0; var dp = new DistributionPointServices().GetDistributionPoint(thisComputerTask.DpId); totalCapacity = dp.QueueSize; if (inUse < totalCapacity) { //queue is open, is this computer next var firstTaskInQueue = activeImagingTaskServices.GetNextComputerInQueue(thisComputerTask); if (firstTaskInQueue.ComputerId == thisComputerTask.ComputerId) { ChangeStatusInProgress(taskId); queueStatus.Result = "true"; queueStatus.Position = "0"; return(JsonConvert.SerializeObject(queueStatus)); } //not time for this computer yet queueStatus.Result = "false"; queueStatus.Position = activeImagingTaskServices.GetQueuePosition(thisComputerTask); return(JsonConvert.SerializeObject(queueStatus)); } //queue not open yet queueStatus.Result = "false"; queueStatus.Position = activeImagingTaskServices.GetQueuePosition(thisComputerTask); return(JsonConvert.SerializeObject(queueStatus)); } else { //New computer checking queue for the first time var inUse = activeImagingTaskServices.GetCurrentQueue(thisComputerTask); var totalCapacity = 0; var dp = new DistributionPointServices().GetDistributionPoint(thisComputerTask.DpId); totalCapacity = dp.QueueSize; if (inUse < totalCapacity) { ChangeStatusInProgress(taskId); queueStatus.Result = "true"; queueStatus.Position = "0"; return(JsonConvert.SerializeObject(queueStatus)); } //place into queue var lastQueuedTask = activeImagingTaskServices.GetLastQueuedTask(thisComputerTask); if (lastQueuedTask == null) { thisComputerTask.QueuePosition = 1; } else { thisComputerTask.QueuePosition = lastQueuedTask.QueuePosition + 1; } thisComputerTask.Status = "2"; activeImagingTaskServices.UpdateActiveImagingTask(thisComputerTask); queueStatus.Result = "false"; queueStatus.Position = activeImagingTaskServices.GetQueuePosition(thisComputerTask); return(JsonConvert.SerializeObject(queueStatus)); } }