コード例 #1
0
 public AdminNote Clone()
 {
     return(new AdminNote()
     {
         CreatedBy = CreatedBy.Clone(),
         CreationDate = CreationDate,
         Id = Id,
         LastUpdatedBy = LastUpdatedBy,
         LastUpdatedDate = LastUpdatedDate,
         Note = Note
     });
 }
コード例 #2
0
ファイル: StateSet.cs プロジェクト: chandusekhar/DeviceAdmin
        public StateSet Clone(bool newId = false, EntityHeader org = null, EntityHeader user = null)
        {
            var stateSet = new StateSet()
            {
                CreatedBy         = CreatedBy.Clone(),
                LastUpdatedBy     = LastUpdatedBy.Clone(),
                OwnerOrganization = OwnerOrganization.Clone(),

                CreationDate    = CreationDate,
                DatabaseName    = DatabaseName,
                Description     = Description,
                EntityType      = EntityType,
                Id              = newId ? Guid.NewGuid().ToId() : Id,
                IsLocked        = IsLocked,
                IsPublic        = IsPublic,
                IsValid         = IsValid,
                Key             = Key,
                LastUpdatedDate = LastUpdatedDate,
                LockedBy        = LockedBy.Clone(),
                LockedDateStamp = LockedDateStamp,
                Name            = Name,
                OwnerUser       = OwnerUser.Clone(),
                RequireEnum     = RequireEnum,
            };

            if (OwnerUser != null)
            {
                stateSet.OwnerUser = user == null?OwnerUser.Clone() : user;
            }

            if (IsLocked)
            {
                stateSet.LockedBy = user == null?LockedBy.Clone() : user;
            }


            foreach (var state in States)
            {
                stateSet.States.Add(state.Clone());
            }

            return(stateSet);
        }
コード例 #3
0
        public UnitSet Clone(bool newId = false, EntityHeader org = null, EntityHeader user = null)
        {
            var unitSet = new UnitSet()
            {
                CreatedBy         = user ?? CreatedBy.Clone(),
                OwnerOrganization = org ?? OwnerOrganization.Clone(),
                LastUpdatedBy     = user ?? LastUpdatedBy.Clone(),

                CreationDate    = CreationDate,
                DatabaseName    = DatabaseName,
                Description     = Description,
                EntityType      = EntityType,
                Id              = newId ? Guid.NewGuid().ToId() : Id,
                IsLocked        = IsLocked,
                IsPublic        = IsPublic,
                IsValid         = IsValid,
                Key             = Key,
                LastUpdatedDate = LastUpdatedDate,
                LockedDateStamp = LockedDateStamp,
                Name            = Name,
                Notes           = CloneNotes(),
            };

            if (OwnerUser != null)
            {
                unitSet.OwnerUser = user ?? OwnerUser.Clone();
            }

            if (IsLocked)
            {
                unitSet.LockedBy = user ?? LockedBy.Clone();
            }

            foreach (var unit in Units)
            {
                unitSet.Units.Add(unit.Clone());
            }

            return(unitSet);
        }