public ReservationDashBoardViewModel(IUnityContainer container, ILoggerFacade logger, IReservationManager reservationManager, ITableManager tableManager, IMessageBoxService messageBoxService, IDialogBoxService dialogBoxService)
        {
            this._logger = logger;
            this._container = container;
            this._reservationManager = reservationManager;
            this._tableManager = tableManager;
            this._messageBoxService = messageBoxService;
            this._dialogBoxService = dialogBoxService;
            this._reservationHours = new ObservableCollection<ReservationHour>();
            this._reservations = new MappedValueCollection();


            this.AddCommand = new DelegateCommand(this.OnAddCommand, () => { return this._noOfPersons > 0; });
            this.BrowseCommand = new DelegateCommand(this.OnBrowseCommand);
            this.ImportCommand = new DelegateCommand(this.OnImportCommand, () => { return !string.IsNullOrEmpty(this._tableXMLFile); });

            this._tables = this._tableManager.GetAll();
            
            // Assumption : Reservation duration is between 10 Am and 10 Pm
            this._minFromHour = 10;
            this._maxFromHour = 22;

            for (int hour = this._minFromHour; hour <= this._maxFromHour; hour++)
            {
                this._reservationHours.Add(new ReservationHour(hour));
            }

            this.FromHour = this._minFromHour;

            TableReservation.Common.ReservationsUpdatedEvent.Instance.Subscribe(this.ReservationsUpdated);
            this.ReservationsUpdated(Guid.NewGuid());
        }
        public WalkInAppointmentViewModel()
        {
            _dialogService = new DialogBoxService();

            Timeslot = AppointmentLogic.CalcWalkInTimeslot();
            if (IsInDesignMode)
            {
                EstimatedTime = "2 Hours 45 Minutes";
            }
            else
            {
                if (Timeslot == null)
                {
                    EstimatedTime = "No Avaliable Time. Try booking a reservation.";
                }
                else
                {
                    EstimatedTime = CalcWaitTime();
                }
            }
            // When patientID message is received (from PatientDBConverter), set patient ID in VM.
            MessengerInstance.Register <double>(this, SetPatientID);

            BookAppointmentCommand = new RelayCommand(BookAppointment);
        }
        public static void AlmostReadyEmail(int patientID)
        {
            _dialogService = new DialogBoxService();

            // Modifies email html to input date and time in email.
            string text = File.ReadAllText("Assets\\appointment_email.html");

            text = text.Replace("InsertDate1", DateTime.Today.ToShortDateString());
            text = text.Replace("HEADING", "The doctor will see you now.");
            text = text.Replace("MAINBODY", "We're almost ready to see you, please return to the GP within 10 minutes.");
            text = text.Replace("InsertDate2", "");
            File.WriteAllText("appointment_email.html", text);

            string patientEmail = PatientDBConverter.GetEmail(patientID);

            try
            {
                using (StreamReader reader = File.OpenText("appointment_email.html"))
                {
                    SmtpClient client = new SmtpClient("smtp.gmail.com");

                    MailMessage message = new MailMessage("*****@*****.**", patientEmail);

                    message.IsBodyHtml           = true;
                    message.Body                 = reader.ReadToEnd();
                    message.Subject              = "We're ready for you.";
                    client.UseDefaultCredentials = false;
                    client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "mitsig-applepie-lambda2000");
                    client.Host           = "smtp.gmail.com";
                    client.Port           = 587;
                    client.DeliveryMethod = SmtpDeliveryMethod.Network;
                    client.EnableSsl      = true;

                    //await
                    client.SendMailAsync(message);
                }
            }
            catch (Exception ex)
            {
                // Saves error to error log
                string exePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                string logPath = exePath + @"\\logs\\log.txt";
                using (StreamWriter writer = new StreamWriter(logPath, true))
                {
                    writer.WriteLine("-----------------------------------------------------------------------------");
                    writer.WriteLine("Date : " + DateTime.Now.ToString());
                    writer.WriteLine();

                    while (ex != null)
                    {
                        writer.WriteLine(ex.GetType().FullName);
                        writer.WriteLine("Message : " + ex.Message);
                        writer.WriteLine("StackTrace : " + ex.StackTrace);

                        ex = ex.InnerException;
                    }
                }
            }
        }
Beispiel #4
0
        public EmergencyAppointmentViewModel()
        {
            _dialogService = new DialogBoxService();

            ShowHomeView = new RelayCommand(ShowHome);

            BookAppointmentCommand = new RelayCommand(BookAppointment);
        }
Beispiel #5
0
            public UsersGridWindow(string windowTitle,
                                   IUserListDataSource userListDataSource,
                                   IDialogBoxService dialogBoxService)
            {
                WindowTitle        = windowTitle;
                UserListDataSource = userListDataSource;
                DialogBoxService   = dialogBoxService;

                /* ... */
            }
Beispiel #6
0
        public BookAppointmentViewModel()
        {
            _dialogService = new DialogBoxService();

            WalkInCommand      = new RelayCommand(ShowWalkInView);
            ReservationCommand = new RelayCommand(ShowReservationView);

            BookingSubviewVisible = "Hidden";
            AppointmentTypeView   = ReservationView;
            ShowPatientCapture    = new RelayCommand(ShowPatientGrid);
            ShowHomeView          = new RelayCommand(ShowHome);
        }
Beispiel #7
0
        public ManageAppointmentsViewModel()
        {
            _dialogService = new DialogBoxService();

            // By default, non-cancelled appointments are shown.
            CancelledFilter        = "False";
            CancellationVisibility = Visibility.Collapsed; EditOptionsVisibility = Visibility.Visible;
            InitialiseDataTable();

            MessengerInstance.Register <NotificationMessage>(this, FilterRecords);

            CheckInPatientCommand    = new RelayCommand(CheckInPatient);
            CancelAppointmentCommand = new RelayCommand(CancelAppointment);
        }
Beispiel #8
0
        public DeletePatientViewModel()
        {
            _dialogService = new DialogBoxService();

            Patients = PatientDBConverter.GetPatients();
            Messenger.Default.Register <NotificationMessage>(
                this,
                message =>
            {
                UpdateDB();
            }
                );
            DeleteCommand = new RelayCommand(DeleteFromDB);
        }
        public AddPatientViewModel()
        {
            _dialogService = new DialogBoxService();

            if (IsInDesignMode)
            {
                Firstname = "Alfred";
                Lastname  = "Gjoni";
                Gender    = "Male";
                DOB       = DateTime.Parse("04/04/1991");
                AddressNo = "24";
                Postcode  = "IG12DH";
            }

            CreateRecordCommand = new RelayCommand(AddPatientRecord);
        }
        public ReservationViewModel(IUnityContainer container, ILoggerFacade logger, IReservationManager reservationManager, ITableManager tableManager, IMessageBoxService messageBoxService, IDialogBoxService dialogBoxService)
        {
            this._logger = logger;
            this._container = container;
            this._reservationManager = reservationManager;
            this._tableManager = tableManager;
            this._messageBoxService = messageBoxService;
            this._dialogBoxService = dialogBoxService;

            this.EditCommand = new DelegateCommand(this.OnEditCommand, () => { return this._selectedReservation != null; });
            this.DeleteCommand = new DelegateCommand(this.OnDeleteCommand, () => { return this._selectedReservation != null; });

            this.GetAllReservations();

            TableReservation.Common.ReservationsUpdatedEvent.Instance.Subscribe(this.ReservationsUpdated);
        }
Beispiel #11
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public LoginViewModel()
        {
            ErrorCommand   = new RelayCommand(Error);
            _dialogService = new DialogBoxService();

            if (IsInDesignMode)
            {
                ButtonText = _buttonText;
            }
            else
            {
                ButtonText = _buttonText;
            }
            SignInClick = new RelayCommand(SignInValidation);
            CloseClick  = new RelayCommand(CloseView);
        }
        public WaitingListViewModel()
        {
            _dialogService = new DialogBoxService();

            AllAppointments.Columns.Add("AppointmentID");
            AllAppointments.Columns.Add("PatientID");
            AllAppointments.Columns.Add("PatientName");
            AllAppointments.Columns.Add("AppointmentTime");
            AllAppointments.Columns.Add("TimeElapsed");
            AllAppointments.Columns.Add("AppointmentDoctor");

            InitialiseDataTable();

            MessengerInstance.Register <NotificationMessage>(this, FilterRecords);

            UncheckInPatientCommand  = new RelayCommand(UncheckInPatient);
            CancelAppointmentCommand = new RelayCommand(CancelAppointment);
        }
        public ReservationAppointmentViewModel()
        {
            _dialogService = new DialogBoxService();
            if (IsInDesignMode)
            {
                SelectedDate = DateTime.Parse("17/02/2000");
            }
            else
            {
                if (DateTime.Today.Date.DayOfWeek == DayOfWeek.Friday)
                {
                    SelectedDate = DateTime.Now.AddDays(3).Date;
                }
                else if (DateTime.Today.Date.DayOfWeek == DayOfWeek.Saturday)
                {
                    SelectedDate = DateTime.Now.AddDays(2).Date;
                }
                else
                {
                    SelectedDate = DateTime.Now.AddDays(1).Date;
                }
            }
            AvaliableTimes = StaffDBConverter.GetAvaliableTimeslots(SelectedDate, RequestedDoctor, RequestedGender);
            if (AvaliableTimes.Rows.Count <= 0)
            {
                NoAvaliableTime = "No Avaliable Times.";
            }
            else
            {
                NoAvaliableTime = "";
            }

            MessengerInstance.Register <DateTime> (
                this,
                (action) => UpdateTimeslots()
                );
            MessengerInstance.Register <int>(this, UpdateTimeslotIndex);
            // When patientID message is received (from PatientDBConverter), set patient ID in VM.
            MessengerInstance.Register <double>(this, SetPatientID);
            BookAppointmentCommand = new RelayCommand(BookAppointment);
        }
        public DoctorHomeViewModel()
        {
            _dialogService = new DialogBoxService();

            if (IsInDesignMode)
            {
                GreetingMessage = "Good Morning,";
            }
            GreetingMessage = "Welcome Back,";

            timer          = new DispatcherTimer(DispatcherPriority.Render);
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += (sender, args) =>
            {
                GreetingMessage = getGreeting();
            };
            timer.Start();

            MessengerInstance.Register <int>(this, SetDoctorDetails);
            StartAppointmentCommand = new RelayCommand(StartAppointment);
        }
        //ctor
        public HealthResultsViewModel(IDialogBoxService dialogBoxService, IImageManagerService imageManagerService)
        {
            _imageManagerService = imageManagerService;
            _dialogBoxService    = dialogBoxService;
            _dialogBoxService.InitDialogBox(new DialogBoxService.HealthResultsSave(OnNewPlant, OnExistingPlant, OnCancel));
            InitializePipelines();

            DiseasesCollection = new ObservableCollection <DiseaseInfo> {
                new DiseaseInfo("Black Spots", "Details about disease 1", DiseaseResultType.Ok),
                new DiseaseInfo("Disease2", "Details about disease 2", DiseaseResultType.Warning),
                new DiseaseInfo("Disease3", "Details about disease 3", DiseaseResultType.Error),
                new DiseaseInfo("Disease3", "Details about disease 3", DiseaseResultType.Error),
                new DiseaseInfo("Disease3", "Details about disease 3", DiseaseResultType.Error),
                new DiseaseInfo("Disease3", "Details about disease 3", DiseaseResultType.Error),
                new DiseaseInfo("Disease3", "Details about disease 3", DiseaseResultType.Error),
                new DiseaseInfo("Disease3", "Details about disease 3", DiseaseResultType.Error)
            };
            Title         = "Health Results Page";
            GoBackCommand = new Command(OnBack);
            GoHomeCommand = new Command(OnHome);
            SaveCommand   = new Command(OnSave);
        }
 public MainWindowViewModel(IDialogBoxService service)
 {
     _apiService    = new WebApiService();
     _dialogService = service;
     Persons        = new List <Person>();
 }
        public ReservationDetailsViewModel(IUnityContainer container, ILoggerFacade logger, IReservationManager reservationManager, ITableManager tableManager, IMessageBoxService messageBoxService, IDialogBoxService dialogBoxService)
        {
            this._logger = logger;
            this._container = container;
            this._reservationManager = reservationManager;
            this._tableManager = tableManager;
            this._messageBoxService = messageBoxService;
            this._dialogBoxService = dialogBoxService;

            var allTables = this._tableManager.GetAll().ToDictionary(tbl => tbl.TableId, tbl => tbl);

            // Assumption : Reservation duration is between 10 Am and 10 Pm
            this._minFromHour = 10;
            this._maxFromHour = 22;

            this._reservedTables = new ObservableCollection<Table>();
            var currentReservation = this._container.Resolve(typeof(Reservation), "SelectedReservation");
            if (currentReservation != null)
            {
                this.FromHour = (short)(currentReservation as Reservation).TimeFrom;
                this.ToHour = (short)(currentReservation as Reservation).TimeTo;
                this._currentReservation = currentReservation as Reservation;
                this._currentReservation.PropertyChanged += _currentReservation_PropertyChanged;

                foreach (var tableId in this._currentReservation.ReservedTableIds)
                {
                    this._reservedTables.Add(allTables[tableId]);
                }

                this._availableTables = new ObservableCollection<Table>(this.GetAvailableTables((ushort)this._fromHour, (ushort)this._toHour));
                if (this._availableTables != null && this._availableTables.Count > 0)
                {
                    this._selectedAvailableTable = this._availableTables.First();
                }
            }
            else
            {
                this.FromHour = this._minFromHour;
            }

            if (this._reservedTables != null && this._reservedTables.Count > 0)
            {
                this._selectedReservedTable = this._reservedTables.First();
            }

            this.SaveCommand = new DelegateCommand(this.OnSaveCommand, () =>
            {
                return this._currentReservation != null &&
                    this._reservedTables != null &&
                    this._reservedTables.Count > 0 &&
                    !string.IsNullOrEmpty(this._currentReservation.CustomerName) &&
                    !string.IsNullOrEmpty(this._currentReservation.ContactNumber);
            });

            this.CancelCommand = new DelegateCommand(this.OnCancelCommand, () => { return this._currentReservation != null; });

            this.ReserveTableCommand = new DelegateCommand(this.OnReserveTableCommand, () =>
            {
                return this._currentReservation != null &&
                    this._selectedAvailableTable != null &&
                    this._currentReservation.NoOfPersons > this._reservedTables.Sum(tbl => tbl.MaxOccupancy);
            });

            this.UnreserveTableCommand = new DelegateCommand(this.OnUnreserveTableCommand, () =>
            {
                return this._currentReservation != null &&
                    this._selectedReservedTable != null;
            });
        }
Beispiel #18
0
        public static void WalkInConfirmationEmail(int patientID)
        {
            _dialogService = new DialogBoxService();

            // Modifies email html to input date and time in email.
            string text = File.ReadAllText("Assets\\appointment_email.html");

            text = text.Replace("InsertDate1", DateTime.Today.ToShortDateString());
            text = text.Replace("HEADING", "Your appointment has been booked.");
            text = text.Replace("MAINBODY", "Please keep an eye on your emails for updates on your wait. Should you wish to alter or cancel your appointment please contact the GP.");
            text = text.Replace("InsertDate2", "");

            File.WriteAllText("appointment_email.html", text);

            string patientEmail = PatientDBConverter.GetEmail(patientID);

            try
            {
                using (StreamReader reader = File.OpenText("appointment_email.html"))
                {
                    SmtpClient client = new SmtpClient("smtp.gmail.com");

                    MailMessage message = new MailMessage("*****@*****.**", patientEmail);

                    message.IsBodyHtml           = true;
                    message.Body                 = reader.ReadToEnd();
                    message.Subject              = "Your Upcoming GP Appointment.";
                    client.UseDefaultCredentials = false;
                    client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "mitsig-applepie-lambda2000");
                    client.Host           = "smtp.gmail.com";
                    client.Port           = 587;
                    client.DeliveryMethod = SmtpDeliveryMethod.Network;
                    client.EnableSsl      = true;

                    //await
                    client.SendMailAsync(message);
                }
                File.Delete("appointment_email.html");
            }
            catch (Exception ex)
            {
                // Saves error to error log
                string exePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                string logPath = exePath + @"\\logs\\log.txt";
                using (StreamWriter writer = new StreamWriter(logPath, true))
                {
                    writer.WriteLine("-----------------------------------------------------------------------------");
                    writer.WriteLine("Date : " + DateTime.Now.ToString());
                    writer.WriteLine();

                    while (ex != null)
                    {
                        writer.WriteLine(ex.GetType().FullName);
                        writer.WriteLine("Message : " + ex.Message);
                        writer.WriteLine("StackTrace : " + ex.StackTrace);

                        ex = ex.InnerException;
                    }
                }
            }
        }