Пример #1
0
        public void PatientArrived(int appointmentId, string time)
        {
            var appointment = this.db.Appointments.FirstOrDefault(p => p.Id == appointmentId);

            if (appointment == null)
            {
                return;
            }

            appointment.Status = (int)TypeAppointmentStatus.Accomplished;

            Debug.Assert(appointment.PatientId != null, "appointment.PatientId != null");
            var notificationData = new PatientArrivedNotificationData()
            {
                PatientId          = appointment.PatientId.Value,
                PatientName        = appointment.Patient.Person.FullName,
                Time               = time,
                PracticeIdentifier = appointment.Practice.UrlIdentifier,
                DoctorIdentifier   = appointment.Doctor.UrlIdentifier
            };

            var notificationDataString = new JavaScriptSerializer().Serialize(notificationData);

            var newNotification = new Notification()
            {
                CreatedOn  = DateTime.UtcNow,
                IsClosed   = false,
                UserToId   = appointment.DoctorId,
                Type       = NotificationConstants.PATIENT_ARRIVED_NOTIFICATION_TYPE,
                PracticeId = appointment.PracticeId,
                Data       = notificationDataString
            };

            this.db.Notifications.AddObject(newNotification);

            this.db.SaveChanges();

            BroadcastDbNotification(newNotification, notificationData);
        }
Пример #2
0
        public void PatientArrived(int appointmentId, string time)
        {
            var appointment = this.db.Appointments.FirstOrDefault(p => p.Id == appointmentId);
            if (appointment == null)
                return;

            appointment.Status = (int)TypeAppointmentStatus.Accomplished;

            Debug.Assert(appointment.PatientId != null, "appointment.PatientId != null");
            var notificationData = new PatientArrivedNotificationData()
                {
                    PatientId = appointment.PatientId.Value,
                    PatientName = appointment.Patient.Person.FullName,
                    Time = time,
                    PracticeIdentifier = appointment.Practice.UrlIdentifier,
                    DoctorIdentifier = appointment.Doctor.UrlIdentifier
                };

            var notificationDataString = new JavaScriptSerializer().Serialize(notificationData);

            var newNotification = new Notification()
                {
                    CreatedOn = DateTime.UtcNow,
                    IsClosed = false,
                    UserToId = appointment.DoctorId,
                    Type = NotificationConstants.PATIENT_ARRIVED_NOTIFICATION_TYPE,
                    PracticeId = appointment.PracticeId,
                    Data = notificationDataString
                };

            this.db.Notifications.AddObject(newNotification);

            this.db.SaveChanges();

            BroadcastDbNotification(newNotification, notificationData);
        }