private Templ.Domain.DTO.ServiceExport.DTO_Element convertElement(
            Templ.PageElement element,
            Int64 TemplateId, Int64 VersionId)
        {
            if (element == null || element.GetType() == typeof(Templ.ElementVoid))
            {
                return(null);
            }

            Templ.Domain.DTO.ServiceExport.DTO_Element OutElement = new Templ.Domain.DTO.ServiceExport.DTO_Element();
            if (element.GetType() == typeof(Templ.ElementImage))
            {
                Templ.Domain.DTO.ServiceExport.DTO_ElementImage imgel = new Templ.Domain.DTO.ServiceExport.DTO_ElementImage();
                Templ.ElementImage img = (Templ.ElementImage)element;

                imgel.Alignment = img.Alignment;
                imgel.Height    = img.Height;
                imgel.Id        = img.Id;

                if (img.Path.StartsWith("#"))
                {
                    imgel.Path = Templ.Business.ImageHelper.GetImageUrl(img.Path.Remove(0, 1), View.TemplateBaseTempUrl, TemplateId, VersionId);
                }
                else
                {
                    imgel.Path = Templ.Business.ImageHelper.GetImageUrl(img.Path, View.TemplateBaseUrl, TemplateId, VersionId);
                }


                imgel.Width = img.Width;

                OutElement = imgel;
            }
            else if (element.GetType() == typeof(Templ.ElementText))
            {
                Templ.Domain.DTO.ServiceExport.DTO_ElementText txtel = new Templ.Domain.DTO.ServiceExport.DTO_ElementText();
                Templ.ElementText txt = (Templ.ElementText)element;

                txtel.Alignment = txt.Alignment;
                txtel.Id        = txt.Id;
                txtel.IsHTML    = txt.IsHTML;
                txtel.Text      = txt.Text;

                OutElement = txtel;
            }
            else
            {
                return(null);
            }


            return(OutElement);
        }
Beispiel #2
0
        public override PageElement Copy(TemplateVersion TemplateVersion, bool IsActive, Int64 SubVersion, Person Person, string ipAddrees, string IpProxyAddress)
        {
            ElementImage NewEl = new ElementImage();

            NewEl.CreateMetaInfo(Person, ipAddrees, IpProxyAddress);

            //Base
            NewEl.SubVersion      = SubVersion;
            NewEl.IsActive        = IsActive;
            NewEl.TemplateVersion = TemplateVersion;
            NewEl.Position        = this.Position;
            NewEl.Alignment       = this.Alignment;

            //Image
            NewEl.Path   = this.Path;
            NewEl.Width  = this.Width;
            NewEl.Height = this.Height;

            return(NewEl);
        }