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