コード例 #1
0
 private void btnExcluir_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Tem certeza que deseja excluir?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (Convert.ToInt32(lblid.Text) != -1)
         {
             Camadas.Model.agendamento agenda    = new Camadas.Model.agendamento();
             Camadas.BLL.agendamento   bllAgenda = new Camadas.BLL.agendamento();
             agenda.idAgendamento = Convert.ToInt32(lblid.Text);
             agenda.cliente       = textCliente.Text;
             agenda.data          = maskData.Text;
             bllAgenda.Delete(agenda);
             dgvAgendamento.DataSource = (from p in bllAgenda.Select()
                                          select new
             {
                 Agenda = p.idAgendamento,
                 Cliente = p.cliente,
                 Data = p.data
             }).ToList();
         }
         else
         {
             MessageBox.Show("Não há nenhum cadastro para ser excluído!", "Confirmação", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
     }
     LimpaCampos();
 }
コード例 #2
0
 private void btnPesquisar_Click(object sender, EventArgs e)
 {
     Camadas.BLL.agendamento bllAgenda = new Camadas.BLL.agendamento();
     dgvAgendamento.DataSource = (from p in bllAgenda.Select()
                                  select new
     {
         Agenda = p.idAgendamento,
         Cliente = p.cliente,
         Data = p.data
     }).ToList();
     btnGravar.Enabled = true;
 }