private void btnSave_Click_1(object sender, EventArgs e) { if (!model.IsValid()) { errorProvider1.DataSource = bindingSource1; MessageBox.Show(Translations.ValidationError, Translations.ValidationErrorTitle); return; } bindingSource1.EndEdit(); SettingsRepository s = new SettingsRepository(); RepositoryBase r = new RepositoryBase(); int userid = ApplicationData.Instance.GetUserId(); if(model.EntityType != IndicatorEntityType.Export) if (model.EntityType == IndicatorEntityType.EcologicalZone) s.SaveEz(model, userid); if (model.EntityType == IndicatorEntityType.EvalSubDistrict) s.SaveEvalSubDistrict(model, userid); else if (model.EntityType == IndicatorEntityType.EvaluationUnit) s.SaveEu(model, userid); else if (model.EntityType == IndicatorEntityType.EvalSite) s.SaveEvalSite(model, userid); else r.Save(model, userid); OnSave(model); this.Close(); }