Example #1
0
        /// <summary>
        /// Create an entity.
        /// </summary>
        /// <param name="entityRow">The description of the entity.</param>
        public Entity(EntityRow entityRow)
        {
            // Initialize the object
            this.createdTime      = entityRow.CreatedTime.ToLocalTime();
            this.description      = entityRow.IsDescriptionNull() ? String.Empty : entityRow.Description;
            this.entityId         = entityRow.EntityId;
            this.modifiedTime     = entityRow.ModifiedTime.ToLocalTime();
            this.name             = entityRow.Name;
            this.imageId          = entityRow.ImageId;
            this.imageData        = entityRow.ImageRow.Image;
            this.isReadOnly       = entityRow.IsReadOnly;
            this.isHidden         = entityRow.IsHidden;
            this.rowVersion       = entityRow.RowVersion;
            this.tenantId         = entityRow.TenantId;
            this.typeId           = entityRow.TypeId;
            this.typeName         = entityRow.TypeRow.Description;
            this.viewerType       = entityRow.TypeRow.ViewerType;
            this.propertiesWindow = null;

            if (this.NeedLateLoad())
            {
                this.finishedLoading = false;
                DataModel.EndMerge  += this.FinishLateLoad;
            }
            else
            {
                this.finishedLoading = true;
                this.FinishLoad();
            }
        }
Example #2
0
        /// <summary>
        /// Update the Entity based on an EntityRow.
        /// </summary>
        /// <param name="entityRow">The row to update from.</param>
        public virtual void Update(EntityRow entityRow)
        {
            if (!this.Modified && entityRow.EntityId == this.EntityId)
            {
                this.CreatedTime  = entityRow.CreatedTime.ToLocalTime();
                this.Description  = entityRow.IsDescriptionNull() ? String.Empty : entityRow.Description;
                this.ModifiedTime = entityRow.ModifiedTime.ToLocalTime();
                this.Name         = entityRow.Name;
                this.ImageId      = entityRow.ImageId;
                this.ImageData    = entityRow.ImageRow.Image;
                this.IsReadOnly   = entityRow.IsReadOnly;
                this.IsHidden     = entityRow.IsHidden;
                this.viewerType   = entityRow.TypeRow.ViewerType;
                this.typeId       = entityRow.TypeId;
                this.typeName     = entityRow.TypeRow.Description;
                this.Modified     = false;
            }

            this.rowVersion = entityRow.RowVersion;
        }