public MainWindow() { InitializeComponent(); TablesComboBox.ItemsSource = DataBaseSupport.GetTables(); TablesComboBox.SelectedIndex = 0; //TitelsText.ItemsSource = GetTitles(TablesComboBox.Text); }
private void TablesComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (TablesComboBox.SelectedValue != null) { string nameTable = TablesComboBox.SelectedValue.ToString(); TitlesListBox.ItemsSource = DataBaseSupport.GetTitles(nameTable); TitlesListBox.SelectedIndex = 0; } }
private void textBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { string nameTable = textBox.Text; DataBaseSupport.CreateTable(nameTable); Close(); } }
private void TitlesListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { TablesComboBox.ItemsSource = DataBaseSupport.GetTables(); TextTitle.Text = ""; if (TitlesListBox.SelectedValue != null) { string title = TitlesListBox.SelectedValue.ToString(); TextTitle.Text = DataBaseSupport.records[title]; } }
private void DelTableButton_Click(object sender, RoutedEventArgs e) { string str = TablesComboBox.Text.ToString(); DataBaseSupport.DeleteTable(str); TablesComboBox.ItemsSource = DataBaseSupport.GetTables(); if (TablesComboBox.SelectedValue != null) { TitlesListBox.ItemsSource = DataBaseSupport.GetTitles(TablesComboBox.SelectedValue.ToString()); } }
private void textBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { string nameTitle = textBox.Text; if (nameTitle.Length > 0 && nameTable.Length > 0) { DataBaseSupport.CreateTitle(nameTable, nameTitle); } Close(); } }
private void Window_Activated(object sender, EventArgs e) { TablesComboBox.ItemsSource = DataBaseSupport.GetTables(); if (TablesComboBox.SelectedValue != null) { string nameTable = TablesComboBox.SelectedValue.ToString(); if (nameTable.Length > 0) { TitlesListBox.ItemsSource = DataBaseSupport.GetTitles(nameTable); } } }
private void DelTitleButton_Click(object sender, RoutedEventArgs e) { string query = String.Format("DELETE FROM {0} WHERE NAME='{1}';", TablesComboBox.SelectedValue.ToString(), TitlesListBox.SelectedItem.ToString()); DataBaseSupport.SendQuery(query); if (TablesComboBox.SelectedValue != null) { TitlesListBox.ItemsSource = DataBaseSupport.GetTitles(TablesComboBox.SelectedValue.ToString()); } }
private void PrimenitButton_Click(object sender, RoutedEventArgs e) { string query = String.Format("UPDATE {0} SET TitleText='{1}' WHERE NAME='{2}';", TablesComboBox.SelectedValue.ToString(), TextTitle.Text, TitlesListBox.SelectedItem.ToString()); DataBaseSupport.SendQuery(query); if (TablesComboBox.SelectedValue != null) { TitlesListBox.ItemsSource = DataBaseSupport.GetTitles(TablesComboBox.SelectedValue.ToString()); } }