private void btnSalvar_Click(object sender, EventArgs e) { TarefaDAO tarefaDao = new TarefaDAO(); if (this.tarefa == null) { Tarefa tarefa = new Tarefa { titulo = txbTitulo.Text, descricao = txbDescricao.Text, tempo = Convert.ToInt32(txbTempo.Text), status = ckbStatus.Checked }; tarefaDao.Inserir(tarefa); } else { this.tarefa.titulo = txbTitulo.Text; this.tarefa.descricao = txbDescricao.Text; this.tarefa.tempo = Convert.ToInt32(txbTempo.Text); this.tarefa.status = ckbStatus.Checked; tarefaDao.Atualizar(this.tarefa); } this.Close(); }