private ChangedData FormatSpecialStaticChangedValue(StaticDataSlot slot, object oldValue, object newValue) { string name = null; switch (slot) { case StaticDataSlot.CreatedById: name = "CreatedBy"; break; case StaticDataSlot.ModifiedById: name = "ModifiedBy"; break; case StaticDataSlot.VersionCreatedById: name = "VersionCreatedBy"; break; case StaticDataSlot.VersionModifiedById: name = "VersionModifiedBy"; break; case StaticDataSlot.LockedById: name = "LockedBy"; break; } if (name == null) { return(null); } return(new ChangedData { Name = name, Original = FormatUser((int)oldValue), Value = FormatUser((int)newValue) }); }
private object Get(StaticDataSlot slot) { int index = (int)slot; if (SharedData == null || staticDataIsModified[index]) { return(staticData[index]); } return(SharedData.staticData[index]); }
private void Set(StaticDataSlot slot, object value) { if (IsShared) { throw Exception_SharedIsReadOnly(); } int index = (int)slot; staticData[index] = value; staticDataIsModified[index] = true; }
private void Set <T>(StaticDataSlot slot, T value) where T : IComparable { if (SharedData != null) { var index = (int)slot; var sharedValue = (T)SharedData.staticData[index]; if (value.CompareTo(sharedValue) == 0) { Reset(index); return; } } Set(slot, (object)value); }
private string FormatStaticData(object data, StaticDataSlot slot) { switch (slot) { case StaticDataSlot.Id: case StaticDataSlot.NodeTypeId: case StaticDataSlot.ContentListId: case StaticDataSlot.ContentListTypeId: case StaticDataSlot.ParentId: case StaticDataSlot.Name: case StaticDataSlot.DisplayName: case StaticDataSlot.Path: case StaticDataSlot.Index: case StaticDataSlot.VersionId: case StaticDataSlot.Version: case StaticDataSlot.ETag: case StaticDataSlot.LockType: case StaticDataSlot.LockTimeout: case StaticDataSlot.LockToken: return(data == null ? String.Empty : data.ToString()); case StaticDataSlot.IsDeleted: case StaticDataSlot.IsInherited: case StaticDataSlot.Locked: case StaticDataSlot.IsSystem: return(data.ToString().ToLower()); case StaticDataSlot.CreatedById: case StaticDataSlot.ModifiedById: case StaticDataSlot.VersionCreatedById: case StaticDataSlot.VersionModifiedById: case StaticDataSlot.LockedById: case StaticDataSlot.ClosestSecurityNodeId: case StaticDataSlot.SavingState: return(data.ToString()); case StaticDataSlot.CreationDate: case StaticDataSlot.ModificationDate: case StaticDataSlot.VersionCreationDate: case StaticDataSlot.VersionModificationDate: case StaticDataSlot.LockDate: case StaticDataSlot.LastLockUpdate: return(FormatDate((DateTime)data)); default: return(string.Empty); } }
private void Set(StaticDataSlot slot, object value) { if (IsShared) { throw Exception_SharedIsReadOnly(); } int index = (int)slot; // This conversion makes sure that the date we handle is in UTC format (e.g. if // the developer provides DateTime.Now, which is in local time by default). if (value is DateTime) { value = ConvertToUtcDateTime((DateTime)value); } staticData[index] = value; staticDataIsModified[index] = true; }
private T Get <T>(StaticDataSlot slot) { var value = Get(slot); return((value == null) ? default(T) : (T)value); }