private void SubmitButton_Click(object sender, EventArgs e) { if (!ValidationHelper.IsValidEmail(emailTextBox.Text)) { MessageBox.Show(@"Email is either empty or is in incorrect format."); return; } Person = PersonProvider.GetPersonByEmail(emailTextBox.Text); if (Person != null) { SetFields(Person); emailTextBox.Enabled = false; ChangeTextBoxesAvailability(string.Empty, false); } else { ChangeTextBoxesAvailability(@"Email not found", true); } proceedButton.Enabled = true; }
/// <summary> /// Transforms the <paramref name="listViewItem"/> to a reservation. /// </summary> /// <param name="listViewItem">Selected item to transform.</param> private void ListViewItemToReservation(ListViewItem listViewItem) { var email = listViewItem.SubItems[3].Text; var reservationId = Convert.ToInt32(listViewItem.SubItems[0].Text); Person = PersonProvider.GetPersonByEmail(email); Reservation = ReservationProvider.GetReservationById(reservationId); }
private void SearchButton_Click(object sender, EventArgs e) { if (!ValidateEmail(emailTextBox.Text)) { return; } Email = emailTextBox.Text; Person = PersonProvider.GetPersonByEmail(Email); if (Person == null) { dataTextBox.Text = @"No data found"; } else { SearchAndWriteData(Person); deleteButton.Enabled = true; } }