/// <summary> /// Monitors combo box selection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GenderComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (GenderComboBox.SelectedIndex > -1) { PatientFormValidator.Clear(); } }
/// <summary> /// Needs to accept only numbers /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BedNo_Validating(object sender, System.ComponentModel.CancelEventArgs e) { if (String.IsNullOrEmpty(BedNoText.Text)) { e.Cancel = true; PatientFormValidator.SetError(BedNoText, errorMsg); } }
public PatientsViewModelFactory( IPatientService patientService, IReservationService reservationService, PatientFormValidator validationRules) { _patientService = patientService; _reservationService = reservationService; _validationRules = validationRules; }
// Constructors #region Constructors // For new public PatientFormViewModel(IPatientService patientService, PatientFormValidator patientFormValidator) { CloseFormCommand = new RelayCommand(CancelForm); _patientService = patientService; _patientFormValidator = patientFormValidator; BirthDate = DateTime.Today; SubmitFormCommand = new AsyncRelayCommand(SubmitNewPatientForm, CanSubmitForm, (ex) => { throw ex; }); }
/// <summary> /// Clears all fields on form /// </summary> private void ClearAllFields() { FirstNameText.Text = ""; LastNameText.Text = ""; AddressText.Text = ""; GenderComboBox.SelectedIndex = -1; ConsultingDoctorText.Text = ""; WardText.Text = ""; RoomNoText.Text = ""; BedNoText.Text = ""; YesCheckBox.Checked = false; PatientFormValidator.Clear(); HealthCardLabel.Text = "-"; FirstNameText.Focus(); }
//For edit public PatientFormViewModel(Patient patient, IPatientService patientService, PatientFormValidator validationRules) : this(patientService, validationRules) { _patient = patient; LastName = patient.LastName; FirstName = patient.FirstName; PhoneNumber = patient.PhoneNumber.ToString(); Email = patient.Email; Comments = patient.Comments; BirthDate = patient.BirthDate; PostCode = patient.Address.PostCode; City = patient.Address.City; Street = patient.Address.Street; BuildingNumber = patient.Address.BuildingNumber; FlatNumber = patient.Address.FlatNumber; SubmitFormCommand = new AsyncRelayCommand(SubmitEditPatientForm, CanSubmitForm, (ex) => { throw ex; }); }