private void RefreshList() { MySqlConnection connection = new MySqlConnection(connectionString); //Думаю, что не очень хорошо, когда в списке пользователей виден пароль!!! /* employees.Password, */ string query_text = getQueryText(); connection.Open(); DataTable dataTable = new DataTable(); MySqlCommand command = new MySqlCommand(query_text, connection); MySqlDataAdapter adapter = new MySqlDataAdapter(command); adapter.Fill(dataTable); productsGrid.ItemsSource = dataTable.DefaultView; connection.Close(); productsGrid.SelectedIndex = 0; //Код алёши еблоши List <int> ids = new List <int>(); foreach (DataRowView row in productsGrid.SelectedItems) { ids.Add((int)row.Row.ItemArray[0]); } if (ids.Count == 0) { ButtonDelete.Style = (Style)ButtonDelete.FindResource("NoActive"); ButtonEdit.Style = (Style)ButtonEdit.FindResource("NoActive"); ButtonOpenList.Style = (Style)ButtonOpenList.FindResource("NoActive"); } }
private void RefreshList() { MySqlConnection connection = new MySqlConnection(connectionString); string query_text = getQueryText(); connection.Open(); DataTable dataTable = new DataTable(); MySqlCommand command = new MySqlCommand(query_text, connection); MySqlDataAdapter adapter = new MySqlDataAdapter(command); adapter.Fill(dataTable); productsGrid.ItemsSource = dataTable.DefaultView; connection.Close(); List <int> ids = new List <int>(); foreach (DataRowView row in productsGrid.SelectedItems) { ids.Add((int)row.Row.ItemArray[0]); } if (ids.Count == 0) { ButtonEdit.Style = (Style)ButtonEdit.FindResource("NoActive"); ButtonDelete.Style = (Style)ButtonDelete.FindResource("NoActive"); } }
private void RefreshList() { MySqlConnection connection = new MySqlConnection(connectionString); string query_text = getQueryText(); connection.Open(); DataTable dataTable = new DataTable(); MySqlCommand command = new MySqlCommand(query_text, connection); MySqlDataAdapter adapter = new MySqlDataAdapter(command); adapter.Fill(dataTable); fittingsGrid.ItemsSource = dataTable.DefaultView; connection.Close(); fittingsGrid.SelectedIndex = 0; List <HelpStruct> ids = new List <HelpStruct>(); foreach (DataRowView row in fittingsGrid.SelectedItems) { ids.Add(new HelpStruct { customerNickname = row.Row.ItemArray[0].ToString(), idOrder = int.Parse(row.Row.ItemArray[1].ToString()) }); } if (ids.Count == 0) { ButtonEdit.Style = (Style)ButtonEdit.FindResource("NoActive"); ButtonDelete.Style = (Style)ButtonDelete.FindResource("NoActive"); } }
private void DataGridCell_LostFocus(object sender, RoutedEventArgs e) { // Если ничего не выделено, то стиль заблокированной кнопки if (materialsGrid.SelectedItems.Count == 0) { ButtonEdit.Style = (Style)ButtonEdit.FindResource("NoActive"); ButtonDelete.Style = (Style)ButtonDelete.FindResource("NoActive"); } }
private void RefreshList() { var dataTable = Customer.getListCustomers(connection); customersGrid.ItemsSource = dataTable.DefaultView; // Если ничего не выделено, то стиль заблокированной кнопки if (customersGrid.SelectedItems.Count == 0) { ButtonEdit.Style = (Style)ButtonEdit.FindResource("NoActive"); ButtonDelete.Style = (Style)ButtonDelete.FindResource("NoActive"); } }
private void DataGridCell_LostFocus(object sender, RoutedEventArgs e) { List <int> ids = new List <int>(); foreach (DataRowView row in productsGrid.SelectedItems) { ids.Add((int)row.Row.ItemArray[0]); } if (ids.Count == 0) { ButtonEdit.Style = (Style)ButtonEdit.FindResource("NoActive"); ButtonDelete.Style = (Style)ButtonDelete.FindResource("NoActive"); } }
private void DataGridCell_LostFocus(object sender, RoutedEventArgs e) { List <HelpStruct> ids = new List <HelpStruct>(); foreach (DataRowView row in payrollsGrid.SelectedItems) { ids.Add(new HelpStruct { login = row.Row.ItemArray[0].ToString(), period = row.Row.ItemArray[1].ToString() }); } if (ids.Count == 0) { ButtonEdit.Style = (Style)ButtonEdit.FindResource("NoActive"); ButtonDelete.Style = (Style)ButtonDelete.FindResource("NoActive"); } }
private void DataGridCell_LostFocus(object sender, RoutedEventArgs e) { List <HelpStruct> ids = new List <HelpStruct>(); foreach (DataRowView row in fittingsGrid.SelectedItems) { ids.Add(new HelpStruct { customerNickname = row.Row.ItemArray[0].ToString(), idOrder = int.Parse(row.Row.ItemArray[1].ToString()) }); } if (ids.Count == 0) { ButtonEdit.Style = (Style)ButtonEdit.FindResource("NoActive"); ButtonDelete.Style = (Style)ButtonDelete.FindResource("NoActive"); } }
private void DataGridCell_GotFocus(object sender, RoutedEventArgs e) { ButtonDelete.Style = (Style)ButtonDelete.FindResource("Active"); ButtonEdit.Style = (Style)ButtonEdit.FindResource("Active"); ButtonOpenList.Style = (Style)ButtonOpenList.FindResource("Active"); }
private void DataGridCell_GotFocus(object sender, RoutedEventArgs e) { ButtonDelete.Style = (System.Windows.Style)ButtonDelete.FindResource("Active"); ButtonEdit.Style = (System.Windows.Style)ButtonEdit.FindResource("Active"); ButtonListProducts.Style = (System.Windows.Style)ButtonListProducts.FindResource("Active"); }