private void PopulateTableRows() { try { ActualTableDetails = XmlTablesNameList.Read(); TablesCount.Text = ActualTableDetails.Count.ToString(); for (int i = 0; i < ActualTableDetails.Count; i++) { SPTableRows.Children.Add(new TableRow(ActualTableDetails[i].TableButtonName, ActualTableDetails[i].TableName, Order_Clicked).GetGrid()); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void AddTableButtons() { try { SPTableButtons.Children.Clear(); TableButtons = XmlTablesNameList.Read(); for (int i = 0; i < TableButtons.Count; i++) { Button bt = new Button(); bt.Content = TableButtons[i].TableButtonName; bt.Click += (object obj, RoutedEventArgs e) => EnableTable(); SPTableButtons.Children.Add(bt); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void TableButtonCommandExecute(object parameter) { try { List <TableDetails> tableDetails = new List <TableDetails>(); tableDetails = XmlTablesNameList.Read(); string tableName = string.Empty; for (int i = 0; i < tableDetails.Count; i++) { if (tableDetails[i].TableButtonName.Equals(parameter.ToString())) { tableName = tableDetails[i].TableName; break; } } Database database = new Database(); database.CreateConnection("employee", "localhost", "root", "3306", ""); View.GetTable().ItemsSource = database.Reload(tableName).DefaultView; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }