public IssueExecution ObterTarefaEmAndamento(int idTarefa) { using (IssueContext db = new IssueContext()) { IssueExecution issue = db.IssueExecutions.Where(c => c.Issue.Id == idTarefa && c.EndDate == null).ToList().FirstOrDefault(); return(issue); } }
public void AtualizarTarefa(IssueExecution newIssue) { using (IssueContext db = new IssueContext()) { IssueExecution oldIssue = db.IssueExecutions.Where(c => c.Id == newIssue.Id).ToList().FirstOrDefault(); if (oldIssue != null) { oldIssue.EndDateTime = newIssue.EndDateTime; db.SaveChanges(); } } }
public void EncerrarAtendimentoTarefa(int idTarefa) { using (IssueContext db = new IssueContext()) { IssueExecution issue = db.IssueExecutions.Where(c => c.Id == idTarefa && c.EndDate == null).ToList().FirstOrDefault(); if (issue != null) { DateTime terminateExecution = DateTime.Now; issue.EndDateTime = terminateExecution; db.SaveChanges(); } } }
private void button3_Click(object sender, EventArgs e) { int id = (int)this.comboBox1.SelectedValue; if (id > 0) { TaskManagementRepository repositorio = new TaskManagementRepository(); IssueExecution tarefaEmAndamento = repositorio.ObterTarefaEmAndamento(id); if (tarefaEmAndamento != null) { MessageBox.Show("Esta tarefa já está em andamento"); return; } repositorio.IniciarAtendimentoTarefa(id); var listaTarefasEmExecucacao = repositorio.ObterTarefas(true); this.dataGridView1.DataSource = listaTarefasEmExecucacao.Select(c => new { c.Id, c.CodigoJira, c.StartTime, c.EndTime }).ToList(); } }
public void IniciarAtendimentoTarefa(int idTarefa) { try { using (IssueContext db = new IssueContext()) { Issue issue = db.Issues.Where(c => c.Id == idTarefa).ToList().FirstOrDefault(); IssueExecution newIssueExecution = new IssueExecution(); newIssueExecution.Issue = issue; newIssueExecution.StartDateTime = DateTime.Now; db.IssueExecutions.Add(newIssueExecution); db.SaveChanges(); } } catch (Exception ex) { throw ex; } }