Ejemplo n.º 1
0
        /// <summary>
        /// Load assigne preset for associate page.
        /// </summary>
        /// <param name="TemplateName">Template name.</param>
        /// <param name="PageName">Page name.</param>
        /// <returns>Preset path.</returns>
        public static string LoadActivePresetForPage(string TemplateName, string PageName)
        {
            string            presetPath       = TemplateName.ToLower().Equals("default")?Utils.GetPresetPath_DefaultTemplate(TemplateName):Utils.GetPresetPath(TemplateName);
            List <PresetInfo> lstActivePresets = new List <PresetInfo>();
            string            pagepreset       = presetPath + "/" + TemplateConstants.PagePresetFile;
            List <string>     lstAllPages      = new List <string>();

            if (File.Exists(pagepreset))
            {
                if (!CacheHelper.Get("PresetList", out lstActivePresets))
                {
                    lstActivePresets = PresetHelper.ParsePreset(pagepreset, "pagepreset/layout/preset", out lstAllPages);
                    CacheHelper.Add(lstActivePresets, "PresetList");
                }
            }
            else
            {
                lstActivePresets.Add(PresetInfo.GetPresetPages("default", "*"));
            }
            string pagepresetactive = string.Empty;
            string defaultpreset    = "layout.ascx";

            foreach (PresetInfo preset in lstActivePresets)
            {
                if (preset.IsDefault)
                {
                    defaultpreset = string.Format("{0}.ascx", preset.PresetName);;
                }
                else
                {
                    string presetPathFull = string.Empty;
                    foreach (string page in preset.LSTPages)
                    {
                        if (page.ToLower().Equals(PageName.ToLower()))
                        {
                            pagepresetactive = string.Format("{0}.ascx", preset.PresetName);;
                            break;
                        }
                    }
                }
            }
            if (pagepresetactive == string.Empty)
            {
                pagepresetactive = defaultpreset;
            }
            pagepresetactive = Decide.IsTemplateDefault(TemplateName)?string.Format("~/Core/Template/{1}", TemplateName, pagepresetactive):string.Format("~/Templates/{0}/{1}", TemplateName, pagepresetactive);
            return(pagepresetactive);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Load device type 3.
 /// </summary>
 /// <param name="TemplateName">Template name.</param>
 /// <returns>Preset path.</returns>
 public static string LoadDeviceType3(string TemplateName)
 {
     return(Decide.IsTemplateDefault(TemplateName) ? "~/Core/Template/handheld.ascx" : string.Format("~/Templates/{0}/devicetype3.ascx", TemplateName));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Load handheld controls.
 /// </summary>
 /// <param name="TemplateName">Templates name.</param>
 /// <returns>Preset path.</returns>
 public static string LoadHandheldControl(string TemplateName)
 {
     return(Decide.IsTemplateDefault(TemplateName) ? "~/Core/Template/handheld.ascx" : string.Format("~/Templates/{0}/handheld.ascx", TemplateName));
 }