コード例 #1
0
        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)
            });
        }
コード例 #2
0
        private object Get(StaticDataSlot slot)
        {
            int index = (int)slot;

            if (SharedData == null || staticDataIsModified[index])
            {
                return(staticData[index]);
            }
            return(SharedData.staticData[index]);
        }
コード例 #3
0
ファイル: NodeData.cs プロジェクト: pchaozhong/FlexNet
        private void Set(StaticDataSlot slot, object value)
        {
            if (IsShared)
            {
                throw Exception_SharedIsReadOnly();
            }
            int index = (int)slot;

            staticData[index]           = value;
            staticDataIsModified[index] = true;
        }
コード例 #4
0
ファイル: NodeData.cs プロジェクト: pchaozhong/FlexNet
 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);
 }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        private T Get <T>(StaticDataSlot slot)
        {
            var value = Get(slot);

            return((value == null) ? default(T) : (T)value);
        }