Exemple #1
0
        public MasterPage GetMasterPage()
        {
            if (this.MasterPage != null)
            {
                return(MasterPage);
            }

            if (this.MediaType.MasterPage == null)
            {
                return(SettingsMapper.GetSettings().DefaultMasterPage);
            }

            return(this.MediaType.MasterPage);

            /*MediaDetail currentMediaDetail = (MediaDetail)this.Media.ParentMedia?.MediaDetails.FirstOrDefault(i=>i.HistoryVersionNumber == 0 && i.LanguageID == this.LanguageID);
             *
             * while (currentMediaDetail != null)
             * {
             *  if (currentMediaDetail.MasterPage != null)
             *      return currentMediaDetail.MasterPage;
             *
             *  currentMediaDetail = (MediaDetail)currentMediaDetail.Media.ParentMedia?.MediaDetails.FirstOrDefault(i => i.HistoryVersionNumber == 0 && i.LanguageID == this.LanguageID);
             * }
             *
             * return MasterPage;*/
        }
Exemple #2
0
        public static Language GetDefaultLanguage()
        {
            var language = ContextHelper.GetFromRequestContext("GetDefaultLanguage");

            if (language != null)
            {
                return((Language)language);
            }

            var settings = SettingsMapper.GetSettings();

            language = settings.DefaultLanguage;

            if (language == null && settings.DefaultLanguageID > 0)
            {
                language = LanguagesMapper.GetByID(settings.DefaultLanguageID);
            }

            ContextHelper.SetToRequestContext("GetDefaultLanguage", language);

            return((Language)language);
        }
        public static Return SaveToCache(string url, string html)
        {
            try
            {
                url = url.ToLower();
                IDatabase cache     = Connection.GetDatabase();
                var       returnVal = cache.StringSet(url, html, TimeSpan.FromSeconds(SettingsMapper.GetSettings().OutputCacheDurationInSeconds));

                return(new Return());
            }
            catch (Exception ex)
            {
                ErrorHelper.LogException(ex);
                return(new Return(ex, ErrorHelper.CreateError(ex)));
            }
        }
 public static MasterPage GetDefaultMasterPage()
 {
     return(SettingsMapper.GetSettings().DefaultMasterPage);
 }