public override bool Excluir() { bool bExcluir = false; if (nCodGenerico == 1) { MessageBox.Show("Não é possível excluir cadastros do sistema.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); return(bExcluir); } ClienteTableAdapter ta = new ClienteTableAdapter(); bExcluir = (ta.Delete(nCodGenerico) > 0); return(bExcluir); }
/* public int Alterar(modelo.Cliente c) * { * int rc = 0; * try * { * ta.Update(c.Nome, c.Telefone, c.Endereco, c.Codigo); * } * catch (System.Data.SqlClient.SqlException ex) * { * rc = 1; * Console.WriteLine(ex.Message); * } * return rc; * }*/ public int Excluir(modelo.Cliente c) { int rc = 0; try { ta.Delete(c.Codigo, c.Telefone); } catch (System.Data.SqlClient.SqlException ex) { rc = 1; Console.WriteLine(ex.Message); } return(rc); }