Esempio n. 1
0
 /// <summary>
 /// Gets the layout definition for the layout with the specified ID.
 /// </summary>
 /// <param name="layoutId">
 /// The layout ID.
 /// </param>
 /// <returns>
 /// The layout definition.
 /// </returns>
 public static LayoutDefinition GetLayoutDefinition(Guid?layoutId)
 {
     if (layoutId.HasValue)
     {
         var layout = Layouts.Retrieve(layoutId.Value);
         if (layout != null)
         {
             var definition = new LayoutDefinition()
             {
                 Alias         = layout.Alias,
                 Id            = layout.Id,
                 Name          = layout.Name,
                 LayoutType    = layout.GetLayoutKind().GetType(),
                 Configuration = layout.DeserializeConfiguration()
             };
             return(definition);
         }
     }
     return(null);
 }
 /// <summary>
 /// Gets the entity with the specified ID.
 /// </summary>
 /// <param name="entityId">The ID of the entity.</param>
 /// <returns>
 /// The entity.
 /// </returns>
 public IEntity Retrieve(Guid entityId)
 {
     // Root-level node?
     if (EntityHelper.IsRoot(entityId))
     {
         return(new EntityRoot()
         {
             Id = entityId,
             Path = new[] { entityId },
             Name = EntityHelper.GetNameForRoot(entityId),
             Icon = EntityHelper.GetIconForRoot(entityId)
         });
     }
     else
     {
         // Specific entities (e.g., forms or layouts).
         return(Folders.Retrieve(entityId) as IEntity
                ?? Forms.Retrieve(entityId) as IEntity
                ?? ConfiguredForms.Retrieve(entityId) as IEntity
                ?? Layouts.Retrieve(entityId) as IEntity
                ?? Validations.Retrieve(entityId) as IEntity
                ?? DataValues.Retrieve(entityId) as IEntity);
     }
 }