private void Button_Update(object sender, RoutedEventArgs e) { UserService.UserB user = new UserService.UserB(); user.UserId = userId; user.Name = txt_profileName.Text; user.Address = txt_profileAddress.Text; user.Phone = txt_profilePhone.Text; if (txt_profileEmail.Text != currentEmail) { if (!client.CheckEmailIfExists(txt_profileEmail.Text)) { user.Email = txt_profileEmail.Text; } else { MessageBox.Show("This email already exists!"); return; } } else { user.Email = txt_profileEmail.Text; } if (txt_profilePassword.Text == txt_profileConfirmPass.Text) { user.Password = txt_profileConfirmPass.Text; } else { MessageBox.Show("Passwords are not match!"); return; } int bankNo = Int32.Parse(txt_profileBankNumber.Text); DateTime expiryDate = Convert.ToDateTime(txt_profileExpiryDate.Text); int CCV = Int32.Parse(txt_profileCCv.Text); if (bankClient.CheckBankAccount(bankNo, expiryDate, CCV)) { user.BankAccountId = GetIdOfTheBankAccount(); } else { MessageBox.Show("Wrong Bank Account Information!"); return; } bool updated = client.UpdateUser(user); if (updated) { MessageBox.Show("Your profile was updated!"); txt_profileConfirmPass.Text = ""; } else { MessageBox.Show("Something went wrong!"); } }
private void Button_Update(object sender, RoutedEventArgs e) { UserService.UserB user = new UserService.UserB(); user.Password = password; user.UserId = userId; user.Name = txt_Name.Text; user.BankAccountId = accID; user.Address = txt_Address.Text; user.Phone = txt_PhoneNo.Text; user.TypeOfUser = Int32.Parse(txt_TypeOfUser.Text); if (txt_Email.Text != currentEmail) { if (!usrClient.CheckEmailIfExists(txt_Email.Text)) { user.Email = txt_Email.Text; } else { MessageBox.Show("This email already exists!"); return; } } else { user.Email = txt_Email.Text; } bool updated = usrClient.UpdateUser(user); if (updated) { MessageBox.Show("User profile was updated!"); } else { MessageBox.Show("Something went wrong!"); } userList.Items.Clear(); loadAllUsers(); }