protected override void OnInit(EventArgs e) { int LayoutID = CommonLogic.QueryStringNativeInt("layoutid"); ThisLayout = new LayoutData(LayoutID); if (ThisLayout != null) { bool exists = CommonLogic.FileExists(ThisLayout.LayoutFile); if (!exists) { exists = ThisLayout.CreateLayoutControl(); } if (exists) { Control ctrl = LoadControl("layouts/" + ThisLayout.LayoutID.ToString() + "/" + ThisLayout.Name + "_" + ThisLayout.Version.ToString() + ".ascx"); pnlLayout.Controls.Add(ctrl); } } base.OnInit(e); }
/// <summary> /// Override JeldWen Master Template /// </summary> protected override string OverrideTemplate() { String MasterHome = AppLogic.HomeTemplate(); if (MasterHome.Trim().Length == 0) { MasterHome = "JeldWenTemplate"; } if (MasterHome.EndsWith(".ascx")) { MasterHome = MasterHome.Replace(".ascx", ".master"); } if (!MasterHome.EndsWith(".master", StringComparison.OrdinalIgnoreCase)) { MasterHome = MasterHome + ".master"; } if (!CommonLogic.FileExists(CommonLogic.SafeMapPath("~/App_Templates/Skin_" + base.SkinID.ToString() + "/" + MasterHome))) { MasterHome = "JeldWenTemplate"; } return(MasterHome); }
/// <summary> /// Displays the information of the downloadable item /// </summary> /// <param name="download"></param> private void DisplayDownloadInfo(DownloadableItem download) { if (null != download) { lblDownloadIdCaption.Text = string.Format("Download Id : {0}", download.DownloadId); if (CommonLogic.FileExists(string.Format("images/icon/{0}.png", download.Extension))) { imgFileType.ImageUrl = string.Format("images/icon/{0}.png", download.Extension); } else { imgFileType.ImageUrl = "images/icon/defaultfile.png"; } lblFileNameCaption.Text = string.Format("File Name: {0}", download.FileName); lblContentType.Text = string.Format("Content Type: {0}", download.ContentType); lblDownloadCaption.Text = string.Format("This file has been downloaded {0} times", download.GetNumberOfDownloads()); lblDownloadSize.Text = string.Format("File size: {0} kb", download.ContentLength); if (download.IsPhysicalFileExisting()) { lblActiveCaption.Text = string.Format("This file is {0}", download.IsActive ? "active" : "inactive"); } else { lblActiveCaption.Text = "This file is missing!!!"; } pnlInfo.Visible = true; } else { pnlInfo.Visible = false; } }
Image GetImage(string imagePath, string copyrightImageUrl, string copyrightText) { var image = CommonLogic.LoadImage(imagePath); // If copyright image and text are not specified, return the original image untouched. if (string.IsNullOrEmpty(copyrightImageUrl) && string.IsNullOrEmpty(copyrightText)) { return(image); } // Favor the copyright image over text. if (!string.IsNullOrEmpty(copyrightImageUrl) && CommonLogic.FileExists(copyrightImageUrl)) { copyrightText = string.Empty; } try { return(CommonLogic.AddWatermark(image, copyrightText, copyrightImageUrl)); } catch (Exception ex) { SysLog.LogException(ex, MessageTypeEnum.GeneralException, MessageSeverityEnum.Error); return(null); } }
protected void gMain_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView myrow = (DataRowView)e.Row.DataItem; //set delete and action confirms ImageButton iD = (ImageButton)e.Row.FindControl("imgDelete"); iD.Attributes.Add("onClick", string.Format( "javascript: return confirm('{0}');", string.Format(DeletePrompt, myrow["VariantID"]) )); LinkButton lCc = (LinkButton)e.Row.FindControl("lnkClone"); lCc.Attributes.Add("onClick", string.Format("javascript: return confirm('{0}')", ClonePrompt)); //Name and Image Literal ltName = (Literal)e.Row.FindControl("ltName"); ltName.Text += ("<a href=\"" + AppLogic.AdminLinkUrl("entityEditProductVariant.aspx") + "?ProductID=" + pID + "&entityname=" + eName + "&EntityID=" + eID + "&Variantid=" + myrow["VariantID"].ToString() + "\">" + CommonLogic.IIF(XmlCommon.GetLocaleEntry(myrow["Name"].ToString(), ThisCustomer.LocaleSetting, true).Length == 0, "(Unnamed Variant)", XmlCommon.GetLocaleEntry(myrow["Name"].ToString(), ThisCustomer.LocaleSetting, true)) + "</a>"); Literal ltImage = (Literal)e.Row.FindControl("ltImage"); String Image1URL = AppLogic.LookupImage("Variant", Localization.ParseNativeInt(myrow["VariantID"].ToString()), "icon", SiteID, ThisCustomer.LocaleSetting); if (!CommonLogic.FileExists(Image1URL)) { Image1URL = AppLogic.LocateImageURL("~/App_Themes/Admin_Default/images/nopictureicon.gif", ThisCustomer.LocaleSetting); } ltImage.Text = "<img src=\"" + Image1URL + "\" width=\"25\" border=\"0\" align=\"absmiddle\">"; //SKU Literal ltSKU = (Literal)e.Row.FindControl("ltSKU"); ltSKU.Text = ProductSKU + myrow["SKUSuffix"].ToString(); //Price Literal ltPrice = (Literal)e.Row.FindControl("ltPrice"); ltPrice.Text = Localization.CurrencyStringForDisplayWithoutExchangeRate(Localization.ParseNativeDecimal(myrow["Price"].ToString())); ltPrice.Text += CommonLogic.IIF(Localization.ParseNativeDecimal(myrow["SalePrice"].ToString()) != System.Decimal.Zero, "<br/><span style=\"font-weight: bold; color: red;\">" + Localization.CurrencyStringForDisplayWithoutExchangeRate(Localization.ParseNativeDecimal(myrow["SalePrice"].ToString())) + "</span>", " "); //Inventory Literal ltInventory = (Literal)e.Row.FindControl("ltInventory"); if (AppLogic.ProductTracksInventoryBySizeAndColor(Localization.ParseNativeInt(myrow["ProductID"].ToString()))) { ltInventory.Text = ("<a href=\"" + AppLogic.AdminLinkUrl("entityEditInventory.aspx") + "?productid=" + myrow["ProductID"].ToString() + "&Variantid=" + myrow["VariantID"].ToString() + "&entityname=" + eName + "&EntityID=" + eID + "\">" + AppLogic.GetString("admin.common.Inventory", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + "</a>\n"); } else { ltInventory.Text = (myrow["Inventory"].ToString()); } //Display Order Literal ltDisplayOrder = (Literal)e.Row.FindControl("ltDisplayOrder"); ltDisplayOrder.Text = "<input size=2 type=\"text\" name=\"DisplayOrder_" + myrow["VariantID"].ToString() + "\" value=\"" + Localization.ParseNativeInt(myrow["DisplayOrder"].ToString()) + "\">"; //Default Variant Literal ltDefault = (Literal)e.Row.FindControl("ltDefault"); ltDefault.Text = "<input type=\"radio\" name=\"IsDefault\" value=\"" + myrow["VariantID"].ToString() + "\" " + CommonLogic.IIF(myrow["IsDefault"].ToString() == "1", " checked ", "") + ">"; } }
string GetImagePath(string imageUrl) { var imagePath = Request.MapPath(imageUrl); return(CommonLogic.FileExists(imagePath) ? imagePath : null); }
public ISESiteMapProvider GetProvider(string locale) { locale = locale.ToLowerInvariant(); // check if the appconfig:ShowStringresourceKeys is on if (AppLogic.AppConfigBool("ShowStringResourceKeys") == true) { return(new ISESiteMapProvider(locale)); } ISESiteMapProvider provider = null; string key = MenuKey(locale); if (AppLogic.CachingOn) { provider = HttpRuntime.Cache.Get(key) as ISESiteMapProvider; } if (provider == null) { provider = new ISESiteMapProvider(locale); } if (provider != null && AppLogic.CachingOn) { if (HttpContext.Current != null && provider != null && HttpRuntime.Cache.Get(key) == null) { string menuPackage = CommonLogic.SafeMapPath(string.Format("~/xmlpackages/{0}", _xmlPackage)); if (CommonLogic.FileExists(menuPackage)) { CacheDependency fileDependency = new CacheDependency(menuPackage); HttpRuntime.Cache.Add(key, provider, fileDependency, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), Cache.NoSlidingExpiration, CacheItemPriority.High, null); if (!_cacheKeys.Contains(key)) { _cacheKeys.Add(key); } } } } return(provider); }
private void Page_Load(object sender, System.EventArgs e) { String Channel = CommonLogic.QueryStringCanBeDangerousContent("Channel").ToLowerInvariant(); if (Channel.Length == 0 || !CommonLogic.FileExists("XmlPackages/rss." + Channel + ".xml.config")) { Channel = "unknown"; } Response.ContentEncoding = System.Text.Encoding.UTF8; Response.ContentType = "text/xml"; Response.Write(AppLogic.RunXmlPackage("rss." + Channel + ".xml.config", null, null, 1, string.Empty, string.Empty, false, false)); }
public ActionResult Index(string channel) { if (string.IsNullOrEmpty(channel) || !CommonLogic.FileExists(string.Format("xmlpackages/rss.{0}.xml.config", channel))) { channel = "unknown"; } var xmlPackage = new XmlPackage(string.Format("rss.{0}", channel)); var customer = HttpContext.GetCustomer(); var packageOutput = AppLogic.RunXmlPackage(xmlPackage, null, customer, customer.SkinID, true, false); Response.ContentType = "text/xml"; return(Content(packageOutput)); }
private void LoadMenu(String ctrlToLoad, String localeSetting, bool isDefaultMenu) { String ctrlName = AppLogic.AdminLinkUrl("Controls/" + ctrlToLoad, true); Literal litError = new Literal(); litError.Mode = LiteralMode.PassThrough; litError.Text = AppLogic.GetString("admin.menu.loaderror", localeSetting); // couldn't find the default menu...log try { if (!CommonLogic.FileExists(ctrlName) && isDefaultMenu) { pnlMenu.Controls.Add(litError); // no menu file found...log SysLog.LogMessage("File Not Found", "Unable to load menu control {0}.".FormatWith(ctrlToLoad), MessageTypeEnum.GeneralException, MessageSeverityEnum.Error); } else if (CommonLogic.FileExists(ctrlName)) { try { pnlMenu.Controls.Add(LoadControl(ctrlName)); } catch { // no menu file found...log SysLog.LogMessage("File Not Found", "Unable to load menu control {0}.".FormatWith(ctrlToLoad), MessageTypeEnum.GeneralException, MessageSeverityEnum.Error); } } else { // couldn't load a custom menu so display an error message to the user and log rather than showing // an entire menu to an admin user that maybe shouldn't see it pnlMenu.Controls.Add(litError); // no menu file found...log SysLog.LogMessage("File Not Found", "Unable to load menu control {0}.".FormatWith(ctrlToLoad), MessageTypeEnum.GeneralException, MessageSeverityEnum.Error); } } catch (Exception ex) { SysLog.LogException(ex, MessageTypeEnum.GeneralException, MessageSeverityEnum.Error); pnlMenu.Controls.Add(litError); } }
public static string XmlPackageHook(string xmlPackage, Customer thisCustomer) { if (xmlPackage == "") { xmlPackage = "entity.DNE.xml.config"; } // check for the mobile skin, if not return the default xml package. if (!MobileHelper.isMobile()) { return(xmlPackage); } MobileXmlPackageType mobileType = MobileXmlPackageType.None; // Strip prefix from xml package name. if (xmlPackage.StartsWith(MobileXmlPackageType.Product.ToString(), StringComparison.InvariantCultureIgnoreCase)) { mobileType = MobileXmlPackageType.Product; } else if (xmlPackage.StartsWith(MobileXmlPackageType.Entity.ToString(), StringComparison.InvariantCultureIgnoreCase)) { mobileType = MobileXmlPackageType.Entity; } string mobileXmlPackage = string.Format("mobile.{0}", xmlPackage); string urlPath = string.Format("~/App_Templates/Skin_{0}/XmlPackages/{1}", thisCustomer.SkinID, mobileXmlPackage); string fileName = HttpContext.Current.Server.MapPath(urlPath); // Test for existance of xml package. if (!CommonLogic.FileExists(fileName)) { urlPath = string.Format("~/XmlPackages/{1}", thisCustomer.SkinID, mobileXmlPackage); fileName = HttpContext.Current.Server.MapPath(urlPath); if (!CommonLogic.FileExists(fileName)) { return(DefaultXmlPackage(xmlPackage, mobileType)); } } // we found a matching package, so return the name return(mobileXmlPackage); }
public override void DataBind() { if (this.AddMode) { txtName.Text = String.Empty; txtDescription.Text = String.Empty; txtLayout.Text = String.Empty; } else { if (thisLayout == null) { thisLayout = this.Datasource; } if (thisLayout != null) { txtName.Text = thisLayout.Name; txtDescription.Text = thisLayout.Description; txtLayout.Text = XmlCommon.PrettyPrintXml(thisLayout.HTML); string tImage = "~/images/layouts/icon/" + thisLayout.Icon; string lImage = "~/images/layouts/medium/" + thisLayout.Large; if (CommonLogic.FileExists(CommonLogic.SafeMapPath(tImage))) { imgThumb.ImageUrl = tImage; imgPopThumb.ImageUrl = tImage; } if (CommonLogic.FileExists(CommonLogic.SafeMapPath(lImage))) { imgLarge.ImageUrl = lImage; imgPopLarge.ImageUrl = lImage; } } } base.DataBind(); }
/// <summary> /// Used to set the master page when using template switching or page-based templates /// </summary> /// <returns> /// The name of the template to use. To utilize this you must override OverrideTemplate /// in a page that inherits from SkinBase where you're trying to change the master page /// </returns> protected override string OverrideTemplate() { var masterHome = AppLogic.HomeTemplate(); if (masterHome.Trim().Length == 0) { masterHome = "JeldWenEmptyTemplate"; } if (masterHome.EndsWith(".ascx")) { masterHome = masterHome.Replace(".ascx", ".master"); } if (!masterHome.EndsWith(".master", StringComparison.OrdinalIgnoreCase)) { masterHome = masterHome + ".master"; } if (!CommonLogic.FileExists(CommonLogic.SafeMapPath("~/App_Templates/Skin_" + SkinID + "/" + masterHome))) { masterHome = "JeldWenEmptyTemplate"; } return(masterHome); }
private static string GetRedirect(string RequestedPage, string ServedPage) { String AppConfigPrefix = "Mobile.Redirect."; String RequestedPageConfigName = AppConfigPrefix + RequestedPage; if (AppLogic.AppConfigExists(RequestedPageConfigName)) { return(AppLogic.AppConfig(RequestedPageConfigName)); } String ServedPageConfigName = AppConfigPrefix + ServedPage; if (AppLogic.AppConfigExists(ServedPageConfigName)) { return(AppLogic.AppConfig(ServedPageConfigName)); } if (CommonLogic.FileExists("mobile" + RequestedPage)) { return("mobile" + RequestedPage); } return(""); }
protected void Page_Load(object sender, EventArgs e) { ThisLayout = this.Datasource; ctrlEditLayout.Datasource = this.Datasource; //ImageButton cbtn = pnlLayoutItem.FindControl<ImageButton>("imgbtnClone"); //ImageButton dbtn = pnlLayoutItem.FindControl<ImageButton>("imgbtnDelete"); //Button sbtn = pnlLayoutItem.FindControl<Button>("btnSaveEditedLayout"); // ScriptManager from layouts.aspx // TableCell.TableRow.Table.ControlSearch.UpdatePanel.SearchableTemplate.UpdatePanel.LayoutList.UpdatePanel.LayoutPage //ScriptManager sm = Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.FindControl<ScriptManager>("scrptMgr"); //UpdatePanel up = Parent.Parent.Parent.Parent.Parent.Parent.FindControl<UpdatePanel>("upListItems"); //PostBackTrigger pbt = new PostBackTrigger(); //pbt.ControlID = cbtn.ClientID; //up.Triggers.Add(pbt); //pbt = new PostBackTrigger(); //pbt.ControlID = dbtn.ClientID; //up.Triggers.Add(pbt); //pbt = new PostBackTrigger(); //pbt.ControlID = sbtn.ClientID; //up.Triggers.Add(pbt); // register the buttons //sm.RegisterPostBackControl(cbtn); //sm.RegisterPostBackControl(dbtn); //sm.RegisterPostBackControl(sbtn); litLayoutID.Text = ThisLayout.LayoutID.ToString(); litLayoutName.Text = ThisLayout.Name; litLayoutMapped.Text = CommonLogic.IIF(ThisLayout.IsMapped, "Yes", "No"); if (string.IsNullOrEmpty(ThisLayout.Icon)) { imgLayoutIcon.ImageUrl = AppLogic.NoPictureImageURL(true, 1, ThisCustomer.LocaleSetting); } else { String lfIcon = "~/images/layouts/icon/" + ThisLayout.Icon; if (CommonLogic.FileExists(CommonLogic.SafeMapPath(lfIcon))) { imgLayoutIcon.ImageUrl = lfIcon; } else { imgLayoutIcon.ImageUrl = AppLogic.NoPictureImageURL(true, 1, ThisCustomer.LocaleSetting); } } if (String.IsNullOrEmpty(ThisLayout.Large)) { imgLarge.ImageUrl = AppLogic.NoPictureImageURL(true, 1, ThisCustomer.LocaleSetting); } else { imgLarge.ImageUrl = "~/images/layouts/medium/" + ThisLayout.Large; } }
protected override void OnPreInit(EventArgs e) { if (HttpContext.Current != null) { m_ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; int StoreID = AppLogic.StoreID(); m_SkinID = AppLogic.GetStoreSkinID(StoreID); //TODO: review this if (CommonLogic.IsInteger(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString())) { int skinFromProfile = int.Parse(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString()); if (skinFromProfile > 0) { m_SkinID = skinFromProfile; } } else if (AppLogic.AppConfig("Signin.SkinMaster").EqualsIgnoreCase("session")) { m_SkinID = m_ThisCustomer.DBSkinID; } if (CommonLogic.QueryStringUSInt("skinid") > 0) { m_SkinID = CommonLogic.QueryStringUSInt("skinid"); } if (CommonLogic.QueryStringUSInt("affiliateid") > 0) { HttpContext.Current.Profile.SetPropertyValue("AffiliateID", CommonLogic.QueryStringUSInt("affiliateid").ToString()); } if (HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.Authority != HttpContext.Current.Request.Url.Authority) { HttpContext.Current.Profile.SetPropertyValue("Referrer", HttpContext.Current.Request.UrlReferrer.ToString()); } if (AppLogic.ProductIsMLExpress() == false && AppLogic.AppConfigBool("GoogleCheckout.ShowOnCartPage")) { String s = (String)HttpContext.Current.Cache.Get("GCCallbackLoadCheck"); if (s == null) { String notused = CommonLogic.AspHTTP(AppLogic.GetStoreHTTPLocation(false) + "gccallback.aspx?loadcheck=1", 10); HttpContext.Current.Cache.Insert("GCCallbackLoadCheck", "true", null, System.DateTime.Now.AddMinutes(5), TimeSpan.Zero); } } // don't fire disclaimer logic on admin pages if (!AppLogic.IsAdminSite && CommonLogic.QueryStringCanBeDangerousContent("ReturnURL").IndexOf(AppLogic.AppConfig("AdminDir")) == -1 && (AppLogic.AppConfigBool("SiteDisclaimerRequired") && CommonLogic.CookieCanBeDangerousContent("SiteDisclaimerAccepted", true).Length == 0)) { String ThisPageURL = CommonLogic.GetThisPageName(true) + "?" + CommonLogic.ServerVariables("QUERY_STRING"); Response.Redirect("disclaimer.aspx?returnURL=" + Server.UrlEncode(ThisPageURL)); } bool IGDQueryClear = false; m_IGD = CommonLogic.QueryStringCanBeDangerousContent("IGD").Trim(); if (m_IGD.Length == 0 && CommonLogic.ServerVariables("QUERY_STRING").IndexOf("IGD=") != -1) { m_IGD = String.Empty; // there was IGD={blank} in the query string, so forcefully clear IGD! IGDQueryClear = true; } bool IsStartOfImpersonation = m_IGD.Length != 0; // the url invocation starts the impersonation only! if (!IGDQueryClear && m_IGD.Length == 0) { if (m_ThisCustomer.IsAdminUser) { // pull out the impersonation IGD from the customer session, if any m_IGD = m_ThisCustomer.ThisCustomerSession["IGD"]; } } if (IGDQueryClear) { // forcefully clear any IGD for this customer, just to be safe! m_ThisCustomer.ThisCustomerSession["IGD"] = ""; m_ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; } Customer PhoneCustomer = null; if (m_IGD.Length != 0) { if (m_ThisCustomer.IsAdminUser) { try { Guid IGD = new Guid(m_IGD); PhoneCustomer = new Customer(IGD); PhoneCustomer.IsImpersonated = true; } catch { m_ThisCustomer.ThisCustomerSession["IGD"] = ""; m_ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; m_IGD = string.Empty; } } if (PhoneCustomer != null && PhoneCustomer.HasCustomerRecord) { int ImpersonationTimeoutInMinutes = AppLogic.AppConfigUSInt("ImpersonationTimeoutInMinutes"); if (ImpersonationTimeoutInMinutes == 0) { ImpersonationTimeoutInMinutes = 20; } if (PhoneCustomer.ThisCustomerSession.LastActivity >= DateTime.Now.AddMinutes(-ImpersonationTimeoutInMinutes)) { m_ThisCustomer.ThisCustomerSession["IGD"] = IGD; m_AdminCustomer = m_ThisCustomer; // save the owning admin user doing the impersonation here m_ThisCustomer = PhoneCustomer; // build the impersonation customer the phone order customer bool IsAdmin = CommonLogic.ApplicationBool("IsAdminSite"); if (!HttpContext.Current.Items.Contains("IsBeingImpersonated")) { HttpContext.Current.Items.Add("IsBeingImpersonated", "true"); } } else { if (HttpContext.Current.Items.Contains("IsBeingImpersonated")) { HttpContext.Current.Items["IsBeingImpersonated"] = "false"; } m_ThisCustomer.ThisCustomerSession["IGD"] = ""; m_ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; m_IGD = string.Empty; //Response.Redirect("t-phoneordertimeout.aspx"); Response.Redirect(SE.MakeDriverLink("phoneordertimeout")); } } } Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Localization.GetDefaultLocale()); Thread.CurrentThread.CurrentUICulture = new CultureInfo(ThisCustomer.LocaleSetting); m_Parser = new Parser(m_EntityHelpers, m_SkinID, m_ThisCustomer); m_TemplateName = GetTemplateName(); #region Vortx Mobile Modification if (!AppLogic.IsAdminSite) { m_ThisCustomer = MobileRedirectController.SkinBaseHook(SkinID, ThisCustomer); SkinID = ThisCustomer.SkinID; if (SkinID == Vortx.Data.Config.MobilePlatform.SkinId && MobileHelper.isMobile()) { m_TemplateName = "template.master"; } } #endregion String SkinDirectory = String.Empty; String PageTheme = String.Empty; SkinDirectory = "Skin_" + this.SkinID.ToString(); PageTheme = "Skin_" + this.SkinID.ToString(); if (!m_TemplateName.EndsWith(".master", StringComparison.OrdinalIgnoreCase)) { m_TemplateName = m_TemplateName + ".master"; } this.MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName; this.Theme = PageTheme; if (!CommonLogic.FileExists(this.MasterPageFile)) { this.SkinID = AppLogic.DefaultSkinID(); m_TemplateName = "template.master"; SkinDirectory = "Skin_" + this.SkinID.ToString(); PageTheme = "Skin_" + this.SkinID.ToString(); this.MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName; this.Theme = PageTheme; } HttpContext.Current.Profile.SetPropertyValue("SkinID", this.SkinID.ToString()); if (ThisCustomer.SkinID != this.SkinID) { ThisCustomer.SkinID = this.SkinID; ThisCustomer.UpdateCustomer(new SqlParameter[] { new SqlParameter("SkinID", this.SkinID) }); } } base.OnPreInit(e); }
protected override void OnPreInit(EventArgs e) { if (HttpContext.Current != null) { //Have to call GetPropertyValue once before you actually need it to initialize the PropertyValues collection HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString(); #region SkinID //If it's mobile, bypass all the rest if (!AppLogic.IsAdminSite && MobileHelper.isMobile()) { MobileHelper.SetCustomerToMobileSkinId(ThisCustomer); SkinID = ThisCustomer.SkinID; } else { //SkinId querystring overrides everything but mobile if (CommonLogic.QueryStringUSInt("skinid") > 0) { SkinID = CommonLogic.QueryStringUSInt("skinid"); //Customer has a querystring so save this to the profile. if (HttpContext.Current.Profile != null) { HttpContext.Current.Profile.SetPropertyValue("SkinID", this.SkinID.ToString()); } } //Check to see if we are previewing the skin else if (CommonLogic.QueryStringUSInt("previewskinid") > 0) { SkinID = CommonLogic.QueryStringUSInt("previewskinid"); //Customer has a preview querystring so save this to the profile. if (HttpContext.Current.Profile != null) { HttpContext.Current.Profile.SetPropertyValue("PreviewSkinID", this.SkinID.ToString()); } } //Use the preview profile value if we have one else if (HttpContext.Current.Profile != null && HttpContext.Current.Profile.PropertyValues["PreviewSkinID"] != null && CommonLogic.IsInteger(HttpContext.Current.Profile.GetPropertyValue("PreviewSkinID").ToString())) { int skinFromProfile = int.Parse(HttpContext.Current.Profile.GetPropertyValue("PreviewSkinID").ToString()); if (skinFromProfile > 0) { SkinID = skinFromProfile; } } //Pull the skinid from the current profile else if (HttpContext.Current.Profile != null && CommonLogic.IsInteger(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString())) { int skinFromProfile = int.Parse(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString()); if (skinFromProfile > 0) { SkinID = skinFromProfile; } } } //Now save the skinID to the customer record. This is not used OOB. if (ThisCustomer.SkinID != this.SkinID) { ThisCustomer.SkinID = this.SkinID; ThisCustomer.UpdateCustomer(new SqlParameter[] { new SqlParameter("SkinID", this.SkinID) }); } #endregion if (CommonLogic.QueryStringUSInt("affiliateid") > 0) { HttpContext.Current.Profile.SetPropertyValue("AffiliateID", CommonLogic.QueryStringUSInt("affiliateid").ToString()); } if (HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.Authority != HttpContext.Current.Request.Url.Authority) { HttpContext.Current.Profile.SetPropertyValue("Referrer", HttpContext.Current.Request.UrlReferrer.ToString()); } // don't fire disclaimer logic on admin pages if (!AppLogic.IsAdminSite && CommonLogic.QueryStringCanBeDangerousContent("ReturnURL").IndexOf(AppLogic.AppConfig("AdminDir")) == -1 && (AppLogic.AppConfigBool("SiteDisclaimerRequired") && CommonLogic.CookieCanBeDangerousContent("SiteDisclaimerAccepted", true).Length == 0)) { String ThisPageURL = CommonLogic.GetThisPageName(true) + "?" + CommonLogic.ServerVariables("QUERY_STRING"); Response.Redirect("disclaimer.aspx?returnURL=" + Server.UrlEncode(ThisPageURL)); } #region Impersonation bool IGDQueryClear = false; m_IGD = CommonLogic.QueryStringCanBeDangerousContent("IGD").Trim(); if (m_IGD.Length == 0 && CommonLogic.ServerVariables("QUERY_STRING").IndexOf("IGD=") != -1) { m_IGD = String.Empty; // there was IGD={blank} in the query string, so forcefully clear IGD! IGDQueryClear = true; } bool IsStartOfImpersonation = m_IGD.Length != 0; // the url invocation starts the impersonation only! if (!IGDQueryClear && m_IGD.Length == 0) { if (ThisCustomer.IsAdminUser) { // pull out the impersonation IGD from the customer session, if any m_IGD = ThisCustomer.ThisCustomerSession["IGD"]; } } if (IGDQueryClear) { // forcefully clear any IGD for this customer, just to be safe! ThisCustomer.ThisCustomerSession["IGD"] = ""; ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; } Customer PhoneCustomer = null; if (m_IGD.Length != 0) { if (ThisCustomer.IsAdminUser) { try { Guid IGD = new Guid(m_IGD); PhoneCustomer = new Customer(IGD); PhoneCustomer.IsImpersonated = true; } catch { ThisCustomer.ThisCustomerSession["IGD"] = ""; ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; m_IGD = string.Empty; } } if (PhoneCustomer != null && PhoneCustomer.HasCustomerRecord) { int ImpersonationTimeoutInMinutes = AppLogic.AppConfigUSInt("ImpersonationTimeoutInMinutes"); if (ImpersonationTimeoutInMinutes == 0) { ImpersonationTimeoutInMinutes = 20; } if (PhoneCustomer.ThisCustomerSession.LastActivity >= DateTime.Now.AddMinutes(-ImpersonationTimeoutInMinutes)) { ThisCustomer.ThisCustomerSession["IGD"] = IGD; m_AdminCustomer = ThisCustomer; // save the owning admin user doing the impersonation here ThisCustomer = PhoneCustomer; // build the impersonation customer the phone order customer bool IsAdmin = CommonLogic.ApplicationBool("IsAdminSite"); if (!HttpContext.Current.Items.Contains("IsBeingImpersonated")) { HttpContext.Current.Items.Add("IsBeingImpersonated", "true"); } } else { if (HttpContext.Current.Items.Contains("IsBeingImpersonated")) { HttpContext.Current.Items["IsBeingImpersonated"] = "false"; } ThisCustomer.ThisCustomerSession["IGD"] = ""; ThisCustomer.ThisCustomerSession["IGD_EDITINGORDER"] = ""; m_IGD = string.Empty; //Response.Redirect("t-phoneordertimeout.aspx"); Response.Redirect(SE.MakeDriverLink("phoneordertimeout")); } } } #endregion Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Localization.GetDefaultLocale()); Thread.CurrentThread.CurrentUICulture = new CultureInfo(ThisCustomer.LocaleSetting); m_TemplateName = GetTemplateName(); if (!AppLogic.IsAdminSite) { ThisCustomer = MobileRedirectController.SkinBaseHook(SkinID, ThisCustomer); if (SkinID == Vortx.Data.Config.MobilePlatform.SkinId && MobileHelper.isMobile()) { m_TemplateName = "template.master"; } } //needs to come after the mobile check m_Parser = new Parser(m_EntityHelpers, SkinID, ThisCustomer); String SkinDirectory = String.Empty; String PageTheme = String.Empty; SkinDirectory = "Skin_" + this.SkinID.ToString(); PageTheme = "Skin_" + this.SkinID.ToString(); if (!m_TemplateName.EndsWith(".master", StringComparison.OrdinalIgnoreCase)) { m_TemplateName = m_TemplateName + ".master"; } this.MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName; this.Theme = PageTheme; if (!CommonLogic.FileExists(this.MasterPageFile)) { this.SkinID = AppLogic.DefaultSkinID(); m_TemplateName = "template.master"; SkinDirectory = "Skin_" + this.SkinID.ToString(); PageTheme = "Skin_" + this.SkinID.ToString(); this.MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName; this.Theme = PageTheme; } } base.OnPreInit(e); }
/// <summary> /// Determines which masterpage skin to use to render the site to the browsing customer /// </summary> /// <returns>The name of the file that is the masterpage</returns> private string GetTemplateName() { String templateName = String.Empty; templateName = CommonLogic.QueryStringCanBeDangerousContent("template"); //First attempt to find a template with this explicit page name (eg. p-21-MyProduct.aspx) if (templateName == null || templateName.Length == 0) { // undocumented feature: templateName = AppLogic.AppConfig("Template" + CommonLogic.GetThisPageName(false)); } //Next, try to find a generic template that corresponds with the type of page being viewed if (templateName == null || templateName.Length == 0) { if (IsProductPage) { templateName = AppLogic.AppConfig("TemplateShowProduct.aspx"); } else if (IsEntityPage) { templateName = AppLogic.AppConfig("TemplateShow" + EntityType + ".aspx"); } } // A page inheriting from SkinBase can Override OverrideTemplate() and set the template // This is used on entity pages to set the template to the value specified on the edit entity page in the admin site string overridingTemplate = OverrideTemplate(); if (overridingTemplate != null && overridingTemplate.Trim().Length > 0 && !overridingTemplate.Equals("template.master", StringComparison.OrdinalIgnoreCase)) { templateName = overridingTemplate; } if (templateName == null || templateName.Length == 0) { templateName = "template"; } // sanity check to ensure that OverrideTemplate wasn't overridden in a page and // then set to an empty string if (templateName.Trim().Length == 0 || !CommonLogic.FileExists(SkinRoot + templateName)) { templateName = "template.master"; } // only start looking for localized masterpages if the GlobalConfig AllowTemplateSwitchingByLocale // is set to true, so we don't unnecessarily check for multiple files on every page load if (AppLogic.GlobalConfigBool("AllowTemplateSwitchingByLocale")) { String templateLocaleName = null; String _url = String.Empty; // try customer locale: templateLocaleName = templateName.Replace(".master", "." + ThisCustomer.LocaleSetting + ".master"); _url = Path.Combine(SkinRoot, templateLocaleName); m_TemplateFN = CommonLogic.SafeMapPath(_url); // if the file doesn't exist, check the default locale if (!CommonLogic.FileExists(m_TemplateFN)) { // try default store locale path: templateLocaleName = templateName.Replace(".master", "." + Localization.GetDefaultLocale() + ".master"); _url = Path.Combine(SkinRoot, templateLocaleName); m_TemplateFN = CommonLogic.SafeMapPath(_url); } // if we found a locale match, use the name of the localized masterpage if (CommonLogic.FileExists(m_TemplateFN)) { templateName = templateLocaleName; } } m_TemplateName = templateName; return(templateName); }
private void InitializeControls(LayoutField lf) { //if (!string.IsNullOrEmpty(src)) //{ // src = ThisParser.ReplacePageStaticTokens(src); // src = ThisParser.ReplacePageDynamicTokens(src); //} //if (!string.IsNullOrEmpty(alttxt)) //{ // alttxt = ThisParser.ReplacePageStaticTokens(alttxt); // alttxt = ThisParser.ReplacePageDynamicTokens(alttxt); //} if (lf != null && lf.LayoutFieldID > 0) { if (string.IsNullOrEmpty(this.Source) || !CommonLogic.FileExists(this.Source)) { if (ThisCustomer.IsAdminUser) { GetAdminDefaultImage(); } else { GetDefaultImage(); } } else { if (ThisCustomer.IsAdminUser) { //if (this.Height > 0) //{ // ibEditImage.Height = this.Height; //} //if (this.Width > 0) //{ // ibEditImage.Width = this.Width; //} ibEditImage.ImageUrl = "~/layoutimage.ashx?layoutfieldid=" + lf.LayoutFieldID.ToString(); ibEditImage.AlternateText = this.Alt; // Parent ScriptManager ScriptManager sm = Page.Master.FindControl <ScriptManager>("scrptMgr"); sm.RegisterPostBackControl(ibEditImage); sm.RegisterPostBackControl(btnSaveImage); } else { //if (this.Height > 0) //{ // iImage.Height = this.Height; //} //if (this.Width > 0) //{ // iImage.Width = this.Width; //} iImage.ImageUrl = this.Source; iImage.AlternateText = this.Alt; } } } }
public override bool UpdateChanges() { bool addedNew = false; foreach (KeyValuePair <int, StoreConfigDataConstruct> kvp in StoreConfigValues) { AppConfig currentConfig = kvp.Value.EditingConfig; if (currentConfig != null) { int currentStoreId = kvp.Value.StoreId; //plhConfigValueEditor String editorID = currentConfig.Description = txtDescription.Text; currentConfig.ConfigValue = GetConfigValue(kvp.Value.EditorPlaceHolder, currentConfig, false, kvp.Value.StoreId); //this.txtConfigValue.Text; currentConfig.GroupName = cboGroupName.SelectedValue; if (currentConfig.Name.Equals("AddIns.Enabled", StringComparison.OrdinalIgnoreCase)) { if (!CommonLogic.FileExists(CommonLogic.SafeMapPath("~/{0}/PipelineSegments.store".FormatWith(AppLogic.AppConfig("AddInDir"))))) { String addInPath = CommonLogic.SafeMapPath(String.Format("~/{0}", AppLogic.AppConfig("AddInDir"))); AddInDiscoveryHelper.DiscoverAvailableAddins(addInPath, true); } } if (ThisCustomer.IsAdminSuperUser) { currentConfig.SuperOnly = rbSuperOnly.Items[0].Selected; // 0 is Yes currentConfig.ValueType = cboValueType.SelectedValue; if (!string.IsNullOrEmpty(txtAllowableValues.Text)) { List <string> allowableValues = new List <string>(); allowableValues.AddCommaDelimited(txtAllowableValues.Text); currentConfig.AllowableValues = allowableValues; } } } else // adding duplicate for store { AppConfig DefaultAppConfig = AppLogic.GetAppConfigRouted(kvp.Value.ConfigName, kvp.Value.StoreId); String NewConfigValue = GetConfigValue(phStoreValues, DefaultAppConfig, true, kvp.Value.StoreId); if (DefaultAppConfig.ValueType.EqualsIgnoreCase("boolean") || (DefaultAppConfig != null && NewConfigValue.ToLower() != DefaultAppConfig.ConfigValue.ToLower() && NewConfigValue.ToLower() != m_OriginalDefaultValue.ToLower())) { AppConfig newConfig = AppConfig.Create(DefaultAppConfig.Name, DefaultAppConfig.Description, NewConfigValue, DefaultAppConfig.GroupName, DefaultAppConfig.SuperOnly, kvp.Value.StoreId); newConfig.ValueType = DefaultAppConfig.ValueType; newConfig.AllowableValues = DefaultAppConfig.AllowableValues; addedNew = true; } } } OnUpdatedChanges(EventArgs.Empty); if (addedNew) { AppConfigManager.LoadAllConfigs(); } return(false); }
protected override void OnPreInit(EventArgs e) { if (HttpContext.Current != null) { //Have to call GetPropertyValue once before you actually need it to initialize the PropertyValues collection if (HttpContext.Current.Profile != null) { HttpContext.Current.Profile.GetPropertyValue("SkinID"); } //SkinId querystring overrides everything but mobile if (CommonLogic.QueryStringUSInt("skinid") > 0) { SkinID = CommonLogic.QueryStringUSInt("skinid"); //Customer has a querystring so save this to the profile. if (HttpContext.Current.Profile != null) { HttpContext.Current.Profile.SetPropertyValue("SkinID", SkinID.ToString()); } } //Check to see if we are previewing the skin else if (CommonLogic.QueryStringUSInt("previewskinid") > 0) { SkinID = CommonLogic.QueryStringUSInt("previewskinid"); //Customer has a preview querystring so save this to the profile. if (HttpContext.Current.Profile != null) { HttpContext.Current.Profile.SetPropertyValue("PreviewSkinID", SkinID.ToString()); } } //Use the preview profile value if we have one else if (HttpContext.Current.Profile != null && HttpContext.Current.Profile.PropertyValues["PreviewSkinID"] != null && CommonLogic.IsInteger(HttpContext.Current.Profile.GetPropertyValue("PreviewSkinID").ToString())) { int skinFromProfile = int.Parse(HttpContext.Current.Profile.GetPropertyValue("PreviewSkinID").ToString()); if (skinFromProfile > 0) { SkinID = skinFromProfile; } } //Pull the skinid from the current profile else if (HttpContext.Current.Profile != null && CommonLogic.IsInteger(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString())) { int skinFromProfile = int.Parse(HttpContext.Current.Profile.GetPropertyValue("SkinID").ToString()); if (skinFromProfile > 0) { SkinID = skinFromProfile; } } //Now save the skinID to the customer record. This is not used OOB. if (ThisCustomer.SkinID != SkinID) { ThisCustomer.SkinID = SkinID; ThisCustomer.UpdateCustomer(new SqlParameter[] { new SqlParameter("SkinID", SkinID) }); } if (CommonLogic.QueryStringUSInt("affiliateid") > 0) { var affiliateId = CommonLogic.QueryStringUSInt("affiliateid"); var affiliate = new Affiliate(affiliateId); if (!AppLogic.GlobalConfigBool("AllowAffiliateFiltering") || affiliate.StoreID == AppLogic.StoreID()) { HttpContext.Current.Profile.SetPropertyValue("AffiliateID", affiliateId.ToString()); } } if (HttpContext.Current.Request.UrlReferrer != null && HttpContext.Current.Request.UrlReferrer.Authority != HttpContext.Current.Request.Url.Authority) { HttpContext.Current.Profile.SetPropertyValue("Referrer", HttpContext.Current.Request.UrlReferrer.ToString()); } Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Localization.GetDefaultLocale()); Thread.CurrentThread.CurrentUICulture = new CultureInfo(ThisCustomer.LocaleSetting); m_TemplateName = GetTemplateName(); m_Parser = new Parser(); string SkinDirectory = string.Empty; string PageTheme = string.Empty; SkinDirectory = "Skin_" + SkinID.ToString(); PageTheme = "Skin_" + SkinID.ToString(); if (!m_TemplateName.EndsWith(".master", StringComparison.OrdinalIgnoreCase)) { m_TemplateName = m_TemplateName + ".master"; } MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName; Theme = PageTheme; if (!CommonLogic.FileExists(MasterPageFile)) { SkinID = AppLogic.DefaultSkinID(); m_TemplateName = "template.master"; SkinDirectory = "Skin_" + SkinID.ToString(); PageTheme = "Skin_" + SkinID.ToString(); MasterPageFile = "~/App_Templates/" + SkinDirectory + "/" + m_TemplateName; Theme = PageTheme; } } base.OnPreInit(e); }
public void LoadSkinTemplate() { SkinID = 1; if (m_IGD.Length != 0) { m_TemplateName = "empty.ascx"; // force override for admin phone order pages } if (m_TemplateName.Length == 0) { m_TemplateName = "template.ascx"; } m_TemplateFN = string.Empty; if (m_TemplateName.Length != 0) { SkinID = CommonLogic.QueryStringUSInt("SkinID"); if (SkinID == 0 && CommonLogic.QueryStringCanBeDangerousContent("AffiliateID").Length != 0) { DataSet ds = DB.GetDS("Select DefaultSkinID from CustomerSalesRep with (NOLOCK) where SalesRepGroupCode=" + DB.SQuote(CommonLogic.QueryStringCanBeDangerousContent("AffiliateID")), AppLogic.CachingOn, System.DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes())); if (ds.Tables[0].Rows.Count > 0) { SkinID = DB.RowFieldInt(ds.Tables[0].Rows[0], "DefaultSkinID"); } ds.Dispose(); } if (SkinID == 0) { SkinID = m_DefaultSkinID; } if (SkinID == 0) { SkinID = CommonLogic.CookieUSInt(ro_SkinCookieName); } if (SkinID == 0) { SkinID = 1; } AppLogic.SetCookie(ro_SkinCookieName, SkinID.ToString(), new TimeSpan(365, 0, 0, 0, 0)); m_ThisCustomer.SkinID = SkinID; string LocaleTemplateURLCacheName = string.Format("template_{0}_{1}_{1}", m_TemplateName, SkinID.ToString(), ThisCustomer.LocaleSetting); string WebLocaleTemplateURLCacheName = string.Format("template_{0}_{1}_{1}", m_TemplateName, SkinID.ToString(), Localization.WebConfigLocale); string TemplateURLCacheName = string.Format("template_{0}_{1}_{1}", m_TemplateName, SkinID.ToString(), ""); // try customer locale: string webLocale = Localization.WebConfigLocale; string localeSetting = ThisCustomer.LocaleSetting; DateTime mins = System.DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()); string _url = Path.Combine(SkinRoot, m_TemplateName.Replace(".ascx", "." + localeSetting + ".ascx")); m_TemplateFN = CommonLogic.SafeMapPath(_url); if (!CommonLogic.FileExists(m_TemplateFN)) { // try default store locale path: _url = Path.Combine(SkinRoot, m_TemplateName.Replace(".ascx", "." + webLocale + ".ascx")); m_TemplateFN = CommonLogic.SafeMapPath(_url); } if (!CommonLogic.FileExists(m_TemplateFN)) { _url = Path.Combine(SkinRoot, m_TemplateName); m_TemplateFN = CommonLogic.SafeMapPath(_url); } if (AppLogic.CachingOn) { HttpContext.Current.Cache.Insert(TemplateURLCacheName, _url, null, mins, TimeSpan.Zero); } if (_url != null && _url != string.Empty && !CommonLogic.FileExists(_url)) { SkinID = 1; AppLogic.SetCookie(ro_SkinCookieName, SkinID.ToString(), new TimeSpan(365, 0, 0, 0, 0)); m_ThisCustomer.SkinID = SkinID; // try customer locale: _url = Path.Combine(SkinRoot, m_TemplateName.Replace(".ascx", "." + localeSetting + ".ascx")); m_TemplateFN = _url.ToMapPath(); if (!CommonLogic.FileExists(m_TemplateFN)) { // try default store locale path: _url = Path.Combine(SkinRoot, m_TemplateName.Replace(".ascx", "." + webLocale + ".ascx")); m_TemplateFN = _url.ToMapPath(); } if (!CommonLogic.FileExists(m_TemplateFN)) { // try base (NULL) locale path: _url = Path.Combine(SkinRoot, m_TemplateName); m_TemplateFN = _url.ToMapPath(); } if (AppLogic.CachingOn) { HttpContext.Current.Cache.Insert(TemplateURLCacheName, _url, null, mins, TimeSpan.Zero); } } try { m_Template = (TemplateBase)LoadControl(_url); } catch { } // if defined template not FOUND... } if (m_Template != null) { m_Template.AppRelativeTemplateSourceDirectory = "~/"; // move it from skins/skin_N to root relative, so all links/image refs are from root of site } }
protected void Page_Load(object sender, System.EventArgs e) { string vesrsiontxt = string.Empty; string productname = string.Empty; String assemblyfilePath = CommonLogic.SafeMapPath("App_Code/GlobalAssemblyInfo.cs"); if (CommonLogic.FileExists(assemblyfilePath)) { string[] attrlines = System.IO.File.ReadAllLines(assemblyfilePath); //[assembly: AssemblyFileVersionAttribute("6.0.7.26")] if (attrlines != null) { foreach (string line in attrlines) { if (line.Contains("[assembly: AssemblyFileVersionAttribute(")) { vesrsiontxt = line.Replace("[assembly: AssemblyFileVersionAttribute(", string.Empty); vesrsiontxt = vesrsiontxt.Replace(")]", string.Empty); vesrsiontxt = vesrsiontxt.Replace("\"", string.Empty); if (vesrsiontxt.Length == 0) { vesrsiontxt = CommonLogic.GetVersion(); } break; } //[assembly: AssemblyProduct("Interprise Suite")] else if (line.Contains("[assembly: AssemblyProduct(")) { productname = line.Replace("[assembly: AssemblyProduct(", string.Empty); productname = productname.Replace(")]", string.Empty); productname = productname.Replace("\"", string.Empty); } } if (productname.Length > 0 && vesrsiontxt.Length > 0) { vesrsiontxt = string.Concat(" ", productname, " ", vesrsiontxt); } } } else { vesrsiontxt = CommonLogic.GetVersion(); } lblVersion.Text = vesrsiontxt; lblDB.Text = "DB Version: "; //Trap error so other data are still readable. try { lblDB.Text += InterpriseHelper.GetISdbVersion(); lblStoreCode.Text = "Web Store Code: " + InterpriseHelper.ConfigInstance.WebSiteCode; } catch (Exception ex) { lblDB.Text += ex.Message; } // serial and confirmation code try { string serial = String.Empty; string confirmation = String.Empty; InterpriseHelper.GetMaskedClientSerailAndConfirmationCode(ref serial, ref confirmation); if (!String.IsNullOrEmpty(serial)) { lblSerial.Text = "Serial Number: " + serial; } else { lblSerial.Text = "Serial Number: Not Found!"; } if (!String.IsNullOrEmpty(confirmation)) { lblConfirm.Text = "Confirmation Code: " + confirmation; } else { lblConfirm.Text = "Confirmation Code: Not Found!"; } } catch (Exception ex) { lblDB.Text += ex.Message; } }
/// <summary> /// Overrides the OnPreRender method /// </summary> /// <param name="e"></param> protected override void OnPreRender(EventArgs e) { SetupMenu(); if (AppLogic.AppConfigBool("Layouts.Enabled")) { bool HasMappedLayout = false; bool IsTopic = (Page as SkinBase).IsTopicPage; bool IsEntity = (Page as SkinBase).IsEntityPage; bool IsProduct = (Page as SkinBase).IsProductPage; int PageID = (Page as SkinBase).PageID; LayoutMap lm = new LayoutMap(); if (IsEntity) { String EntityType = (Page as SkinBase).EntityType; lm = new LayoutMap(EntityType, PageID); if (lm.LayoutID > 0) { HasMappedLayout = true; (Page as SkinBase).ThisLayout = new LayoutData(lm.LayoutID); } } else if (IsTopic) { lm = new LayoutMap("topic", PageID); } else if (IsProduct) { lm = new LayoutMap("product", PageID); } else { String pName = CommonLogic.GetThisPageName(false); lm = new LayoutMap(pName, PageID); } if (lm.LayoutID > 0) { HasMappedLayout = true; (Page as SkinBase).ThisLayout = new LayoutData(lm.LayoutID); } if (HasMappedLayout) { LayoutData ThisLayout = (Page as SkinBase).ThisLayout; if ((Page as SkinBase).ThisLayout != null) { bool exists = CommonLogic.FileExists(ThisLayout.LayoutFile); if (!exists) { exists = ThisLayout.CreateLayoutControl(); } if (exists) { Control ctrl = LoadControl("~/layouts/" + ThisLayout.LayoutID.ToString() + "/" + ThisLayout.Name + "_" + ThisLayout.Version.ToString() + ".ascx"); ContentPlaceHolder phContent = (ContentPlaceHolder)this.FindControl("PageContent"); phContent.Controls.Clear(); phContent.Controls.Add(ctrl); } } } } base.OnPreRender(e); }