private void Can_AddCust_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { cust = new ViewCustomer(); addCust = new AddCustomer(); cust.Cust_page = null; DependencyObject currParent = VisualTreeHelper.GetParent(this); while (currParent != null && cust.Cust_page == null) { cust.Cust_page = currParent as Frame; currParent = VisualTreeHelper.GetParent(currParent); } if (cust.Cust_page != null) { cust.Cust_page.Source = new Uri("AddCustomer.xaml", UriKind.Relative); } }
private void can_Submit_MouseDown(object sender, MouseButtonEventArgs e) { connect = new CTUConnection(); viewCust = new ViewCustomer(); if (txt_BankNO.MaxLength != 18 || string.IsNullOrEmpty(txt_BankNO.Text)) { MessageBox.Show("Make sure the bank account number is correct"); } else if (string.IsNullOrEmpty(txt_firstname.Text)) { MessageBox.Show("Please enter the firstname of the customer"); } else if (txt_IDnumber.MaxLength != 13 || string.IsNullOrEmpty(txt_IDnumber.Text)) { MessageBox.Show("Please enter the ID number of the customer"); } else if (string.IsNullOrEmpty(txt_Surname.Text)) { MessageBox.Show("Please enter the surname of the customer"); } else if (string.IsNullOrEmpty(txt_Password.Text)) { MessageBox.Show("Please enter the password of the customer"); } else { connect.GetCustomer(txt_username.Text, txt_Password.Text, txt_firstname.Text, txt_Surname.Text, txt_IDnumber.Text, txt_BankNO.Text); connect.SelectCustomer(); viewCust.DGV_Cust.ItemsSource = connect.table.DefaultView; } }
private void Btn_Customer_Click(object sender, System.Windows.RoutedEventArgs e) { viewCust = new ViewCustomer(); _mainFrame.Navigate(viewCust); }