private void btnExcluir_Click(object sender, EventArgs e) { if (txtId.Text.Trim().Length == 0) { MessageBox.Show("Você deve escolher um cliente para poder excluir!"); } else { if (MessageBox.Show("Deseja realmente excluir este cara??", "Excluir", MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes) { PrestadorDTO prestador = new PrestadorDTO(); prestador.Id_prestador = Convert.ToInt32(txtId.Text); new PrestadorBLL().ExcluirPrestador(prestador); dtgClientes.DataSource = new PrestadorBLL().ListarTodosPrestadores(); new LimpaForm(this); } } }
private void btnCadastrar_Click(object sender, EventArgs e) { try { PrestadorDTO prestadorDTO = new PrestadorDTO(); prestadorDTO.Nome_prestador = txtNome.Text; prestadorDTO.Sobrenome_prestador = txtSobrenome.Text; prestadorDTO.Email_prestador = txtEmail.Text; prestadorDTO.Senha_prestador = txtSenha.Text; prestadorDTO.Cpf_prestador = txtCPF.Text; if (chkVip.Checked == true) { prestadorDTO.Vip_prestador = 1; } else { prestadorDTO.Vip_prestador = 0; } prestadorDTO.Id_categoria = Convert.ToInt32(cmbCategoria.SelectedValue); if (txtId.Text == string.Empty) { new PrestadorBLL().InserirPrestador(prestadorDTO); } else { prestadorDTO.Id_prestador = Convert.ToInt32(txtId.Text); new PrestadorBLL().AlterarPrestador(prestadorDTO); } CarregarGridPrestadores(); new LimpaForm(this); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void AlterarPrestador(PrestadorDTO dto) { dao.Update("tbl_prestador", dto, 0); }
public void ExcluirPrestador(PrestadorDTO dto) { dao.Delete("tbl_prestador", dto, 0); }
public void InserirPrestador(PrestadorDTO dto) { dao.Insert("tbl_prestador", dto); }