private void SaveAppointment(object sender, System.Windows.RoutedEventArgs e) { try { var appointment = new Appointment(); var appointmentDataRepository = new AppointmentDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier); appointment.ProviderId = Convert.ToInt32(cmbProvider.SelectedValue.ToString()); appointment.Notes = txtNotes.Text.Trim(); appointment.PatientId = EHealthCareDesktopApp.Properties.Settings.Default.PatientID; appointment.Type = cmbType.SelectedItem.ToString(); appointment.Status = "InProgress"; appointment.StartDate = DateTime.Parse(string.Format("{0} {1}", dtPickerStartDate.SelectedDate.Value.ToShortDateString(), startTime.Text)); appointment.SpecialtyId = Convert.ToInt32(cmbSpecialty.SelectedValue.ToString()); appointment.EndDate = DateTime.Parse(string.Format("{0} {1}", dtPickerStartDate.SelectedDate.Value.ToShortDateString(), endTime.Text)); appointment.Purpose = txtPurpose.Text.Trim(); appointmentDataRepository.SaveAppointment(appointment); if (AppointmentAddedEvent != null) AppointmentAddedEvent("Success"); } catch (Exception ex) { if (AppointmentAddedEvent != null) AppointmentAddedEvent(string.Format("Problem in adding Appointment: {0}", ex.Message)); } }
private void LoadAppointments() { try { var appointmentDataRepository = new AppointmentDataRepository(UniqueIdentifier); listViewAppointments.ItemsSource = appointmentDataRepository.GetAllAppointmentData(PatientId); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void AppointmentClick(object sender, System.Windows.RoutedEventArgs e) { if (cmbPatients.SelectedIndex > -1) { var appointmentDataRepository = new AppointmentDataRepository(); var appointmentInfo = new AppointmentInfo(); appointmentInfo.PatientId = int.Parse(cmbPatients.SelectedValue.ToString()); appointmentInfo.UniqueIdentifier = appointmentDataRepository.GetPatientUniqueIdentifier(appointmentInfo.PatientId); appointmentInfo.ShowDialog(); } }
private void UpdateStatus(int id, string status) { try { var appointmentDataRepository = new AppointmentDataRepository(UniqueIdentifier); appointmentDataRepository.UpdateAppointmentStatus(id, PatientId, status); // Reload appointments LoadAppointments(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void DeleteClick(object sender, RoutedEventArgs e) { try { var id = int.Parse(((Button)sender).CommandParameter.ToString()); var appointmentDataRepository = new AppointmentDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier); appointmentDataRepository.DeleteAppointment(EHealthCareDesktopApp.Properties.Settings.Default.PatientID, id); LoadAppointments(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public List<AppointmentViewModel> GetViewModel() { var providerDataRepository = new ProviderDataRepository(); var apponitmentDataRepository = new AppointmentDataRepository(Guid.Parse(uniqueGuid)); var appointments = apponitmentDataRepository.GetAllAppointmentData(this.patientId); foreach (var appointment in appointments) { appointmentViewModelList.Add(new AppointmentViewModel { StartDate = appointment.StartDate, EndDate = appointment.EndDate, Notes = appointment.Notes, ProviderName = providerDataRepository.GetProviderById(appointment.ProviderId), Purpose = appointment.Purpose, SpecialtyName = apponitmentDataRepository.GetSpecialtiyName(appointment.SpecialtyId), Status = appointment.Status, Type = appointment.Type }); } return appointmentViewModelList; }
private void UploadButtonClick(object sender, RoutedEventArgs e) { try { var byteArray = File.ReadAllBytes(InputFile); var appointmentDataRepository = new AppointmentDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier); appointmentDataRepository.Upload(new AudioAppointment{ AppointmentId = this.appointmentID, DateTime = DateTime.Now, PatientId = EHealthCareDesktopApp.Properties.Settings.Default.PatientID, FileName = InputFile.Substring(InputFile.LastIndexOf("\\") + 1, (InputFile.Length - InputFile.LastIndexOf("\\") - 1)), Audio = byteArray, }); LoadAudioFiles(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadAudioFiles() { try { PatientAudioFilesCollection.Clear(); var appointmentDataRepository = new AppointmentDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier); var patientAudioAppointments = appointmentDataRepository.GetAudioAppointments(EHealthCareDesktopApp.Properties.Settings.Default.PatientID); foreach (var audioAppointment in patientAudioAppointments) { PatientAudioFilesCollection.Add(new PatientAudioViewModel { DateTime = audioAppointment.DateTime, FileName = audioAppointment.FileName, AudioId = audioAppointment.AudioId, Audio = audioAppointment.Audio }); } this.listUploadedAudioFiles.ItemsSource = PatientAudioFilesCollection; } catch (Exception ex) { MessageBox.Show(string.Format("Problem in loading audio files: {0}", ex.Message)); } }
private void DeleteClick(object sender, RoutedEventArgs e) { var appointmentDataRepository = new AppointmentDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier); try { var id = int.Parse(((Button)sender).CommandParameter.ToString()); appointmentDataRepository.DeleteAudioAppointment(EHealthCareDesktopApp.Properties.Settings.Default.PatientID, id); } catch (Exception ex) { MessageBox.Show(string.Format("Problem in deleting audio file: {0}", ex.Message)); } LoadAudioFiles(); }
private void WindowLoaded(object sender, System.Windows.RoutedEventArgs e) { this.dtPickerEndDate.SelectedDate = DateTime.Now.Date; this.dtPickerStartDate.SelectedDate = DateTime.Now.Date; this.cmbType.ItemsSource = GetAppointmentTypes(); try { var providerDataRepository = new ProviderDataRepository(); var providers = providerDataRepository.GetAllProviders(); List<NameValuePairs> nameValuePairs = new List<NameValuePairs>(); foreach(Provider provider in providers){ nameValuePairs.Add(new NameValuePairs(string.Format("{0} {1}", provider.FirstName, provider.LastName), provider.Id.ToString())); } cmbProvider.ItemsSource = nameValuePairs; cmbProvider.DisplayMemberPath = "Name"; cmbProvider.SelectedValuePath = "Value"; var appointmentDataRepository = new AppointmentDataRepository(EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier); var specialtiesList = appointmentDataRepository.GetAllSpecialties(); cmbSpecialty.ItemsSource = specialtiesList; cmbSpecialty.DisplayMemberPath = "SpecialityName"; cmbSpecialty.SelectedValuePath = "Id"; cmbSpecialty.SelectedIndex = 0; if (cmbProvider.Items.Count > 0) cmbProvider.SelectedIndex = 0; if(cmbType.Items.Count > 0) cmbType.SelectedIndex = 3; } catch (Exception ex) { MessageBox.Show(string.Format("Problem in loading specialties: '{0}'" , ex.ToString())); } }