예제 #1
0
        public virtual void Create(User user)
        {
            if (user == null)
                throw new ArgumentNullException("user");

            Dispatcher.Dispatch(AddUser.CreateFrom(user));
            Cache.AddToList(user);
        }
예제 #2
0
 public static AddUser CreateFrom(User user)
 {
     return new AddUser {
         EmailAddress = user.EmailAddress,
         Id = user.Id,
         Name = user.Name,
         UpdatedDate = user.UpdatedDate
     };
 }
 public override void Create(User user)
 {
     Repository.HttpRequestor.Post(ConfigurationProvider.DataServiceLocation + "users", user);
 }
예제 #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
 internal virtual string BuildMessage(string message, User user)
 {
     return user == null ? message : (user.EmailAddress + " - " + message);
 }
예제 #7
0
 public void Warn(string message, User user = null, Exception exception = null)
 {
     Logger.Warn(BuildMessage(message, user), exception);
 }