示例#1
0
        private void LoadSettings(XmlDocument doc)
        {
            XmlNodeList xmlNL = doc.SelectNodes("config/domain/plans/plan");

            //===Load Plans=====================
            foreach (XmlNode node in xmlNL)
            {
                int strartingFrom = 0;
                //  Dictionary<int, int> plan = new Dictionary<int, int>();
                if (node.Attributes["startingfrom"] != null && node.Attributes["startingfrom"].Value != "")
                {
                    strartingFrom = int.Parse(node.Attributes["startingfrom"].Value);
                }

                Plan plan = new Plan(strartingFrom);
                foreach (XmlNode child in node.ChildNodes)
                {
                    plan.AddItem(int.Parse(child.Attributes["year"].Value), int.Parse(child.Attributes["price"].Value));
                }
                plans.Add(int.Parse(node.Attributes["id"].Value), plan);
            }

            //=========Load tlds(ALL,recommend,sidebar) and link =============
            xmlNL = doc.SelectNodes("config/domain/tlds/tld");

            foreach (XmlNode node in xmlNL)
            {
                allTlds.Add(node.InnerText, int.Parse(node.Attributes["planid"].Value));
                if (node.Attributes["recommend"] != null && bool.Parse(node.Attributes["recommend"].Value))
                {
                    recommendTlds.Add(node.InnerText);
                }

                if (node.Attributes["sidebar"] != null && bool.Parse(node.Attributes["sidebar"].Value))
                {
                    sideBarTLDs.Add(node.InnerText);
                }
            }

            //===Load NmaeServers=====================
            xmlNL = doc.SelectNodes("config/domain/namesevers/nameserver");

            foreach (XmlNode node in xmlNL)
            {
                nameServers.Add(node.InnerText);
            }
        }
示例#2
0
        private void LoadSettings(XmlDocument doc)
        {
            XmlNodeList xmlNL = doc.SelectNodes("config/webhosting/plans/plan");

            //===Load Plans=====================
            foreach (XmlNode node in xmlNL)
            {
                int strartingFrom = 0;
                if (node.Attributes["startingprice"] != null && node.Attributes["startingprice"].Value != "")
                {
                    strartingFrom = int.Parse(node.Attributes["startingprice"].Value);
                }
                Plan plan = new Plan(strartingFrom);

                foreach (XmlNode child in node.ChildNodes)
                {
                    plan.AddItem(int.Parse(child.Attributes["year"].Value), int.Parse(child.Attributes["price"].Value));
                }
                plans.Add(int.Parse(node.Attributes["id"].Value), plan);
            }
        }