private void FillComboBoxes() { var outgoingData = new List <(string field, string table, string comboBox)>(); var comboboxStatusData = (field : "name_of_status", table : "customer_statuses", comboBox : "comboBoxStatus"); var comboboxChannelData = (field : "name_of_channel", table : "order_channels", comboBox : "comboBoxChannel"); var comboboxEmployeeData = (field : "Login", table : "employees", comboBox : "comboBoxEmployee"); outgoingData.Add(comboboxChannelData); outgoingData.Add(comboboxEmployeeData); outgoingData.Add(comboboxStatusData); var receivedData = FormLoader.FillComboBoxes(outgoingData, connection); foreach (var data in receivedData) { var combobox = (ComboBox)FindName(data.Key); combobox.ItemsSource = data.Value; } }
private void FillComboBoxes() { var outgoingData = new List <(string field, string table, string comboBox)>(); var comboboxUnitData = (field : "Name_Of_Unit", table : "units", comboBox : "comboBoxUnit"); var comboboxGroupData = (field : "Name_Of_Group", table : "groups_of_material", comboBox : "comboBoxGroup"); var comboboxTypeData = (field : "Name_Of_Type", table : "types_of_material", comboBox : "comboBoxType"); var comboboxCountryData = (field : "Name_Of_Country", table : "countries", comboBox : "comboBoxCountry"); outgoingData.Add(comboboxUnitData); outgoingData.Add(comboboxGroupData); outgoingData.Add(comboboxTypeData); outgoingData.Add(comboboxCountryData); var receivedData = FormLoader.FillComboBoxes(outgoingData, connection); foreach (var data in receivedData) { var combobox = (System.Windows.Controls.ComboBox)FindName(data.Key); combobox.ItemsSource = data.Value; } connection.Close(); }
private void FillComboBoxes() { var outgoingData = new List <(string field, string table, string comboBox)>(); var comboboxTypeData = (field : "name_of_type", table : "types_of_order", comboBox : "comboBoxTypeOfOrder"); var comboboxStatusData = (field : "name_of_status", table : "statuses_of_order", comboBox : "comboBoxStatusOfOrder"); var comboboxCustomerData = (field : "nickname", table : "customers", comboBox : "comboBoxCustomer"); // Сделал плохо, надо без второго запроса var comboboxExecutorData = (field : "login", table : "employees", comboBox : "comboBoxExecutor"); var comboboxResponsibleData = (field : "login", table : "employees", comboBox : "comboBoxResponsible"); outgoingData.Add(comboboxTypeData); outgoingData.Add(comboboxStatusData); outgoingData.Add(comboboxCustomerData); outgoingData.Add(comboboxExecutorData); outgoingData.Add(comboboxResponsibleData); var receivedData = FormLoader.FillComboBoxes(outgoingData, connection); foreach (var data in receivedData) { var combobox = (ComboBox)FindName(data.Key); combobox.ItemsSource = data.Value; } }