示例#1
0
        /// <summary>
        /// Gets the raw string (xml) from the broker db by URI
        /// </summary>
        /// <param name="Url">TCM URI of the page</param>
        /// <returns>String with page xml or empty string if no page was found</returns>
        public string GetContentByUri(string uri)
        {
            string retVal = string.Empty;

            //Get the publication ID an the itemID from the TcmUri
            TcmUri tcmUri        = new TcmUri(uri);
            int    publicationID = tcmUri.PublicationId;
            int    pageID        = tcmUri.ItemId;

            using (var pageHome = new Com.Tridion.Broker.Pages.SQLPageHome())
            {
                var data = pageHome.FindByPrimaryKey(publicationID, pageID);

                retVal = data.GetString();
            }
            return(retVal);
        }
        /// <summary>
        /// Gets the raw string (xml) from the broker db by URI
        /// </summary>
        /// <param name="Url">TCM URI of the page</param>
        /// <returns>String with page xml or empty string if no page was found</returns>
        private string GetStringContentFromBrokerByUri(string TcmUri)
        {
            string retVal = string.Empty;

            //Get the publication ID an the itemID from the TcmUri
            using (var tcmUri = new Com.Tridion.Util.TCMURI(TcmUri))
            {
                int publicationID = tcmUri.GetPublicationId();
                int pageID        = tcmUri.GetItemId();

                using (var pageHome = new Com.Tridion.Broker.Pages.SQLPageHome())
                {
                    var data = pageHome.FindByPrimaryKey(publicationID, pageID);

                    retVal = data.GetString();
                }
            }

            return(retVal);
        }
        /// <summary>
        /// Gets the raw string (xml) from the broker db by URL
        /// </summary>
        /// <param name="Url">URL of the page</param>
        /// <returns>String with page xml or empty string if no page was found</returns>
        private string GetStringContentFromBrokerByUrl(string Url, int publicationId)
        {
            string retVal = string.Empty;

            //TODO: Add usings instead of fully classified names
            using (Com.Tridion.Broker.Pages.Meta.SQLPageMetaHome pa = new Com.Tridion.Broker.Pages.Meta.SQLPageMetaHome())
            {
                Com.Tridion.Meta.PageMeta pm = pa.FindByURL(publicationId, Url);
                if (pm == null)
                {
                    return(retVal);
                }
                using (Com.Tridion.Broker.Pages.SQLPageHome pageHome = new Com.Tridion.Broker.Pages.SQLPageHome())
                {
                    Com.Tridion.Data.CharacterData data = pageHome.FindByPrimaryKey(publicationId, pm.GetId());
                    retVal = data.GetString();
                }
            }

            return(retVal);
        }
        /// <summary>
        /// Gets the raw string (xml) from the broker db by URL
        /// </summary>
        /// <param name="Url">URL of the page</param>
        /// <returns>String with page xml or empty string if no page was found</returns>
        public string GetContentByUrl(string Url)
        {
            string retVal = string.Empty;


            //TODO: Add usings instead of fully classified names            
            using (Com.Tridion.Broker.Pages.Meta.SQLPageMetaHome pa = new Com.Tridion.Broker.Pages.Meta.SQLPageMetaHome())
            {
                Com.Tridion.Meta.PageMeta pm = pa.FindByURL(PublicationId, Url);
                if (pm == null) return retVal;
                using (Com.Tridion.Broker.Pages.SQLPageHome pageHome = new Com.Tridion.Broker.Pages.SQLPageHome())
                {
                    Com.Tridion.Data.CharacterData data = pageHome.FindByPrimaryKey(PublicationId, pm.GetId());
                    retVal = data.GetString();
                }
            }

            return retVal;
        }
        /// <summary>
        /// Gets the raw string (xml) from the broker db by URI
        /// </summary>
        /// <param name="Url">TCM URI of the page</param>
        /// <returns>String with page xml or empty string if no page was found</returns>
        public string GetContentByUri(string uri)
        {
            string retVal = string.Empty;

            //Get the publication ID an the itemID from the TcmUri
            TcmUri tcmUri = new TcmUri(uri);
            int publicationID = tcmUri.PublicationId;
            int pageID = tcmUri.ItemId;

            using (var pageHome = new Com.Tridion.Broker.Pages.SQLPageHome())
            {
                var data = pageHome.FindByPrimaryKey(publicationID, pageID);

                retVal = data.GetString();
            }
            return retVal;
        }