public CheckupPage() { this.InitializeComponent(); this.viewModel = new RoutineCheckupViewModel(); DataContext = this.viewModel; this.setDateText(); }
private async void finishEdit(object sender, RoutedEventArgs e) { try { this.ring.IsActive = true; var patientDal = new PatientDAL(); var nurseDal = new NurseDAL(); var appointDal = new AppointmentDAL(); var vm = new RoutineCheckupViewModel(); var appnt = await appointDal.GetAppointmentById(this.AppointmentID); var patient = await patientDal.GetPatientById(this.PatientId); var nurse = await nurseDal.GetNurseByNurseId(this.NurseId); var date = this.CheckupDate.Date.AddHours(this.CheckupTime.Hours).AddMinutes(this.CheckupTime.Minutes); var sys = !string.IsNullOrWhiteSpace(this.SystolicReading.ToString()) ? this.SystolicReading : throw new ArgumentException("The Systolic Reading cannot be empty."); var dbp = !string.IsNullOrWhiteSpace(this.DiastolicBloodPressure.ToString()) ? this.DiastolicBloodPressure : throw new ArgumentException("The blood pressure cannot be empty."); var weght = !string.IsNullOrWhiteSpace(this.Weight.ToString()) ? this.Weight : throw new ArgumentException("The weight cannot be empty"); var tep = !string.IsNullOrWhiteSpace(this.Temperature.ToString()) ? this.Temperature : throw new ArgumentException("The tmeperature cannot be empty"); var diag = !string.IsNullOrWhiteSpace(this.InitialDiagnosis) ? this.InitialDiagnosis : throw new ArgumentException("The initial diaggnosis cannot be empty"); var checkup = new RoutineCheck(appnt, nurse, patient, date, sys, dbp, weght, tep, diag); await vm.EditCheckup(checkup); this.Editing(false); this.ChangesMade = true; } catch (Exception ex) { this.ring.IsActive = false; this.error.Text = ex.Message; await Task.Delay(4000); this.error.Text = ""; } this.ring.IsActive = false; }
private async void viewCheckup(object sender, ItemClickEventArgs e) { var checkup = e.ClickedItem as RoutineCheck; var cvm = new RoutineCheckupViewModel(); var dialog = new CheckupDetailedView() { AppointmentID = checkup.Appointment.AppointmentId, CheckupDate = (DateTimeOffset)checkup.Date, CheckupTime = checkup.Date.TimeOfDay, PatientId = checkup.Patient.Id, PatientName = checkup.Patient.FullName, NurseId = checkup.Nurse.NurseId, NurserName = checkup.Nurse.FullName, SystolicReading = checkup.SystolicReading, DiastolicBloodPressure = checkup.DiastolicBloodPressure, Weight = checkup.Weight, Temperature = checkup.Temperature, InitialDiagnosis = checkup.InitialDiagnosis, User = this.User }; var result = await dialog.ShowAsync(); switch (result) { case ContentDialogResult.Secondary: if (dialog.ChangesMade) { this.ring.IsActive = true; await this.viewModel.LoadPatientCheckups(this.Patient); var mess = new MessageDialog("Your changes have been stored"); this.ring.IsActive = false; await mess.ShowAsync(); } break; } }