Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        //private string _TemplateBaseUrl {get;set;}
        //private string _TemplateBaseUrlTemp { get; set; }


        private Templ.Domain.DTO.ServiceExport.DTO_HeaderFooter convertHeaderFooter(
            Templ.PageElement LeftElement,
            Templ.PageElement CenterElement,
            Templ.PageElement RightElement,
            Int64 TemplateId, Int64 VersionId)
        {
            Templ.Domain.DTO.ServiceExport.DTO_HeaderFooter HeadFoot = new Templ.Domain.DTO.ServiceExport.DTO_HeaderFooter();
            HeadFoot.Left   = convertElement(LeftElement, TemplateId, VersionId);
            HeadFoot.Center = convertElement(CenterElement, TemplateId, VersionId);
            HeadFoot.Right  = convertElement(RightElement, TemplateId, VersionId);

            return(HeadFoot);
        }