コード例 #1
0
        public virtual void Create(Event @event)
        {
            if (@event == null)
                throw new ArgumentNullException("@event");

            Dispatcher.Dispatch(AddEvent.CreateFrom(@event));
            Cache.AddToList(@event);
        }
コード例 #2
0
 public static AddEvent CreateFrom(Event @event)
 {
     return new AddEvent {
         Date = @event.Date,
         Id = @event.Id,
         LogId = @event.LogId,
         LogName = @event.LogName,
         UpdatedDate = @event.UpdatedDate,
         UserId = @event.UserId
     };
 }
コード例 #3
0
 public override void Create(Event @event)
 {
     Repository.HttpRequestor.Post(ConfigurationProvider.DataServiceLocation + "events", @event, Repository.SessionManager.GetCurrent());
     Cache.AddToList(@event);
 }
コード例 #4
0
 private void SaveTags(Log log, User user, Event @event, IEnumerable<Tag> tags)
 {
     foreach (var tag in tags)
         TagRepository.Create(new Tag { LogId = log.Id, LogName = log.Name, EventId = @event.Id, Date = @event.Date, Id = Guid.NewGuid(), Name = tag.Name, UserId = user.Id });
 }
コード例 #5
0
 private void SaveMeasurements(User user, Log log, Event @event, IEnumerable<MeasurementData> values)
 {
     foreach (var value in values)
         MeasurementRepository.Create(new Measurement { Id = Guid.NewGuid(), GroupId = value.GroupId == Guid.Empty ? Guid.NewGuid() : value.GroupId, EventId = @event.Id, Date = @event.Date, Name = value.Name, Quantity = value.Quantity, Unit = value.Unit, LogId = log.Id, LogName = log.Name, UserId = user.Id });
 }
コード例 #6
0
 private Event CreateEvent(LogData data, Log log)
 {
     var @event = new Event { Date = data.Date, Id = Guid.NewGuid(), LogId = log.Id, LogName = log.Name, UserId = data.User.Id };
     EventRepository.Create(@event);
     return @event;
 }
コード例 #7
0
 public void Post(Event @event)
 {
     EventRepository.Create(@event);
 }