Example #1
0
        private static IEnumerable <SelfCertCountry> fetchSelfCertOptions(string targetNodeId, bool selectProf)
        {
            var targetNode       = new DynamicNode();
            var complianceString = "";
            var countryList      = new List <SelfCertCountry>();

            if (NodeFacade.NodeExists(targetNodeId, out targetNode))
            {
                if (NodeFacade.NodeHasCompliance(targetNode, out complianceString))
                {
                    // return a list of countries, where the counties are active if the compliance matches the compliance string
                    var rawList = fetchSelfCertData();
                    foreach (string eachComplianceGroup in rawList.Keys)
                    {
                        var isActive = (complianceString.Contains("," + eachComplianceGroup + ","));
                        if (rawList[eachComplianceGroup].IsProf == selectProf)
                        {
                            foreach (SelfCertCountry eachCountry in rawList[eachComplianceGroup].Countries)
                            {
                                eachCountry.IsActive        = isActive;
                                eachCountry.ComplianceGroup = eachComplianceGroup;
                                countryList.Add(eachCountry);
                            }
                        }
                    }
                }
            }

            return(countryList.OrderBy(x => x.CountryName));
        }
Example #2
0
        private static string defaultProductMenuCollection()
        {
            DynamicNode     settingsRoot;
            DynamicNodeList webConfigSettings;

            if (NodeFacade.settingsRoot(out settingsRoot))
            {
                if (settingsRoot.HasDescendantsOfType("WebConfig", out webConfigSettings))
                {
                    return(webConfigSettings.First().SafeProperty("defaultProductMenuCollection") ?? string.Empty);
                }
            }
            return(string.Empty);
        }
Example #3
0
        /// <summary>
        /// Get the header theme to be used for the page.
        /// There is a site setting  Settings > WebConfig.headerTheme , which can be overriden at the page level.
        /// </summary>
        /// <returns>header theme (CSS class name) to be used in a "header" element</returns>
        private static string headerTheme()
        {
            DynamicNode     settingsRoot;
            DynamicNodeList webConfigSettings;

            if (NodeFacade.settingsRoot(out settingsRoot))
            {
                if (settingsRoot.HasDescendantsOfType("WebConfig", out webConfigSettings))
                {
                    return(webConfigSettings.First().SafeProperty("headerTheme") ?? string.Empty);
                }
            }
            return(string.Empty);
        }
Example #4
0
        private static bool fetchComplianceGroups(out DynamicNodeList complianceGroups)
        {
            DynamicNode settingsRoot;

            if (NodeFacade.settingsRoot(out settingsRoot))
            {
                if (settingsRoot.HasDescendantsOfType("ComplianceGroup", out complianceGroups))
                {
                    return(true);
                }
            }

            complianceGroups = null;
            return(false);
        }
Example #5
0
        /// <summary>
        ///     Settings > Compliance Lists Folder > .Children
        /// </summary>
        /// <returns>
        ///     Returns a DynamicNodeList which contains the DynamicNodes that represent the user compliance lists
        ///     Each DynamicNode is a compliance list, which can be extracted using GetPropertyValue("compliance")
        /// </returns>
        private static DynamicNodeList getUserLists()
        {
            DynamicNode     settingsRoot;
            DynamicNodeList complianceListFolder;
            DynamicNodeList userLists = new DynamicNodeList(); // returned

            if (NodeFacade.settingsRoot(out settingsRoot))
            {
                if (settingsRoot.HasDescendantsOfType("ComplianceListsFolder", out complianceListFolder))
                {
                    userLists = complianceListFolder.First().Children;
                }
            }
            return(userLists);
        }
        public static Dictionary <string, string> GetList(string listName, string language)
        {
            language = language.ToUpper();

            Dictionary <string, string> list = new Dictionary <string, string>();
            DynamicNode listRootNode;

            if (NodeFacade.TranslatedListRoot(listName, language, out listRootNode))
            {
                foreach (DynamicNode listItem in listRootNode.Children)
                {
                    list.Add(listItem.Name, listItem.SafeProperty("value"));
                }
            }

            return(list);
        }
        public static string CountryName(string countryNodeId, string language)
        {
            string countryName = string.Empty;

            DynamicNode countryNode;

            if (NodeFacade.NodeExists(countryNodeId, out countryNode))
            {
                countryName = countryNode.Name;

                if (language == Languages.German)
                {
                    // Override the English if there is a german name present.
                    var germanCountryName = countryNode.SafeProperty(Languages.German);

                    if (!string.IsNullOrEmpty(germanCountryName))
                    {
                        countryName = germanCountryName;
                    }
                }
            }

            return(countryName);
        }
Example #8
0
 // returns the root node which holds the settings
 public static bool settingsRoot(out DynamicNode n)
 {
     return(NodeFacade.findRootByType("Settings", out n));
 }