Exemple #1
0
        public DomainEventSerializationDouble(AppointmentReplaced appointmentReplacedEvent)
            : this((DomainEvent)appointmentReplacedEvent)
        {
            DomainEventType = EventType.Replaced;

            NewDescription        = appointmentReplacedEvent.NewDescription;
            NewDate               = new DateSerializationDouble(appointmentReplacedEvent.NewDate);
            NewStartTime          = new TimeSerializationDouble(appointmentReplacedEvent.NewStartTime);
            NewEndTime            = new TimeSerializationDouble(appointmentReplacedEvent.NewEndTime);
            NewTherapyPlaceId     = appointmentReplacedEvent.NewTherapyPlaceId;
            NewLabelId            = appointmentReplacedEvent.NewLabelId;
            OriginalAppointmendId = appointmentReplacedEvent.OriginalAppointmendId;
        }
        private static void WriteEvent(XmlWriter writer, AppointmentReplaced @event)
        {
            writer.WriteStartElement(AppointmentReplacedEvent);

            writer.WriteAttributeString(DescriptionAttribute, @event.NewDescription);
            writer.WriteAttributeString(DateAttribute, @event.NewDate.ToString());
            writer.WriteAttributeString(StartTimeAttribute, @event.NewStartTime.ToString());
            writer.WriteAttributeString(EndTimeAttribute, @event.NewEndTime.ToString());
            writer.WriteAttributeString(TherapyPlaceIdAttribute, @event.NewTherapyPlaceId.ToString());
            writer.WriteAttributeString(LabelIdAttribute, @event.NewLabelId.ToString());
            writer.WriteAttributeString(OriginalAppointmentIdAttribute, @event.OriginalAppointmendId.ToString());

            writer.WriteEndElement();
        }
        private bool TryToReplaceEvent(AppointmentReplaced replacedEvent)
        {
            if (eventStreamAggregator.AppointmentData.All(appointment => appointment.Id != replacedEvent.OriginalAppointmendId))
            {
                return(false);
            }

            return(eventStreamAggregator
                   .AppointmentData
                   .Where(appointment => appointment.TherapyPlaceId == replacedEvent.NewTherapyPlaceId)
                   .Where(appointment => appointment.Id != replacedEvent.OriginalAppointmendId)
                   .All(appointment => (appointment.StartTime <= replacedEvent.NewStartTime || appointment.StartTime >= replacedEvent.NewEndTime) &&
                        (appointment.EndTime <= replacedEvent.NewStartTime || appointment.EndTime >= replacedEvent.NewEndTime)));
        }
Exemple #4
0
        private void HandleReplacedEvent(AppointmentReplaced replacedEvent)
        {
            var originalAppointment = AppointmentData.First(appointment => appointment.Id == replacedEvent.OriginalAppointmendId);

            AppointmentData.Remove(originalAppointment);
            AppointmentData.Add(new AppointmentTransferData(originalAppointment.PatientId,
                                                            replacedEvent.NewDescription,
                                                            replacedEvent.NewDate,
                                                            replacedEvent.NewStartTime,
                                                            replacedEvent.NewEndTime,
                                                            replacedEvent.NewTherapyPlaceId,
                                                            originalAppointment.Id,
                                                            originalAppointment.MedicalPracticeId,
                                                            replacedEvent.NewLabelId));
        }
Exemple #5
0
        public override void Process(AppointmentReplaced domainEvent)
        {
            if (domainEvent.PatientId != patientId)
            {
                return;
            }

            appointmentSet.ReplaceAppointment(domainEvent.NewDescription,
                                              domainEvent.NewDate,
                                              domainEvent.NewStartTime,
                                              domainEvent.NewEndTime,
                                              domainEvent.NewTherapyPlaceId,
                                              domainEvent.NewLabelId,
                                              domainEvent.OriginalAppointmendId);
        }
        public override void Process(AppointmentReplaced domainEvent)
        {
            if (domainEvent.AggregateId != Identifier)
            {
                return;
            }

            if (AggregateVersion != domainEvent.AggregateVersion)
            {
                throw new VersionNotApplicapleException("@handle appointmentReplaced @readmodel");
            }

            appointmentSet.ReplaceAppointment(domainEvent.NewDescription,
                                              domainEvent.NewDate,
                                              domainEvent.NewStartTime,
                                              domainEvent.NewEndTime,
                                              domainEvent.NewTherapyPlaceId,
                                              domainEvent.NewLabelId,
                                              domainEvent.OriginalAppointmendId,
                                              errorCallback);

            AggregateVersion = domainEvent.AggregateVersion + 1;
        }
Exemple #7
0
 public abstract void Process(AppointmentReplaced domainEvent);