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();
        }
Пример #2
0
 private List<IndicatorDropdownValue> GetValues(IndicatorEntityType indType, int indId)
 {
     RepositoryBase repo = new RepositoryBase();
     OleDbConnection connection = new OleDbConnection(DatabaseData.Instance.AccessConnectionString);
     using (connection)
     {
         connection.Open();
         OleDbCommand command = new OleDbCommand();
         return repo.GetIndicatorDropdownValues(connection, command, indType, new List<string> { indId.ToString() });
     }
 }