private void OnDisplayedPracticeStateChanged(Guid medicalPracticeId) { medicalPracticeRepository.RequestPraticeVersion( practiceVersion => { var newIdentifier = new AggregateIdentifier(selectedDateVariable.Value, medicalPracticeId, practiceVersion); TryToShowGridViewModel(newIdentifier); }, medicalPracticeId, selectedDateVariable.Value, errorCallback ); }
public GridContainerViewModel(IViewModelCommunication viewModelCommunication, IClientMedicalPracticeRepository medicalPracticeRepository, ISharedStateReadOnly <Date> selectedDateVariable, ISharedStateReadOnly <Guid> selectedMedicalPracticeIdVariable, ISharedState <Size> appointmentGridSizeVariable, IEnumerable <AggregateIdentifier> initialGridViewModelsToCache, int maximumCashedGrids, /* TODO */ IAppointmentGridViewModelBuilder appointmentGridViewModelBuilder, Action <string> errorCallback) { // TODO caching implementieren this.viewModelCommunication = viewModelCommunication; this.medicalPracticeRepository = medicalPracticeRepository; this.selectedDateVariable = selectedDateVariable; this.selectedMedicalPracticeIdVariable = selectedMedicalPracticeIdVariable; this.appointmentGridSizeVariable = appointmentGridSizeVariable; this.appointmentGridViewModelBuilder = appointmentGridViewModelBuilder; this.errorCallback = errorCallback; LoadedAppointmentGrids = new ObservableCollection <IAppointmentGridViewModel>(); cachedAppointmentGridViewModels = new Dictionary <AggregateIdentifier, IAppointmentGridViewModel>(); currentDisplayedAppointmentGridIdentifier = null; foreach (var identifier in initialGridViewModelsToCache) { AddGridViewModel(identifier); } selectedDateVariable.StateChanged += OnSelectedDateStateChanged; selectedMedicalPracticeIdVariable.StateChanged += OnDisplayedPracticeStateChanged; medicalPracticeRepository.RequestPraticeVersion( practiceVersion => { var newIdentifier = new AggregateIdentifier(selectedDateVariable.Value, selectedMedicalPracticeIdVariable.Value, practiceVersion); TryToShowGridViewModel(newIdentifier); }, selectedMedicalPracticeIdVariable.Value, selectedDateVariable.Value, errorCallback ); }
private async void DoDeleteAppointment(DisplayAppointmentData appointment) { var dialog = new UserDialogBox("", "Wollen Sie den Termin wirklich löschen?", MessageBoxButton.OKCancel); var result = await dialog.ShowMahAppsDialog(); if (result == MessageDialogResult.Affirmative) { medicalPracticeRepository.RequestPraticeVersion( practiceVersion => { commandService.TryDeleteAppointment( operationSuccessful => { if (!operationSuccessful) { viewModelCommunication.Send(new ShowNotification("Termin kann nicht gelöscht werden", 5)); } }, new AggregateIdentifier(appointment.Day, appointment.AppointmentRawData.MedicalPracticeId, practiceVersion), appointment.AppointmentRawData.PatientId, appointment.AppointmentRawData.Id, appointment.Description, appointment.AppointmentRawData.StartTime, appointment.AppointmentRawData.EndTime, appointment.AppointmentRawData.TherapyPlaceId, appointment.AppointmentRawData.LabelId, ActionTag.RegularAction, errorCallBack); }, appointment.AppointmentRawData.MedicalPracticeId, appointment.Day, errorCallBack ); } }