public ActionResult FilterByTaskName(string taskName) { _schedulerManager.SetWPIntService(getCurrentService()); GetInfoResponse infoResponse = _schedulerManager.GetTaskList(); infoResponse.TasksInfos = TaskListSort.SortByName(infoResponse.TasksInfos); if (taskName != null && taskName != "") { List <TaskHandlerInfo> taskHandlerInfos = new List <TaskHandlerInfo>(); foreach (TaskHandlerInfo taskHandlerInfo in infoResponse.TasksInfos) { TaskHandlerInfo newTaskHandlerInfo = new TaskHandlerInfo(); newTaskHandlerInfo.Name = taskHandlerInfo.Name; newTaskHandlerInfo.NearTaskScheduledTime = taskHandlerInfo.NearTaskScheduledTime; newTaskHandlerInfo.Type = taskHandlerInfo.Type; foreach (TaskInfo taskInfo in taskHandlerInfo.TaskInfos) { if (taskInfo.Name.Contains(taskName)) { newTaskHandlerInfo.TaskInfos.Add(taskInfo); } } if (newTaskHandlerInfo.TaskInfos.Count > 0) { taskHandlerInfos.Add(newTaskHandlerInfo); } } infoResponse.TasksInfos = taskHandlerInfos; } return(PartialView("TableView", infoResponse)); }
public ActionResult Pause(SchedulerInfo taskData) { _schedulerManager.SetWPIntService(getCurrentService()); _schedulerManager.SuspendTask(taskData.TaskName, taskData.SchedulerName); GetInfoResponse infoResponse = _schedulerManager.GetTaskList(); infoResponse.TasksInfos = TaskListSort.SortByName(infoResponse.TasksInfos); return(PartialView("TableView", infoResponse)); }
private void SelectedSortChanged(TaskListSort newSortOrder) { // Don't sort anything until the view model is loaded. // Yes, this gets called before the constructor because of the magic of WPF if (_viewModelReady == false) { return; } _vmDataContext.SortTaskList(newSortOrder); }
/// <summary> /// Sorts the task order /// </summary> /// <param name="newSortOrder"></param> public void SortTaskList(TaskListSort newSortOrder) { // Update the current sort order as the user may change sort mode as its being loaded _currentSortOrder = newSortOrder; if (Tasks == null || Tasks.Count == 0) { return; } Tasks = new ObservableCollection <TaskListDisplayItem>(SortTasks(Tasks, newSortOrder)); }
public ActionResult Index() { ViewBag.Services = _wpIntServiceManager.GetServices().Keys.ToList(); _schedulerManager.SetWPIntService(getCurrentService()); ViewBag.CurrentService = _wpIntServiceManager.GetServiceName(_schedulerManager.GetWPIntService()); GetInfoResponse infoResponse = _schedulerManager.GetTaskList(); if (infoResponse == null) { return(View("Error")); } infoResponse.TasksInfos = TaskListSort.SortByName(infoResponse.TasksInfos); return(View("Index", infoResponse)); }
public ActionResult ChangeWPIntService(string name) { ViewBag.Services = _wpIntServiceManager.GetServices().Keys.ToList(); HttpContext.Response.Cookies["service"].Value = name; _schedulerManager.SetWPIntService(_wpIntServiceManager.GetService(name)); GetInfoResponse infoResponse = _schedulerManager.GetTaskList(); ViewBag.CurrentService = name; if (infoResponse == null) { return(View("Error")); } infoResponse.TasksInfos = TaskListSort.SortByName(infoResponse.TasksInfos); return(Redirect("/")); }
public ActionResult SortTaskList(string typeSort) { _schedulerManager.SetWPIntService(getCurrentService()); GetInfoResponse infoResponse = _schedulerManager.GetTaskList(); switch (typeSort) { case "byName": infoResponse.TasksInfos = TaskListSort.SortByName(infoResponse.TasksInfos); return(PartialView("TableView", infoResponse)); case "byTime": infoResponse.TasksInfos = TaskListSort.SortByTime(infoResponse.TasksInfos); return(PartialView("TableView", infoResponse)); default: return(PartialView("TableView", infoResponse)); } }
/// <summary> /// Called from a view model to set the default sort order on first load /// </summary> /// <param name="selectedSortOption"></param> internal void SetInitialSortOrder(TaskListSort selectedSortOption) { _currentSortOrder = selectedSortOption; }
private IEnumerable <TaskListDisplayItem> SortTasks(IEnumerable <TaskListDisplayItem> taskList, TaskListSort sortMode) { switch (sortMode) { default: case TaskListSort.CreatedAsc: return(taskList.OrderBy(x => x.CreatedUTC)); case TaskListSort.CreatedDesc: return(taskList.OrderByDescending(x => x.CreatedUTC)); case TaskListSort.UpdatedAsc: return(taskList.OrderBy(x => x.UpdatedUTC)); case TaskListSort.UpdatedDesc: return(taskList.OrderByDescending(x => x.UpdatedUTC)); } }