private void back_Click(object sender, RoutedEventArgs e) { ViewCustomers viewCustomers = new ViewCustomers(); viewCustomers.Show(); this.Close(); }
private async void saveButton_Click(object sender, RoutedEventArgs e) { val = new Validation(); if (val.isEmpty(firstName) || val.isEmpty(lastName) || val.isEmpty(addressLine1) || val.isEmpty(addressLine2) || val.isEmpty(addressLine3) || val.isEmpty(email) || val.isEmpty(mobileContact.ToString()) || val.isEmpty(homeContact.ToString())) { await this.ShowMessageAsync("Error", "Input Data Cannot Be Empty", MessageDialogStyle.Affirmative); } else { int affectedLines = 0; customer = new CustomerData(); customer.setFirstName(FirstName.Text); customer.setLastName(LastName.Text); customer.setAddress(Address1.Text + ' ' + Address2.Text + ' ' + Address3.Text); customer.setEmail(Email.Text); customer.setMobileNumer(Convert.ToInt32(MobileContact.Text)); customer.setFixedNumber(Convert.ToInt32(HomeContact.Text)); try { handleDatabase = new HandleDatabase(); affectedLines = handleDatabase.executeCustomerUpdate(customer, customerID); if (affectedLines > 0) { await this.ShowMessageAsync("Successfull", "Customer have been Successfully Updates", MessageDialogStyle.Affirmative); ViewCustomers view = new ViewCustomers(); view.Show(); this.Close(); } else { await this.ShowMessageAsync("Error", "Sorry Can not Update, Please Try again", MessageDialogStyle.Affirmative); ViewCustomers view = new ViewCustomers(); view.Show(); this.Close(); } } catch (SqlException sqlException) { Console.WriteLine(sqlException); } } }