private void LoadDataFromFiles()
 {
     DoctorController.getInstance().LoadFromFile();
     PatientController.getInstance().LoadFromFile();
     AppointmentController.getInstance().LoadAppointmentsFromFile();
     NotificationController.GetInstance().LoadFromFile();
 }
Пример #2
0
        private void ChangeButton_Click(object sender, RoutedEventArgs e)
        {
            Notification newNotification = new Notification(notificationTextBox.Text, GetTimeFromComboBoxes(), (DateTime)startDatePicker.SelectedDate, (DateTime)endDatePicker.SelectedDate, (bool)notificationCheckBox.IsChecked);

            NotificationController.GetInstance().ChangeNotification((Notification)notificationComboBox.SelectedItem, newNotification);
            PatientMainWindow.GetInstance(_loggedInPatient).Notify();
        }
Пример #3
0
 private static void AddCreatedNotification(Notification prescriptionNotification)
 {
     if (!NotificationExists(prescriptionNotification))
     {
         NotificationController.GetInstance().AddNotification(prescriptionNotification);
     }
 }
Пример #4
0
        private void CreateNotification()
        {
            Notification newNotification = FormNotification();

            NotificationController.GetInstance().AddNotification(newNotification);
            LoadNotificationComboBox();
            PatientMainWindow.GetInstance(_loggedInPatient).Notify();
        }
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     DoctorController.getInstance().SaveInFlie();
     AppointmentController.getInstance().SaveAppointmentsInFile();
     PatientController.getInstance().SaveInFile();
     NotificationController.GetInstance().SaveInFile();
     _instance = null;
 }
 private static void Serialize()
 {
     EquipmentController.getInstance().saveInFile();
     RoomController.GetInstance().SaveRoomsInFile();
     MedicineController.GetInstance().Serialization();
     DoctorController.getInstance().SaveInFlie();
     NotificationController.GetInstance().SaveInFile();
     PatientController.getInstance().SaveInFile();
     AppointmentController.getInstance().SaveAppointmentsInFile();
     AccountController.GetInstance().SaveInFile();
 }
Пример #7
0
 private void Deserialize()
 {
     EquipmentController.getInstance().loadFromFile();
     RoomController.GetInstance().LoadRoomsFromFile();
     MedicineController.GetInstance().LoadAll();
     DoctorController.getInstance().LoadFromFile();
     NotificationController.GetInstance().LoadFromFile();
     PatientController.getInstance().LoadFromFile();
     AppointmentController.getInstance().LoadAppointmentsFromFile();
     AccountController.GetInstance().LoadFromFile();
 }
Пример #8
0
        public void Notify(Patient patient)
        {
            TimeSpan            dayTime          = new TimeSpan(24, 00, 00);
            TimeSpan            currentTime      = TimeSpan.Parse(DateTime.Now.ToString("HH:mm:ss"));
            List <TimeSpan>     notificationTime = new List <TimeSpan>();
            List <Notification> notifications    = NotificationController.GetInstance().GetNotifications();

            GetEnabledNotificationTimes(notificationTime, notifications);

            CreateNotificationTimers(dayTime, currentTime, notificationTime, patient);
        }
Пример #9
0
        public void DispatcherTimer_Tick(object sender, EventArgs e, Patient patient)
        {
            List <Notification>      notifications = NotificationController.GetInstance().GetNotificationsByPatient(patient);
            CustomNotificationWindow window        = new CustomNotificationWindow();

            for (int i = 0; i < notifications.Count; i++)
            {
                if (DateTime.Now.TimeOfDay.CompareTo(notifications[i].Time.AddSeconds(-1).TimeOfDay) > 0 && DateTime.Now.TimeOfDay.CompareTo(notifications[i].Time.AddSeconds(1).TimeOfDay) < 0)
                {
                    CreateAndShowNotification(notifications[i], window);
                }
            }
        }
Пример #10
0
 public void loadFromFile()
 {
     if (File.Exists("Notifications.dat"))
     {
         FileStream fs = new FileStream("Notifications.dat", FileMode.Open);
         try
         {
             BinaryFormatter formatter = new BinaryFormatter();
             NotificationController.GetInstance().SetNotifications((List <Notification>)formatter.Deserialize(fs));
         }
         catch (SerializationException e)
         {
             throw;
         }
         finally
         {
             fs.Close();
         }
     }
 }
Пример #11
0
 private void DeleteNotificationButton_Click(object sender, RoutedEventArgs e)
 {
     NotificationController.GetInstance().RemoveNotification((Notification)notificationComboBox.SelectedItem);
     PatientMainWindow.GetInstance(_loggedInPatient).Notify();
 }
Пример #12
0
 private void LoadNotificationComboBox()
 {
     notificationComboBox.ItemsSource = NotificationController.GetInstance().GetNotifications();
 }
Пример #13
0
 private static bool NotificationExists(Notification prescriptionNotification)
 {
     return(NotificationController.GetInstance().GetNotifications().Contains(prescriptionNotification));
 }
 public void Notify()
 {
     NotificationController.GetInstance().Notify(_loggedInPatient);
 }