private void btnAceptar_Click(object sender, EventArgs e) { try { validarEntidad(); MateriaService s = new MateriaService(); if (this.materia.Id != 0) { s.Update(materia); } else { s.Insert(materia); } CommonHelper.ShowInfo("Materia guardada con éxito."); this.DialogResult = DialogResult.OK; } catch (WarningException ex) { CommonHelper.ShowWarning(ex.Message); } catch (Exception ex) { CommonHelper.ShowError(ex.Message); } }