Пример #1
0
 public void UpdateExistenceChange(ExistenceState state, long timestamp)
 {
     if (!IsExistenceChanged || ExistenceChange.TimeStamp < timestamp ||
         ExistenceChange.TimeStamp == timestamp && state == ExistenceState.Removed)
     {
         ExistenceChange = new Change <ExistenceState>(state, timestamp);
     }
 }
Пример #2
0
 private void UpdateUserExistenceChangeToEntry(int entryId, int userId, ExistenceState existenceState, long timestamp)
 {
     if (IsNewUser(userId))
     {
         throw new Exception(string.Format("Can't update changes of not initialized user {}", userId));
     }
     if (!HasUserDoneAnyChangesToEntry(entryId, userId))
     {
         InitializeUserChangesToEntry(entryId, userId);
     }
     if (usersLastChangesToEntry[userId][entryId].IsExistenceChanged &&
         entriesChanges[entryId].ExistenceChanges.ContainsChangeByUser(userId, usersLastChangesToEntry[userId][entryId].ExistenceChange))     //BAD!!!!
     {
         entriesChanges[entryId].ExistenceChanges.ClearChange(userId, usersLastChangesToEntry[userId][entryId].ExistenceChange);
     }
     usersLastChangesToEntry[userId][entryId].UpdateExistenceChange(existenceState, timestamp);
 }