Exemple #1
0
 public void PreencheCampos()
 {
     Models.tb_contatos curContact = contacts[curId];
     txtName.Text  = curContact.nmContato;
     txtTel1.Text  = curContact.nr_telPrinc;
     txtTel2.Text  = curContact.nr_telSec;
     txtEmail.Text = curContact.email;
     txtNote.Text  = curContact.notes;
 }
Exemple #2
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            Models.tb_contatos curCnt = contacts[curId];
            curCnt.nmContato   = txtName.Text;
            curCnt.nr_telPrinc = txtTel1.Text;
            curCnt.nr_telSec   = txtTel2.Text;
            curCnt.email       = txtEmail.Text;
            curCnt.notes       = txtNote.Text;

            contextContacts.SaveChanges();
        }
Exemple #3
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            Models.tb_contatos newCnt = new Models.tb_contatos();
            newCnt.nmContato   = txtName.Text;
            newCnt.nr_telPrinc = txtTel1.Text;
            newCnt.nr_telSec   = txtTel2.Text;
            newCnt.email       = txtEmail.Text;
            newCnt.notes       = txtNote.Text;

            contacts.Add(newCnt);
            contextContacts.tb_contatos.Add(newCnt);
            contextContacts.SaveChanges();
            MessageBox.Show("Contato salvo com sucesso!");
            ExibirContatos();
            PreencheCampos();
        }
Exemple #4
0
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     if (!val.checkEmpty(this))
     {
         return;
     }
     Models.tb_contatos curCnt = contacts[curId];
     curCnt.nmContato   = txtName.Text;
     curCnt.nr_telPrinc = txtTel1.Text;
     curCnt.nr_telSec   = txtTel2.Text;
     curCnt.email       = txtEmail.Text;
     curCnt.notes       = txtNote.Text;
     contextContacts.tb_contatos.Remove(curCnt);
     contextContacts.SaveChanges();
     curId = 0;
     ExibirContatos();
     PreencheCampos();
 }