Beispiel #1
0
 public MainWindow()
 {
     InitializeComponent();
     TablesComboBox.ItemsSource   = DataBaseSupport.GetTables();
     TablesComboBox.SelectedIndex = 0;
     //TitelsText.ItemsSource = GetTitles(TablesComboBox.Text);
 }
Beispiel #2
0
 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;
     }
 }
Beispiel #3
0
 private void textBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         string nameTable = textBox.Text;
         DataBaseSupport.CreateTable(nameTable);
         Close();
     }
 }
Beispiel #4
0
 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];
     }
 }
Beispiel #5
0
        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());
            }
        }
Beispiel #6
0
 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();
     }
 }
Beispiel #7
0
 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);
         }
     }
 }
Beispiel #8
0
        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());
            }
        }
Beispiel #9
0
        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());
            }
        }