private void Button_Click(object sender, RoutedEventArgs e) { model.Account account = data.findMemberByID(int.Parse(ID.Content.ToString())); if (account != null) { account.status = model.enums.AccountStatus.ACTIVE; updateMember(); this.Close(); ToggleForm(); } }
private void Button_Click(object sender, RoutedEventArgs e) { model.Account account = data.findMemberByID(int.Parse(ID.Content.ToString())); if (account != null) { foreach (var bookItem in account.getLendingBookItems()) { bookItem.lendingStatus = model.enums.LendingStatus.LOST; data.updateBookItem(bookItem); } while (account.getReservedBookItem().Count > 0) { account.removeBookToReserveBookList(account.getReservedBookItem()[0], "CANCELED"); } data.deleteMember(account); updateMember(); this.Close(); ToggleForm(); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (tbName.Text != "" && tbAddress.Text != "" && tbEmail.Text != "" && tbPhone.Text != "") { if (IsValidEmail(tbEmail.Text) && isVietnamesePhoneNumber(tbPhone.Text) && isValidName(tbName.Text)) { int updateAccountID = int.Parse(lbId.Content.ToString()); Person newInfo = new Person(tbName.Text, tbAddress.Text, tbEmail.Text, tbPhone.Text); Account updateAccount = data.findMemberByID(updateAccountID); newInfo.id = updateAccount.info.id; newInfo.imgSource = updateAccount.info.imgSource; if (imageName != "") { byte[] imageData = File.ReadAllBytes(imageName); string base64String = Convert.ToBase64String(imageData, 0, imageData.Length); newInfo.imgSource = base64String; } if (data.updateMemberInfo(newInfo) != null) { MessageBox.Show("Update Success", "Information", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Update Failed", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } updateMember(); ToggleForm(); this.Close(); } } else { MessageBox.Show("This field can not place empty!", "error", MessageBoxButton.OK, MessageBoxImage.Error); } }