Exemple #1
0
        /// <summary>
        /// Gets a collection of all UI templates from the data store. Returns an empty collection if no
        /// items exist.
        /// </summary>
        /// <returns>Returns a collection of all UI templates from the data store.</returns>
        public static IUiTemplateCollection GetUiTemplates()
        {
            IUiTemplateCollection tmpl = new UiTemplateCollection();

            using (var repo = new UiTemplateRepository())
            {
                foreach (var jDto in repo.GetAll(j => j.TemplateAlbums))
                {
                    IUiTemplate t = new UiTemplate
                    {
                        UiTemplateId   = jDto.UiTemplateId,
                        TemplateType   = jDto.TemplateType,
                        GalleryId      = jDto.FKGalleryId,
                        Name           = jDto.Name,
                        Description    = jDto.Description,
                        HtmlTemplate   = jDto.HtmlTemplate,
                        ScriptTemplate = jDto.ScriptTemplate
                    };

                    t.RootAlbumIds.AddRange(from r in jDto.TemplateAlbums select r.FKAlbumId);

                    tmpl.Add(t);
                }
            }

            return(tmpl);
        }
Exemple #2
0
        /// <summary>
        /// Creates a deep copy of this instance. It is not persisted to the data store.
        /// </summary>
        /// <returns>Returns a deep copy of this instance.</returns>
        public IUiTemplate Copy()
        {
            IUiTemplate tmplCopy = new UiTemplate();

            tmplCopy.UiTemplateId   = int.MinValue;
            tmplCopy.TemplateType   = this.TemplateType;
            tmplCopy.GalleryId      = this.GalleryId;
            tmplCopy.Name           = this.Name;
            tmplCopy.Description    = this.Description;
            tmplCopy.RootAlbumIds   = new IntegerCollection(this.RootAlbumIds);
            tmplCopy.HtmlTemplate   = this.HtmlTemplate;
            tmplCopy.ScriptTemplate = this.ScriptTemplate;

            return(tmplCopy);
        }