Example #1
0
 private void btnGravar_Click(object sender, EventArgs e)
 {
     try
     {
         getData = new Employee()
         {
             Id      = _id,
             Name    = txtName.Text,
             Surname = txtSurname.Text,
             Address = txtAddress.Text
         };
         if (_id == 0)
         {
             getBussinessLayer = new BussinessLayer();
             getBussinessLayer.Save(getData);
             MessageBox.Show("Registro inserido com sucesso!");
         }
         else
         {
             getBussinessLayer = new BussinessLayer();
             getBussinessLayer.Update(getData);
             MessageBox.Show("Registro atualizado com sucesso!");
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message.ToString());
     }
     FillGrid();
 }