예제 #1
0
 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);
     }
 }
예제 #2
0
 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();
         }
     }
 }
예제 #3
0
 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();
         }
     }
 }
예제 #4
0
        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();
            }
        }
예제 #5
0
        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;
            }
        }