Esempio n. 1
0
        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
                );
        }
Esempio n. 2
0
        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 PrintDialogWindowBuilder(IClientMedicalPracticeRepository medicalPracticeRepository,
                                 IClientReadModelRepository readModelRepository,
                                 Action <string> errorCallback)
 {
     this.medicalPracticeRepository = medicalPracticeRepository;
     this.readModelRepository       = readModelRepository;
     this.errorCallback             = errorCallback;
 }
Esempio n. 4
0
        public CommandService(ISession session,
                              IClientReadModelRepository readModelRepository,
                              ICommandBus commandBus)
        {
            this.session             = session;
            this.readModelRepository = readModelRepository;
            this.commandBus          = commandBus;

            currentLocks = new List <Lock>();
        }
 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;
 }
Esempio n. 6
0
        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 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 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;
        }
Esempio n. 9
0
 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 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 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
                );
        }