コード例 #1
0
        public AppointmentGridViewModel(AggregateIdentifier identifier,
                                        ClientMedicalPracticeData medicalPractice,
                                        IViewModelCommunication viewModelCommunication,
                                        ISharedStateReadOnly <Size> gridSizeVariable,
                                        ISharedStateReadOnly <Guid?> roomFilterVariable,
                                        ISharedStateReadOnly <Guid> displayedMedicalPracticeVariable,
                                        ISharedState <AppointmentModifications> appointmentModificationsVariable,
                                        IAppointmentViewModelBuilder appointmentViewModelBuilder,
                                        AppointmentsOfADayReadModel readModel,
                                        IEnumerable <ITherapyPlaceRowViewModel> therapyPlaceRowViewModels,
                                        Action <string> errorCallback)
        {
            this.medicalPractice                  = medicalPractice;
            this.viewModelCommunication           = viewModelCommunication;
            this.gridSizeVariable                 = gridSizeVariable;
            this.roomFilterVariable               = roomFilterVariable;
            this.displayedMedicalPracticeVariable = displayedMedicalPracticeVariable;
            this.appointmentModificationsVariable = appointmentModificationsVariable;
            this.appointmentViewModelBuilder      = appointmentViewModelBuilder;
            this.readModel     = readModel;
            this.errorCallback = errorCallback;

            // Initial appointment-Creation is done at the AppointmentGridBuilder

            IsActive = false;
            PracticeIsClosedAtThisDay = false;

            gridSizeVariable.StateChanged   += OnGridSizeChanged;
            roomFilterVariable.StateChanged += OnGlobalRoomFilterVariableChanged;

            viewModelCommunication.RegisterViewModelAtCollection <IAppointmentGridViewModel, AggregateIdentifier>(
                Constants.ViewModelCollections.AppointmentGridViewModelCollection,
                this
                );

            Identifier = identifier;

            readModel.AppointmentChanged += OnReadModelAppointmentChanged;

            TimeGridViewModel = new TimeGridViewModel(Identifier, viewModelCommunication,
                                                      medicalPractice, gridSizeVariable.Value);

            TherapyPlaceRowViewModels = new ObservableCollection <ITherapyPlaceRowViewModel>(therapyPlaceRowViewModels);


            OnGlobalRoomFilterVariableChanged(roomFilterVariable.Value);
        }
コード例 #2
0
 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;
 }
コード例 #3
0
        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;
        }
コード例 #4
0
        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
                );
        }