Esempio n. 1
0
 private void ImplementUserChanges(int entryId, int userId, UserLastChanges changes)
 {
     if (changes.IsNameChanged)
     {
         AddEntry(entryId, userId, changes.NameChange.Value, changes.NameChange.TimeStamp);
     }
     if (changes.IsStateChanged)
     {
         if (changes.StateChange.Value == EntryState.Done)
         {
             MarkDone(entryId, userId, changes.StateChange.TimeStamp);
         }
         else
         {
             MarkUndone(entryId, userId, changes.StateChange.TimeStamp);
         }
     }
     if (changes.IsExistenceChanged)
     {
         if (changes.ExistenceChange.Value == ExistenceState.Added)
         {
             AddEntry(entryId, userId, changes.NameChange.Value, changes.ExistenceChange.TimeStamp);
         }
         else
         {
             RemoveEntry(entryId, userId, changes.ExistenceChange.TimeStamp);
         }
     }
 }
Esempio n. 2
0
 private void InitializeUserChangesToEntry(int entryId, int userId)
 {
     if (!usersLastChangesToEntry.ContainsKey(userId))
     {
         usersLastChangesToEntry[userId] = new Dictionary <int, UserLastChanges>();
     }
     if (!usersLastChangesToEntry[userId].ContainsKey(entryId))
     {
         usersLastChangesToEntry[userId][entryId] = new UserLastChanges();
     }
 }