private void RecordAll(bool removeExceedingState = true)
        {
            ++CurrentTimeStamp;
            if (TimeStampTime.Count >= CurrentTimeStamp + 1)
            {
                TimeStampTime[CurrentTimeStamp] = FakeTime;
            }
            else
            {
                TimeStampTime.Add(FakeTime);
            }
            var listNode = Rewindables.First;

            while (listNode != null)
            {
                var node        = listNode.Value;
                var curListNode = listNode;
                listNode = listNode.Next;
                if (node == null)
                {
                    Rewindables.Remove(curListNode);
                    continue;
                }
                TimeScribe.EnterNode(ScribeMode.Probe, null);
                node.ExposeTimeData();
                byte[] state = new byte[TimeScribe.ProbeRes];
                TimeScribe.EnterNode(ScribeMode.Record, state);
                node.ExposeTimeData();
                node.GetTimeStateContainer.AddTimeState(state, CurrentTimeStamp);
                if (removeExceedingState)
                {
                    node.GetTimeStateContainer.RemoveStatesBefore(EarliestExistingTimeState);
                }
                TimeScribe.ExitNode();
            }
        }
Пример #2
0
        public DomainEvent GetDomainEvent()
        {
            switch (DomainEventType)
            {
            case EventType.Added:
            {
                return(new AppointmentAdded(AggregateId.GetAggregateIdentifier(),
                                            AggregateVersion,
                                            UserId,
                                            new Tuple <Date, Time>(TimeStampDate.GetDate(), TimeStampTime.GetTime()),
                                            ActionTag,
                                            PatientId,
                                            Description,
                                            StartTime.GetTime(),
                                            EndTime.GetTime(),
                                            TherapyPlaceId.Value,
                                            LabelId.Value,
                                            AppointmentId.Value));
            }

            case EventType.Replaced:
            {
                return(new AppointmentReplaced(AggregateId.GetAggregateIdentifier(),
                                               AggregateVersion,
                                               UserId,
                                               PatientId,
                                               new Tuple <Date, Time>(TimeStampDate.GetDate(), TimeStampTime.GetTime()),
                                               ActionTag,
                                               NewDescription,
                                               NewDate.GetDate(),
                                               NewStartTime.GetTime(),
                                               NewEndTime.GetTime(),
                                               NewTherapyPlaceId.Value,
                                               NewLabelId.Value,
                                               OriginalAppointmendId.Value));
            }

            case EventType.Removed:
            {
                return(new AppointmentDeleted(AggregateId.GetAggregateIdentifier(),
                                              AggregateVersion,
                                              UserId,
                                              PatientId,
                                              new Tuple <Date, Time>(TimeStampDate.GetDate(), TimeStampTime.GetTime()),
                                              ActionTag,
                                              RemovedAppointmentId.Value));
            }
            }
            throw new Exception("inner error");
        }