public ActionResult Create(TaskModel tm) { TaskClient TC = new TaskClient(); TC.Create(tm); return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { TaskClient TC = new TaskClient(); TC.Delete(id); return(RedirectToAction("Index")); }
public void DeleteById(int id) { TaskClient deptDelete = _dbContext.TaskClients.Find(id); _dbContext.Entry(deptDelete).State = EntityState.Deleted; _dbContext.SaveChanges(); }
private void addTaskButton_Click(object sender, EventArgs e) { LOGGER.Info($"User wants to add a new task"); AddOrUpdateTaskForm form = new AddOrUpdateTaskForm(null); if (form.ShowDialog(this) == DialogResult.OK) { Task created = TaskClient.CreateTask(Accounts[accountsListView.SelectedIndices[0]].id, form.Task); RefreshTasks(); if (FoundTasks.Any(t => t.id == created.id)) { LOGGER.Info($"Selecting the newly created task"); tasksListView.SelectedIndices.Clear(); tasksListView.SelectedIndices.Add(FoundTasks.IndexOf(FoundTasks.First(t => t.id == created.id))); } else { MessageBox.Show(this, "Task angelegt", "Der Task wurde erfolgreich angelegt."); } } }
public TaskDetails(Task currentTask) { InitializeComponent(); CurrentPage = this.Title; DataContext = this; _taskClient = new TaskClient(); CurrentTask = currentTask; try { List <TaskEstimate> dailyEstimateList = _taskClient.GetTaskEstimates( CurrentTask.UserStory.Project.Id, CurrentTask.UserStory.Id, CurrentTask.Id); dailyEstimateList.Sort((x, y) => DateTime.Compare(y.Date, x.Date)); DailyEstimates = new ObservableCollection <TaskEstimate>(dailyEstimateList); } catch (RestResponseErrorException ex) { MessageBoxUtil.ShowErrorBox(ex.Message); } }
public SprintDashboard(Sprint sprint, bool fromFile) { InitializeComponent(); CurrentPage = this.Title; this._fromFile = fromFile; DataContext = this; _sprintClient = new SprintClient(); _taskClient = new TaskClient(); User user = (User)Application.Current.Properties["user"]; Permissions = new Permissions(user, sprint.Project); IsSprintScrumMaster = sprint.ScrumMaster.Id == user.Id; sprint.Users = _sprintClient.GetSprintTeam(sprint.Project.Id, sprint.Id); UserStories = _sprintClient.GetSprintStories(sprint.Project.Id, sprint.Id); CurrentSprint = sprint; _sprintBacklog = _sprintClient.GetSprintBacklog(sprint.Project.Id, sprint.Id); PlotGraph(); }
public ActionResult Edit(TaskViewModel tvm) { TaskClient TC = new TaskClient(); TC.Edit(tvm.Task); return(RedirectToAction("Index")); }
public PlanHelper(Uri baseUri, VssCredentials vssCredentials, Guid projectId, string planType, Guid planId) { this.projectId = projectId; this.planType = planType; this.planId = planId; this.taskClient = new TaskClient(baseUri, vssCredentials); }
void FileDownload() { string strServer = Request.Form["tip"]; if (strServer == null || (strServer = strServer.Trim()) == string.Empty) { strServer = "127.0.0.1"; } string downfile = Request.Form["dir"]; if (string.IsNullOrEmpty(downfile)) { Response.Write("错误:未提交参数"); return; } string filepath; string result = TaskClient.FileDownload(strServer, 23244, downfile, out filepath); if (string.IsNullOrEmpty(result) || result != "ok") { Response.Write(result ?? "出错了"); return; } Response.Write("ok" + filepath); }
void DirRename(bool isdir) { string strServer = Request.Form["tip"]; if (strServer == null || (strServer = strServer.Trim()) == string.Empty) { strServer = "127.0.0.1"; } string maindir = Request.Form["dir"];// ?? @"E:\WebLogs"; if (string.IsNullOrEmpty(maindir)) { Response.Write("错误:未提交参数"); return; } string newname = Request.Form["newname"]; if (string.IsNullOrEmpty(newname)) { Response.Write("错误:未提交参数2"); return; } string result; if (isdir) { result = TaskClient.DirRename(strServer, 23244, maindir, newname); } else { result = TaskClient.FileRename(strServer, 23244, maindir, newname); } Response.Write(result); }
public async Task ItDoesNotDelayScheduledTaskPromotionWhenRunningLongTasks() { var waitTime = 4000; var taskQueue = TaskQueueTestFixture.UniqueRedisTaskQueue(); var taskClient = new TaskClient(taskQueue); var semaphoreFile = Path.GetTempFileName(); File.Delete(semaphoreFile); File.Exists(semaphoreFile).Should().BeFalse(); await taskClient.TaskQueue.Enqueue(() => Wait(waitTime)); await taskClient.TaskScheduler.AddScheduledTask( () => TaskQueueTestFixture.WriteSemaphore(semaphoreFile), TimeSpan.FromMilliseconds(waitTime / 4)); var task = Task.Run(async() => await taskClient.Listen()); await Task.Delay(waitTime / 2); // Ensure we did not run the scheduled task File.Exists(semaphoreFile).Should().BeFalse(); var dequeuedScheduledTask = await taskQueue.Dequeue(); File.Exists(semaphoreFile).Should().BeFalse(); dequeuedScheduledTask.Should().NotBeNull(); dequeuedScheduledTask.MethodName.Should().Be(nameof(TaskQueueTestFixture.WriteSemaphore)); taskClient.CancelListen(); await task; }
void GetProcess() { string server = Request.Form["tip"]; string str = TaskClient.GetProcess(server, 23244); Response.Write(str);// + "<hr/>" +Request.Form); }
// GET: TaskModel public ActionResult Index() { TaskClient TC = new TaskClient(); ViewBag.listTasks = TC.FindAll(); return(View()); }
void ReadTasks() { string strServer = Request.Form["tip"]; if (strServer == null || (strServer = strServer.Trim()) == string.Empty) { strServer = "127.0.0.1"; } string[] tip = strServer.Split(new[] { ',', ';', ' ', '|' }, StringSplitOptions.RemoveEmptyEntries); var all = new List <TaskManage>(tip.Length); var err = new StringBuilder(); foreach (string ip in tip) { string msg; TaskManage tasks = TaskClient.GetAllTask(ip, 23244, out msg); if (tasks != null) { all.Add(tasks); //Response.Write(msg); //return; } else { err.AppendFormat("{0}<br/>\r\n", msg); } } OutPutTasks(all, err.ToString()); }
void ShowTaskLog() { var server = Request.Form["server"]; var exepath = Request.Form["exepath"]; string msgother = TaskClient.DoTaskOther(server, 23244, OperationType.TaskLog, exepath); if (msgother.StartsWith("err", StringComparison.OrdinalIgnoreCase)) { msgother = (msgother.Substring(3)); Response.Write(msgother); return; } var logs = Common.XmlDeserializeFromStr <List <TaskLog> >(msgother); if (logs == null || logs.Count <= 0) { Response.Write(exepath + " 还没有运行日志"); return; } var ret = new StringBuilder("<span style='color:red;font-weight:bold;'>" + exepath + " 运行日志:</span><br/>"); foreach (var log in logs) { ret.AppendFormat("{0} {1}<br/>", log.instime.ToString("yyyy-MM-dd HH:mm:ss"), log.log); } Response.Write(ret.ToString()); }
public ActionResult Edit(int id) { TaskClient TC = new TaskClient(); TaskViewModel tvm = new TaskViewModel(); tvm.Task = TC.FindTask(id); return(View("Edit", tvm)); }
public static bool RefreshCache() { using (var client = new TaskClient()) { var result = client.RefreshTaskCache(Guid.Empty); return(result.Success && result.Result); } }
public async Task <TaskResult> ExecuteAsync(TaskMessage taskMessage, TaskLogger taskLogger, CancellationToken cancellationToken) { string message = String.Empty; MyAppParameters myAppParameters; try { myAppParameters = JsonConvert.DeserializeObject <MyAppParameters>(taskMessage.GetTaskMessageBody()); if (String.IsNullOrWhiteSpace(myAppParameters.AgentName) || String.IsNullOrWhiteSpace(myAppParameters.AgentPoolName) || String.IsNullOrWhiteSpace(myAppParameters.AzureSubscriptionClientId) || String.IsNullOrWhiteSpace(myAppParameters.AzureSubscriptionClientSecret) || String.IsNullOrWhiteSpace(myAppParameters.TenantId) || String.IsNullOrWhiteSpace(myAppParameters.ResourceGroupName) || String.IsNullOrWhiteSpace(myAppParameters.PATToken)) { message = $"Please provide valid values for 'TenantId', 'AzureSubscriptionClientId', 'AzureSubscriptionClientSecret', 'ResourceGroupName', 'AgentPoolName','AgentName' and 'PATToken' in task body."; await taskLogger.Log(message).ConfigureAwait(false); return(await Task.FromResult(TaskResult.Failed)); } } catch (Exception ex) { message = $"Task body deseralization failed: {ex}"; await taskLogger.Log(message).ConfigureAwait(false); return(await Task.FromResult(TaskResult.Failed)); } try { // Creates the container in Azure await MyApp.CreateContainer(taskLogger, myAppParameters); using (var taskClient = new TaskClient(taskMessage.GetTaskProperties())) { // set variable var variableName = "ContainerName"; await taskClient.SetTaskVariable(taskId : taskMessage.GetTaskProperties().TaskInstanceId, name : variableName, value : "AzPipelineAgent", isSecret : false, cancellationToken : cancellationToken); // get variable var variableValue = taskClient.GetTaskVariable(taskId: taskMessage.GetTaskProperties().TaskInstanceId, name: variableName, cancellationToken: cancellationToken); message = $"Variable name: {variableName} value: {variableValue}"; await taskLogger.Log(message).ConfigureAwait(false); } return(await Task.FromResult(TaskResult.Succeeded)); } catch (Exception ex) { message = $"MyFunction execution failed: {ex}"; await taskLogger.Log(message).ConfigureAwait(false); return(await Task.FromResult(TaskResult.Failed)); } }
public WorkflowTaskCoordinator(ILogger logger, TaskClient client, Worker[] workers, int threadCount, int sleepWhenRetry, int updateRetryCount) { m_logger = logger; this.workers = workers; this.m_threadCount = threadCount; m_sleepWhenRetry = sleepWhenRetry; m_updateRetryCount = updateRetryCount; this.client = client; }
public async Task Cancel(CancellationToken cancellationToken) { taskLogger.Log("Canceling task ..."); using (var taskClient = new TaskClient(taskProperties)) { taskLogger = new TaskLogger(taskProperties, taskClient); this.taskExecutionHandler.CancelAsync(taskMessage, taskLogger, cancellationToken); await taskClient.ReportTaskCompleted(taskProperties.TaskInstanceId, TaskResult.Canceled, cancellationToken).ConfigureAwait(false); } }
public JsonResult RefreshTaskCache() { using (var client = new TaskClient()) { var result = client.RefreshTaskCache(Guid.Empty); if (result.Success && result.Result) { return(Json(new { Code = 1 })); } return(Json(new { Code = 0 })); } }
public static async Task Main(string[] args) { var redisConnectionString = "127.0.0.1:6379"; // Create a Task Client connected to Redis var taskClient = new TaskClient(TaskQueue.Redis(redisConnectionString)); Console.WriteLine("Listening for Jobs..."); // Endlessly listen for jobs await taskClient.Listen(); }
public async System.Threading.Tasks.Task <ActionResult> Edit(int id) { new ProjectClient(); new TaskClient(); var task = await TaskClient.GetTaskAsync(id); var project = await ProjectClient.GetProjectAsync(task.ProjectID); ViewBag.project = project; return(View(task)); }
public ApiWrapper(string apiUri, ILogger logger, CancellationToken ct) { _taskClient = new TaskClient(HttpClient) { BaseUrl = apiUri }; _statusClient = new StatusClient(HttpClient) { BaseUrl = apiUri }; _logger = logger; _cancellationToken = ct; }
public async System.Threading.Tasks.Task <ActionResult> DeleteConfirmed(int id) { new TaskClient(); try { await TaskClient.DeleteTaskAsync(id); return(RedirectToAction("Index")); } catch (Exception) { return(RedirectToAction("Error")); } }
public async Task <TaskResult> Execute(CancellationToken cancellationToken) { using (var taskClient = new TaskClient(taskProperties)) { var taskResult = TaskResult.Failed; try { // create timelinerecord if not provided await CreateTaskTimelineRecordIfRequired(taskClient, cancellationToken).ConfigureAwait(false); taskLogger = new TaskLogger(taskProperties, taskClient); // report task started await taskLogger.Log("Task started").ConfigureAwait(false); await taskClient.ReportTaskStarted(taskProperties.TaskInstanceId, cancellationToken).ConfigureAwait(false); await taskClient.ReportTaskProgress(taskProperties.TaskInstanceId, cancellationToken).ConfigureAwait(false); // start client handler execute var executeTask = taskExecutionHandler.ExecuteAsync(taskMessage, taskLogger, cancellationToken).ConfigureAwait(false); taskResult = await executeTask; // report task completed with status await taskLogger.Log("Task completed").ConfigureAwait(false); await taskClient.ReportTaskCompleted(taskProperties.TaskInstanceId, taskResult, cancellationToken).ConfigureAwait(false); return(taskResult); } catch (Exception e) { if (taskLogger != null) { await taskLogger.Log(e.ToString()).ConfigureAwait(false); } await taskClient.ReportTaskCompleted(taskProperties.TaskInstanceId, taskResult, cancellationToken).ConfigureAwait(false); throw; } finally { if (taskLogger != null) { await taskLogger.End().ConfigureAwait(false); } } } }
public async System.Threading.Tasks.Task <ActionResult> Index(int projectId) { new ProjectClient(); new TaskClient(); var tasks = await TaskClient.GetTasksAsync(projectId); var project = await ProjectClient.GetProjectAsync(projectId); ViewBag.tasks = tasks; ViewBag.projectId = projectId; ViewBag.project = project; return(View(tasks)); }
public void SetUp() { try { tcpClient = new TcpClient("localhost", Constants.DefaultTaskServerPort); } catch (Exception ex) { Assert.Ignore("Could not connect to distribution server: {0}.", ex); } tcpClient.SendTimeout = 5000; tcpClient.ReceiveTimeout = 5000; stream = tcpClient.GetStream(); taskClient = new TaskClient(stream); }
static void Main(string[] args) { var consoleLogger = new ConsoleLogger("test", Filter, false); var taskClient = new TaskClient(new Uri("http://localhost:8080/api/")); int threadCount = 2; var builder = new WorkflowTaskCoordinator.Builder(consoleLogger); var coordinator = builder.WithWorkers(GetWorkers(consoleLogger).ToArray()).WithThreadCount(threadCount).WithTaskClient(taskClient).Build(); //Start for polling and execution of the tasks coordinator.Init(); Console.ReadLine(); }
void DeleteById() { int id; if (!int.TryParse(Request.Form["id"], out id)) { Response.Write("请输入id"); return; } string msg = TaskClient.DelTaskById(Request.Form["server"], 23244, id); if (string.IsNullOrEmpty(msg)) { msg = "删除成功"; } Response.Write(msg); }
internal override void Run() { progress = 0; if (Video.PlaylistServiceSettings.ShouldSend && !string.IsNullOrWhiteSpace(Video.PlaylistServiceSettings.Host) && !string.IsNullOrWhiteSpace(Video.PlaylistServiceSettings.Port)) { var taskClient = new TaskClient(new Uri($"http://{Video.PlaylistServiceSettings.Host}:{Video.PlaylistServiceSettings.Port}"), Video.PlaylistServiceSettings.Username, Video.PlaylistServiceSettings.Password); if (Video.PlaylistServiceSettings.TaskId == null || !Video.PlaylistServiceSettings.TaskId.HasValue) { Task task = taskClient.CreateTask(Video.PlaylistServiceSettings.AccountId, new Task() { addAt = (Video.Privacy == PrivacyStatus.Private && Video.PublishAt.HasValue) ? Video.PublishAt.Value : DateTime.Now.AddMinutes(5), playlistId = Video.PlaylistServiceSettings.PlaylistId, playlistTitle = Video.PlaylistServiceSettings.PlaylistTitle, videoId = Video.Id, videoTitle = Video.Title }); Video.PlaylistServiceSettings.TaskId = task.id; } else { Task task = taskClient.UpdateTask(Video.PlaylistServiceSettings.AccountId, new Task() { id = Video.PlaylistServiceSettings.TaskId.Value, addAt = (Video.Privacy == PrivacyStatus.Private && Video.PublishAt.HasValue) ? Video.PublishAt.Value : DateTime.Now.AddMinutes(5), playlistId = Video.PlaylistServiceSettings.PlaylistId, playlistTitle = Video.PlaylistServiceSettings.PlaylistTitle, videoId = Video.Id, videoTitle = Video.Title }); Video.PlaylistServiceSettings.TaskId = task.id; } } FinishedSuccessful = true; progress = 100; OnStepFinished(); }