Esempio n. 1
0
        public DoctorTimetableViewModel(int doctorId, object parentViewModel, IAppointmentDataService appointmentDataService, IProfileDataService profileDataService, INotificationService notificationService, IEventAggregator eventAggregator, IRequestCoordinator requestCoordinator)
        {
            this.DoctorId               = doctorId;
            this.ParentViewModel        = parentViewModel;
            this.AppointmentDataService = appointmentDataService;
            this.ProfileDataService     = profileDataService;
            this.NotificationService    = notificationService;
            this.EventAggregator        = eventAggregator;

            this.Appointments = new TrulyObservableCollection <CalendarItemWrapper>();

            this.UserId = requestCoordinator.UserId.Value;

            this.LoadedCommand = AsyncCommand.Create(this.OnLoadedAsync);
            this.SelectedDateChangedCommand = AsyncCommand.Create <DateTime>(this.OnSelectedDateChangedAsync);
            this.ScheduleAppointmentCommand = AsyncCommand.Create <DateTime>(this.OnScheduleAsync);
            this.CancelAppointmentCommand   = AsyncCommand.Create <int>(this.OnCancelAsync);

            this.OpenDoctorCommand = new RelayCommand(
                () => this.EventAggregator.GetEvent <OpenDoctorEvent>().Publish(
                    new OpenDoctorEventArgs
            {
                DoctorId        = this.DoctorId,
                ParentViewModel = this
            }));

            this.BackCommand = AsyncCommand.Create(async() =>
            {
                await this.NotificationService.UnsubscribeAsync(this.DoctorId, this.SelectedDate);

                this.EventAggregator.GetEvent <NavigationEvent>().Publish(parentViewModel);
            });

            BindingOperations.EnableCollectionSynchronization(this.Appointments, lockObject);
        }
 public AppointmentService(IAppointmentRepo appointmentRepo, IVaccineRepo vaccineRepo, IAppointmentDataService dateService, IMapper mapper)
 {
     _appointmentRepo = appointmentRepo;
     _vaccineRepo     = vaccineRepo;
     _dateService     = dateService;
     _mapper          = mapper;
 }
Esempio n. 3
0
        public AppointmentService(IMapper mapper, IAppointmentDataService appointmentDataService)
        {
            Guard.ArgumentNotNull(mapper, nameof(mapper));
            Guard.ArgumentNotNull(appointmentDataService, nameof(appointmentDataService));

            _mapper = mapper;
            _appointmentDataService = appointmentDataService;
        }
Esempio n. 4
0
 public AppointmentUI(IAppointmentDataService appointmentDataService,
                      IMapper mapper,
                      string userName)
 {
     _appointmentDataService = appointmentDataService;
     _mapper   = mapper;
     _userName = userName;
 }
Esempio n. 5
0
 public MainWindowViewModel(IEventAggregator eventAggregator)
 {
     _customerDataService    = new CustomerDataService(() => new PlannerDbContext());
     _appointmentDataService = new AppointmentDataService(() => new PlannerDbContext());
     _authDataService        = new AuthenticationDataService(() => new PlannerDbContext());
     _eventAggregator        = eventAggregator;
     CurrentPage             = new LoginPage(new LoginViewModel(_authDataService, _eventAggregator));
     _eventAggregator.GetEvent <UserAuthenticationEvent>().Subscribe(OnUserAuthenticated);
 }
Esempio n. 6
0
        public ScheduleUI(IScheduleDataService scheduleDataService,
                          IAppointmentDataService appointmentDataService)
        {
            _scheduleDataService    = scheduleDataService;
            _appointmentDataService = appointmentDataService;

            int currYear = DateTime.Now.Year;

            Years.Add(currYear.ToString());
            Years.Add((currYear + 1).ToString());

            TimeOfDay.Add("Morning");
            TimeOfDay.Add("Noon");
            TimeOfDay.Add("Afternoon");
            TimeOfDay.Add("No Preference");
        }
Esempio n. 7
0
        public MainPageViewModel(ICustomerDataService customerDataService,
                                 IAppointmentDataService appointmentDataService,
                                 IAuthenticationDataService authDataService, User user)
        {
            _customerDataService    = customerDataService;
            _appointmentDataService = appointmentDataService;
            _authDataService        = authDataService;
            _user                 = user;
            _customers            = new ObservableCollection <CustomerWrapper>();
            _allAppointments      = new ObservableCollection <AppointmentWrapper>();
            _customerAppointments = new ObservableCollection <AppointmentWrapper>();
            _users                = new ObservableCollection <User>();
            _eventAggregator      = new EventAggregator();
            _customerListVM       = new CustomersListViewModel(_eventAggregator, _customers);
            _appointmentListVM    = new AppointmentsListViewModel(_eventAggregator, _customers, _customerAppointments);

            //Initializing all events
            InitializeEvents();

            //creates controls for the main page
            Controls = new Dictionary <ApplicationControls, UserControl>
            {
                [ApplicationControls.CustomersList]    = new CustomersListControl(_customerListVM),
                [ApplicationControls.AppointmentsList] = new AppointmentsListControl(_appointmentListVM),
                [ApplicationControls.Calendar]         = new CalendarControl(new CalendarViewModel(_eventAggregator, _allAppointments)),
                [ApplicationControls.Report]           = new ReportControl(
                    new ReportViewModel(_eventAggregator, _customers, _allAppointments, _users))
            };

            //setting up onLoad control
            CurrentContent = Controls[ApplicationControls.CustomersList];

            //initializing Commands
            CustomersCommand    = new RelayCommand(OnCustomersControlLoad);
            AppointmentsCommand = new RelayCommand(OnAppointmentsControlLoad);
            CalendarCommand     = new RelayCommand(OnCalendarControlLoad);
            ReportCommand       = new RelayCommand(OnReportControlLoad);
            InitCusAppList();
        }