private void Page_Load(System.Object sender, System.EventArgs e) { CommonApi m_refAPI = new CommonApi(); try { if (m_refAPI.GetCookieValue("site_preview") == "1") { m_refAPI.SetCookieValue("site_preview", "0"); } else { m_refAPI.SetCookieValue("site_preview", "1"); } } catch (Exception) { } finally { m_refAPI = null; } }
public static void SetLanguage(CommonApi api) { int ContentLanguage = -1; if (!(System.Web.HttpContext.Current.Request.QueryString["LangType"] == null)) { if (System.Web.HttpContext.Current.Request.QueryString["LangType"] != "") { ContentLanguage = Convert.ToInt32(System.Web.HttpContext.Current.Request.QueryString["LangType"]); api.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { if (api.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(api.GetCookieValue("LastValidLanguageID")); } } } else { if (api.GetCookieValue("LastValidLanguageID") != "") { ContentLanguage = Convert.ToInt32(api.GetCookieValue("LastValidLanguageID")); } } if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED) { api.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES; } else { api.ContentLanguage = ContentLanguage; } }
public StyleHelper() { m_refAPI = new CommonApi(); string strLangID; strLangID = System.Web.HttpContext.Current.Request.QueryString["LangType"]; if (strLangID != null && Information.IsNumeric(strLangID)) { try { ContentLanguage = Convert.ToInt32(strLangID); } catch (Exception ex) { EkException.LogException(ex, System.Diagnostics.EventLogEntryType.Warning); EkException.WriteToEventLog((string)("Language string was: " + strLangID), System.Diagnostics.EventLogEntryType.Warning); } m_refAPI.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString()); } else { strLangID = m_refAPI.GetCookieValue("LastValidLanguageID"); if (strLangID != null && Information.IsNumeric(strLangID)) { ContentLanguage = Convert.ToInt32(strLangID); } } if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED) { m_refAPI.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES; } else { m_refAPI.ContentLanguage = ContentLanguage; } DisplayTransText = m_refAPI.DisplayTransText; m_refMsg = m_refAPI.EkMsgRef; }