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())); } }
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; }