Exemple #1
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            int r;

            Contato objContato = new Contato();

            objContato.Nome     = txtNome.Text;
            objContato.Telefone = txtTelefone.Text;

            r = ContatoBLL.InserirContatoBLL(objContato);

            if (r != 0)
            {
                MessageBox.Show("Contato cadastrado com sucesso!");
            }
            else
            {
                MessageBox.Show("Houve erros ao salvar um contato!");
            }
        }
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (objContato == null)
            {
                objContato = new Contato();
            }

            objContato.Nome     = txtNome.Text;
            objContato.Telefone = txtTelefone.Text;

            if (objContato.Id == 0)
            {
                objContato.Id = ContatoBLL.InserirContatoBLL(objContato);
            }
            else
            {
                ContatoBLL.AtualizarContatoBLL(objContato);
            }

            DialogResult = DialogResult.OK;

            Close();
        }