public OverviewPageViewModel(IViewModelCommunication viewModelCommunication, IDateDisplayViewModel dateDisplayViewModel, IMedicalPracticeSelectorViewModel medicalPracticeSelectorViewModel, IRoomFilterViewModel roomFilterViewModel, IDateSelectorViewModel dateSelectorViewModel, IGridContainerViewModel gridContainerViewModel, IUndoRedoViewModel undoRedoViewModel, IWindowBuilder <Views.AddAppointmentDialog> addAppointmentDialogBuilder, PrintDialogWindowBuilder printDialogBuilder, ISharedStateReadOnly <AppointmentModifications> appointmentModificationsVariable, ISharedStateReadOnly <Guid> selectedMedicalPracticeIdVariable, ISharedStateReadOnly <Date> selectedDayVariable, IClientMedicalPracticeRepository medicalPracticeRepository, Action <string> errorCallback) { this.appointmentModificationsVariable = appointmentModificationsVariable; this.selectedMedicalPracticeIdVariable = selectedMedicalPracticeIdVariable; this.selectedDayVariable = selectedDayVariable; this.medicalPracticeRepository = medicalPracticeRepository; this.errorCallback = errorCallback; DateDisplayViewModel = dateDisplayViewModel; MedicalPracticeSelectorViewModel = medicalPracticeSelectorViewModel; RoomFilterViewModel = roomFilterViewModel; DateSelectorViewModel = dateSelectorViewModel; GridContainerViewModel = gridContainerViewModel; UndoRedoViewModel = undoRedoViewModel; ChangeConfirmationVisible = false; AddAppointmentPossible = false; appointmentModificationsVariable.StateChanged += OnCurrentModifiedAppointmentVariableChanged; selectedMedicalPracticeIdVariable.StateChanged += OnSelectedMedicalPracticeIdVariableChanged; selectedDayVariable.StateChanged += OnSelectedDayVariablChanged; ShowAddAppointmentDialog = new Command(() => { viewModelCommunication.Send(new ShowDisabledOverlay()); var dialogWindow = addAppointmentDialogBuilder.BuildWindow(); dialogWindow.ShowDialog(); //addAppointmentDialogBuilder.DisposeWindow(dialogWindow); viewModelCommunication.Send(new HideDisabledOverlay()); }); ShowPrintDialog = new Command(() => { viewModelCommunication.Send(new ShowDisabledOverlay()); var dialogWindow = printDialogBuilder.BuildWindow(new AggregateIdentifier(selectedDayVariable.Value, selectedMedicalPracticeIdVariable.Value)); dialogWindow.ShowDialog(); //printDialogBuilder.DisposeWindow(dialogWindow); viewModelCommunication.Send(new HideDisabledOverlay()); }); UpdateAddAppointmentPossible(); }
public SearchPageViewModel(IPatientSelectorViewModel patientSelectorViewModel, ISharedStateReadOnly <Patient> selectedPatientVariable, ISharedState <Date> selectedDateVariable, IViewModelCommunication viewModelCommunication, ICommandService commandService, IClientReadModelRepository readModelRepository, IClientMedicalPracticeRepository medicalPracticeRepository, Action <string> errorCallBack) { this.selectedPatientVariable = selectedPatientVariable; this.viewModelCommunication = viewModelCommunication; this.commandService = commandService; this.readModelRepository = readModelRepository; this.medicalPracticeRepository = medicalPracticeRepository; this.errorCallBack = errorCallBack; this.selectedDateVariable = selectedDateVariable; NoAppointmentsAvailable = false; selectedPatientVariable.StateChanged += OnSelectedPatientVariableChanged; PatientSelectorViewModel = patientSelectorViewModel; DeleteAppointment = new ParameterrizedCommand <DisplayAppointmentData>(DoDeleteAppointment); ModifyAppointment = new ParameterrizedCommand <DisplayAppointmentData>(DoModifyAppointment); SelectedPatient = NoPatientSelected; DisplayedAppointments = new ObservableCollection <DisplayAppointmentData>(); }
public PrintDialogViewModel(AggregateIdentifier identifier, IClientMedicalPracticeRepository medicalPracticeRepository, IClientReadModelRepository readModelRepository, Action <string> errorCallback) { Cancel = new Command(CloseWindow); Print = new ParameterrizedCommand <FrameworkElement>(DoPrint); medicalPracticeRepository.RequestMedicalPractice( practice => { readModelRepository.RequestAppointmentSetOfADay( appointmentSet => { Application.Current.Dispatcher.Invoke(() => { var initialGridSize = CurrentGridSize ?? new Size(new Width(850), new Height(600)); AppointmentGrid = new PrintAppointmentGridViewModel(identifier, practice, appointmentSet.Appointments, initialGridSize); }); }, identifier, errorCallback ); }, identifier.MedicalPracticeId, identifier.Date, errorCallback ); }
public MedicalPracticeSelectorViewModel(ISession session, IClientMedicalPracticeRepository medicalPracticeRepository, ILocalSettingsRepository localSettingsRepository, ISharedState <Guid> selectedMedicalPracticeIdVariable, ISharedStateReadOnly <AppointmentModifications> appointmentModificationsVariable, Action <string> errorCallback) { this.localSettingsRepository = localSettingsRepository; this.selectedMedicalPracticeIdVariable = selectedMedicalPracticeIdVariable; this.appointmentModificationsVariable = appointmentModificationsVariable; selectedMedicalPracticeIdVariable.StateChanged += OnSelectedMedicalPracticeIdVariableChanged; appointmentModificationsVariable.StateChanged += OnAppointmentModificationVariableChanged; AvailableMedicalPractices = session.LoggedInUser .ListOfAccessablePractices .Select(practiceId => new MedicalPracticeDisplayData(practiceId, practiceId.ToString())) .ToObservableCollection(); foreach (var medicalPracticeDisplayData in AvailableMedicalPractices) { medicalPracticeRepository.RequestMedicalPractice( practice => { medicalPracticeDisplayData.PracticeName = practice.Name; }, medicalPracticeDisplayData.MedicalPracticeId, errorCallback ); } SelectedMedicalPractice = AvailableMedicalPractices.First(practice => practice.MedicalPracticeId == selectedMedicalPracticeIdVariable.Value); PracticeIsSelectable = true; }
public PrintDialogWindowBuilder(IClientMedicalPracticeRepository medicalPracticeRepository, IClientReadModelRepository readModelRepository, Action <string> errorCallback) { this.medicalPracticeRepository = medicalPracticeRepository; this.readModelRepository = readModelRepository; this.errorCallback = errorCallback; }
public AppointmentModificationsBuilder(IClientMedicalPracticeRepository medicalPracticeRepository, IClientReadModelRepository readModelRepository, IViewModelCommunication viewModelCommunication, ISharedState <Date> selectedDateVariable, ISharedStateReadOnly <Size> gridSizeVariable) { this.medicalPracticeRepository = medicalPracticeRepository; this.readModelRepository = readModelRepository; this.viewModelCommunication = viewModelCommunication; this.selectedDateVariable = selectedDateVariable; this.gridSizeVariable = gridSizeVariable; }
public AppointmentModifications(Appointment originalAppointment, Guid medicalPracticeId, IClientMedicalPracticeRepository medicalPracticeRepository, IClientReadModelRepository readModelRepository, IViewModelCommunication viewModelCommunication, ISharedState <Date> selectedDateVariable, ISharedStateReadOnly <Size> gridSizeVariable, bool isInitialAdjustment, Action <string> errorCallback) { OriginalAppointment = originalAppointment; IsInitialAdjustment = isInitialAdjustment; this.medicalPracticeRepository = medicalPracticeRepository; this.selectedDateVariable = selectedDateVariable; this.gridSizeVariable = gridSizeVariable; this.errorCallback = errorCallback; this.readModelRepository = readModelRepository; this.viewModelCommunication = viewModelCommunication; versions = new VersionManager <ModificationDataSet>(100); versions.CurrentVersionChanged += OnCurrentVersionChanged; versions.PropertyChanged += OnVersionsManagerPropertyChanged; selectedDateVariable.StateChanged += OnSelectedDateVariableChanged; gridSizeVariable.StateChanged += OnGridSizeVariableChanged; OnGridSizeVariableChanged(gridSizeVariable.Value); var aggregateIdentifier = new AggregateIdentifier(originalAppointment.Day, medicalPracticeId); InitialLocation = new TherapyPlaceRowIdentifier(aggregateIdentifier, originalAppointment.TherapyPlace.Id); medicalPracticeRepository.RequestMedicalPractice( practice => { Application.Current.Dispatcher.Invoke(() => currentMedicalPracticeVersion = practice); }, InitialLocation.PlaceAndDate.MedicalPracticeId, InitialLocation.PlaceAndDate.Date, errorCallback ); var initialDataSet = new ModificationDataSet(originalAppointment.StartTime, originalAppointment.EndTime, originalAppointment.Description, originalAppointment.Label, InitialLocation, true); versions.AddnewVersion(initialDataSet); }
public ReplaceAppointmentCommandHandler(IConnectionService connectionService, ISession session, IClientPatientRepository patientRepository, IClientMedicalPracticeRepository practiceRepository, IUserActionBuilder userActionBuilder, Action <string> errorCallback) { this.connectionService = connectionService; this.session = session; this.patientRepository = patientRepository; this.practiceRepository = practiceRepository; this.userActionBuilder = userActionBuilder; this.errorCallback = errorCallback; }
public TherapyPlaceRowViewModelBuilder(IViewModelCommunication viewModelCommunication, IClientMedicalPracticeRepository medicalPracticeRepository, IClientTherapyPlaceTypeRepository therapyPlaceTypeRepository, AdornerControl adornerControl, ISharedStateReadOnly <AppointmentModifications> appointmentModificationsVariable, ISharedStateReadOnly <Size> appointmentGridSizeVariable) { this.viewModelCommunication = viewModelCommunication; this.medicalPracticeRepository = medicalPracticeRepository; this.therapyPlaceTypeRepository = therapyPlaceTypeRepository; this.adornerControl = adornerControl; this.appointmentModificationsVariable = appointmentModificationsVariable; this.appointmentGridSizeVariable = appointmentGridSizeVariable; }
public ClientReadModelRepository(IClientEventBus eventBus, IClientPatientRepository patientsRepository, IClientMedicalPracticeRepository medicalPracticeRepository, IClientLabelRepository labelRepository, IConnectionService connectionService) { this.eventBus = eventBus; this.patientsRepository = patientsRepository; this.medicalPracticeRepository = medicalPracticeRepository; this.labelRepository = labelRepository; this.connectionService = connectionService; cachedDayReadmodels = new ConcurrentDictionary <AggregateIdentifier, AppointmentsOfADayReadModel>(); cachedPatientReadmodel = new ConcurrentDictionary <Guid, AppointmentsOfAPatientReadModel>(); }
private void ComputeTimeSlots(IClientMedicalPracticeRepository medicalPracticeRepository, Guid medicalPracticeId) { medicalPracticeRepository.RequestMedicalPractice( loadedPractice => { readModelRepository.RequestAppointmentSetOfADay( fixAppointmentSet => { medicalPractice = loadedPractice; IDictionary <TherapyPlaceRowIdentifier, IEnumerable <TimeSlot> > allSlots = new Dictionary <TherapyPlaceRowIdentifier, IEnumerable <TimeSlot> >(); IDictionary <TherapyPlace, IList <Appointment> > sortedAppointments = new Dictionary <TherapyPlace, IList <Appointment> >(); foreach (var therapyPlace in medicalPractice.GetAllTherapyPlaces()) { sortedAppointments.Add(therapyPlace, new List <Appointment>()); } fixAppointmentSet.Appointments.Do(appointment => sortedAppointments[appointment.TherapyPlace].Add(appointment)); var openingTime = medicalPractice.HoursOfOpening.GetOpeningTime(creationDate); var closingTime = medicalPractice.HoursOfOpening.GetClosingTime(creationDate); foreach (var therapyRowData in sortedAppointments) { var slots = ComputeSlots(openingTime, closingTime, therapyRowData.Value); allSlots.Add( new TherapyPlaceRowIdentifier(new AggregateIdentifier(creationDate, medicalPractice.Id), therapyRowData.Key.Id), slots); } allAvailableTimeSlots = allSlots; }, new AggregateIdentifier(creationDate, loadedPractice.Id, loadedPractice.Version), errorCallback ); }, medicalPracticeId, creationDate, errorCallback ); }
public AddAppointmentDialogWindowBuilder(IClientPatientRepository patientRepository, IClientReadModelRepository readModelRepository, IClientMedicalPracticeRepository medicalPracticeRepository, IClientLabelRepository labelRepository, ISharedStateReadOnly <Guid> selectedMedicalPractiveVariable, ISharedStateReadOnly <Date> selectedDateVariable, IAppointmentViewModelBuilder appointmentViewModelBuilder, Action <string> errorCallback) { this.patientRepository = patientRepository; this.readModelRepository = readModelRepository; this.medicalPracticeRepository = medicalPracticeRepository; this.labelRepository = labelRepository; this.selectedMedicalPractiveVariable = selectedMedicalPractiveVariable; this.selectedDateVariable = selectedDateVariable; this.appointmentViewModelBuilder = appointmentViewModelBuilder; this.errorCallback = 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 ); }
public RoomFilterViewModel(IClientMedicalPracticeRepository medicalPracticeRepository, ISharedState <Guid?> roomFilterVariable, ISharedStateReadOnly <Date> selectedDateVariable, ISharedStateReadOnly <Guid> displayedMedicalPracticeVariable, ISharedState <AppointmentModifications> appointmentModificationsVariable, Action <string> errorCallback) { this.medicalPracticeRepository = medicalPracticeRepository; this.roomFilterVariable = roomFilterVariable; this.selectedDateVariable = selectedDateVariable; this.displayedMedicalPracticeVariable = displayedMedicalPracticeVariable; this.appointmentModificationsVariable = appointmentModificationsVariable; this.errorCallback = errorCallback; roomFilterVariable.StateChanged += OnRoomFilterVariableChanged; displayedMedicalPracticeVariable.StateChanged += OnDisplayedPracticeVariableStateChanged; selectedDateVariable.StateChanged += OnSelectedDateVariableChanged; SetRoomData(selectedDateVariable.Value, displayedMedicalPracticeVariable.Value); }
public AppointmentGridViewModelBuilder(IClientMedicalPracticeRepository medicalPracticeRepository, IClientReadModelRepository readModelRepository, IViewModelCommunication viewModelCommunication, ISharedStateReadOnly <Size> gridSizeVariable, ISharedStateReadOnly <Guid?> roomFilterVariable, ISharedStateReadOnly <Guid> displayedMedicalPracticeVariable, ISharedState <AppointmentModifications> appointmentModificationsVariable, IAppointmentViewModelBuilder appointmentViewModelBuilder, ITherapyPlaceRowViewModelBuilder therapyPlaceRowViewModelBuilder) { this.medicalPracticeRepository = medicalPracticeRepository; this.readModelRepository = readModelRepository; this.viewModelCommunication = viewModelCommunication; this.gridSizeVariable = gridSizeVariable; this.roomFilterVariable = roomFilterVariable; this.displayedMedicalPracticeVariable = displayedMedicalPracticeVariable; this.appointmentModificationsVariable = appointmentModificationsVariable; this.appointmentViewModelBuilder = appointmentViewModelBuilder; this.therapyPlaceRowViewModelBuilder = therapyPlaceRowViewModelBuilder; }
public MainViewModelBuilder(IClientMedicalPracticeRepository medicalPracticeRepository, IClientReadModelRepository readModelRepository, IClientPatientRepository patientRepository, IClientTherapyPlaceTypeRepository therapyPlaceTypeRepository, IClientLabelRepository labelRepository, ICommandService commandService, ILocalSettingsRepository localSettingsRepository, IViewModelCommunication viewModelCommunication, ISession session, AdornerControl adornerControl) { this.medicalPracticeRepository = medicalPracticeRepository; this.readModelRepository = readModelRepository; this.patientRepository = patientRepository; this.therapyPlaceTypeRepository = therapyPlaceTypeRepository; this.labelRepository = labelRepository; this.commandService = commandService; this.localSettingsRepository = localSettingsRepository; this.viewModelCommunication = viewModelCommunication; this.session = session; this.adornerControl = adornerControl; }
public MainWindowBuilder(ILocalSettingsRepository localSettingsRepository, IClientPatientRepository patientRepository, IClientMedicalPracticeRepository medicalPracticeRepository, IClientReadModelRepository readModelRepository, IClientTherapyPlaceTypeRepository therapyPlaceTypeRepository, IClientLabelRepository labelRepository, ICommandService commandService, IViewModelCommunication viewModelCommunication, ISession session, Action <string> errorCallback) { this.localSettingsRepository = localSettingsRepository; this.patientRepository = patientRepository; this.medicalPracticeRepository = medicalPracticeRepository; this.readModelRepository = readModelRepository; this.therapyPlaceTypeRepository = therapyPlaceTypeRepository; this.labelRepository = labelRepository; this.commandService = commandService; this.viewModelCommunication = viewModelCommunication; this.session = session; this.errorCallback = errorCallback; }
public AddAppointmentDialogViewModel(IClientMedicalPracticeRepository medicalPracticeRepository, IClientReadModelRepository readModelRepository, IClientLabelRepository labelRepository, IPatientSelectorViewModel patientSelectorViewModel, ISharedStateReadOnly <Patient> selectedPatientVariable, Date creationDate, Guid medicalPracticeId, IAppointmentViewModelBuilder appointmentViewModelBuilder, Action <string> errorCallback) { this.readModelRepository = readModelRepository; this.creationDate = creationDate; this.appointmentViewModelBuilder = appointmentViewModelBuilder; this.errorCallback = errorCallback; this.selectedPatientVariable = selectedPatientVariable; ComputeTimeSlots(medicalPracticeRepository, medicalPracticeId); selectedPatientVariable.StateChanged += OnSelectedPatientVariableChanged; PatientSelectorViewModel = patientSelectorViewModel; CloseDialog = new Command(CloseWindow); CreateAppointment = new Command(DoCreateAppointment, () => CreationState != AppointmentCreationState.NoPatientSelected && CreationState != AppointmentCreationState.NoSpaceAvailable, new PropertyChangedCommandUpdater(this, nameof(CreationState))); HourPlusOne = new Command(DoHourPlusOne, CanHourPlusOne, new PropertyChangedCommandUpdater(this, nameof(DurationHours))); HourMinusOne = new Command(DoHourMinusOne, CanHourMinusOne, new PropertyChangedCommandUpdater(this, nameof(DurationHours), nameof(DurationMinutes))); MinutePlusFifteen = new Command(DoMinutePlusFifteen, CanMinutePlusFifteen, new PropertyChangedCommandUpdater(this, nameof(DurationHours), nameof(DurationMinutes))); MinuteMinusFifteen = new Command(DoMinuteMinusFifteen, CanMinuteMinusFifteen, new PropertyChangedCommandUpdater(this, nameof(DurationHours), nameof(DurationMinutes))); SelectedPatient = Patient.Dummy; Description = string.Empty; DurationMinutes = 0; DurationHours = 2; CreationState = AppointmentCreationState.NoPatientSelected; AllAvailablesLabels = new ObservableCollection <Label>(); labelRepository.RequestAllLabels( labelList => { Application.Current.Dispatcher.Invoke(() => { labelList.Do(AllAvailablesLabels.Add); SelectedLabel = labelList.First(); }); }, errorCallback ); }