// Land Combobox füllen private void FillCountryCombobox() { var res = _mainLogic.SelectData(DbType.MySql, "SELECT * FROM fisch_fauna.bio_country"); for (int i = 0; i < res.Count; i++) { int id = i; string text = res[i].First(p => p.Key == "countryname").Value as string; string valueString = res[i].First(p => p.Key == "countryid").Value as string; ComboBoxItem newItem = new ComboBoxItem(id, text, false) { ValueString = valueString }; countryComboBox.Items.Add(newItem); } countryComboBox.DisplayMember = "text"; if (countryComboBox.Items.Count > 0) { countryComboBox.SelectedIndex = 0; } }
// Quellart Combobox füllen private void FillSourceTypeCombobox() { var res = _mainLogic.SelectData(DbType.MySql, "SELECT * FROM fisch_fauna.bio_sourcetype"); foreach (var item in res) { int id = int.Parse(item.First(p => p.Key == "sourcetypeid").Value.ToString()); string value = item.First(p => p.Key == "sourcename").Value as string; ComboBoxItem newItem = new ComboBoxItem(id, value, false); sourceTypeComboBox.Items.Add(newItem); } sourceTypeComboBox.DisplayMember = "text"; if (sourceTypeComboBox.Items.Count > 0) { sourceTypeComboBox.SelectedIndex = 0; } }
// Import-Benutzer Combobox füllen private void FillImportUsersCombobox() { var res = _mainLogic.SelectData(DbType.MySql, "select * from bio_editor"); foreach (var item in res) { int id = int.Parse(item.First(p => p.Key == "editorid").Value.ToString()); string value = item.First(p => p.Key == "editorname").Value as string; ComboBoxItem newItem = new ComboBoxItem(id, value, false); editorCombobox.Items.Add(newItem); } editorCombobox.DisplayMember = "text"; if (editorCombobox.Items.Count > 0) { editorCombobox.SelectedIndex = 0; } }
// Eintrags-Qualität Combobox füllen private void FillRecordQualityCombobox() { var res = _mainLogic.SelectData(DbType.MySql, "SELECT * FROM fisch_fauna.bio_record_quality"); foreach (var item in res) { int id = int.Parse(item.First(p => p.Key == "recordqualityid").Value.ToString()); string value = item.First(p => p.Key == "recordquality").Value as string; ComboBoxItem newItem = new ComboBoxItem(id, value, false); recordQualityComboBox.Items.Add(newItem); } recordQualityComboBox.DisplayMember = "text"; if (recordQualityComboBox.Items.Count > 0) { recordQualityComboBox.SelectedIndex = 0; } }
// Import Combobox füllen private void FillImportsCombobox() { var res = _mainLogic.SelectData(DbType.Postgres, "select * from public.imports", _sourceCon); foreach (var item in res) { int id = int.Parse(item.First(p => p.Key == "id").Value.ToString()); bool imported = (bool)item.First(p => p.Key == "imported").Value; string fileName = (imported ? "[BEREITS IMPORTIERT]" : string.Empty) + item.First(p => p.Key == "filename").Value; ComboBoxItem newItem = new ComboBoxItem(id, fileName, !imported); importsCbx.Items.Add(newItem); } importsCbx.DisplayMember = "text"; importsCbx.SelectedIndexChanged += importsCbx_SelectedIndexChanged; if (importsCbx.Items.Count > 0) { importsCbx.SelectedIndex = 0; } }