public void InsertOrUpdate(int type) { Voo voo = new Voo(); try { if (radioButton1.Checked) { voo.CAPTURA = "N"; } else if (radioButton2.Checked) { voo.CAPTURA = "S"; } voo.CUSTO = Convert.ToInt32(txt_Custo.Text); voo.DATA_VOO = Convert.ToDateTime(dtp_Data.Text); voo.DISTANCIA = Convert.ToInt32(txt_Distancia.Text); voo.NIVEL_DOR = Convert.ToInt32(txt_NvDor.Text); if (!string.IsNullOrEmpty(IdGrid)) { voo.Id = IdGrid; } if (type == 1) { persist.Add(voo, conn); } else { persist.Update(voo, conn); IdGrid = ""; } } catch (Exception ex) { throw ex; } }