private void addNewTab_Clicked(object sender, MouseButtonEventArgs e)
        {
            var         items       = currentDataGrid.SelectedItems;
            NewTableTab newTableTab = new NewTableTab(items.Count > 0, new List <string>(tableList.Keys));

            //Showing the dialog window for new table tab creation
            if (newTableTab.ShowDialog() == true)
            {
                //Create new tab & table
                CreateNewTable(newTableTab.TableName);
                if (newTableTab.includeSelected.IsChecked == true)
                {
                    //Copying the selected items from the last tab
                    foreach (Customer item in items)
                    {
                        CurrentTable.Insert(item);
                    }
                    RefreshGrid();
                    //Enabling Delete, Update &Select buttons
                    SetButtonsActivation(true);
                    SetSelectedRowCount();
                    SetRowCount();
                }
            }
        }
        private void selectBtn_Click(object sender, RoutedEventArgs e)
        {
            var    currentTabItem   = (TabItem)tableTabControl.SelectedItem;
            string currentTableName = currentTabItem.Header.ToString();
            var    tableNames       = (new List <string>(tableList.Keys));

            tableNames.Remove(currentTableName);
            SelectWindow selectWindow = new SelectWindow(CurrentTable, tableNames);

            if (selectWindow.ShowDialog() == true)
            {
                if (selectWindow.newTable)
                {
                    CreateNewTable("selected items " + ++selectionTabCount);
                }
                else
                {
                    var selectedTab = tableTabControl.Items.OfType <TabItem>().SingleOrDefault(n => n.Header.ToString().Equals(selectWindow.SelectedTable));
                    selectedTab.IsSelected = true;
                }
                CurrentTable.Insert(selectWindow.ResultDB);

                //Enabling Delete, Update &Select buttons
                SetButtonsActivation(true);
                RefreshGrid();

                SetSelectedRowCount();
                SetRowCount();
            }
        }
 private void loadFromSQLBtn_Click(object sender, RoutedEventArgs e)
 {
     CurrentTable.Insert(LoadFromSQL.Load());
     //Enabling Delete, Update & Select buttons
     SetButtonsActivation(true);
     RefreshGrid();
     SetRowCount();
 }
        private void insertBtn_Click(object sender, RoutedEventArgs e)
        {
            InsertWindow insertWindow = new InsertWindow(CurrentTable);

            //Showing the insert window dialog
            if (insertWindow.ShowDialog() == true)
            {
                Customer customer = new Customer(insertWindow.customerIdBox.Text, insertWindow.companyNameBox.Text,
                                                 insertWindow.contactNameBox.Text, insertWindow.phoneNumberBox.Text);
                //Insert the user input data
                CurrentTable.Insert(customer);
                RefreshGrid();
                //Enabling Delete, Update &Select buttons
                SetButtonsActivation(true);
                SetRowCount();
            }
        }