Example #1
0
        public static bool UpdateNewAdNode(string aId, string type, System.Collections.Generic.Dictionary <string, string> adnode, out Dictionary <string, string> common_ImageNewAdCtrAttr)
        {
            common_ImageNewAdCtrAttr = new Dictionary <string, string>();
            bool        result     = false;
            XmlDocument adDocument = TagsHelper.GetAdDocument();
            XmlNode     xmlNode    = TagsHelper.FindNewAdNode(aId, type);

            if (xmlNode != null)
            {
                foreach (System.Collections.Generic.KeyValuePair <string, string> current in adnode)
                {
                    xmlNode.Attributes[current.Key].Value = current.Value;
                }
                string filename = HttpContext.Current.Request.MapPath(HiContext.Current.GetSkinPath() + "/config/Ads.xml");
                common_ImageNewAdCtrAttr.Add("DivCss", xmlNode.Attributes["DivCss"].Value);
                common_ImageNewAdCtrAttr.Add("ImgStyle", xmlNode.Attributes["ImgStyle"].Value);
                common_ImageNewAdCtrAttr.Add("ImageAttr", xmlNode.Attributes["ImageAttr"].Value);
                adDocument.Save(filename);
                TagsHelper.RemoveAdNodeCache();
                result = true;
            }
            else
            {
                XmlElement xmlel = TagsHelper.CreateNewAdNode(aId, type, adnode);
                adDocument.DocumentElement.AppendChild(xmlel);
                string filename = HttpContext.Current.Request.MapPath(HiContext.Current.GetSkinPath() + "/config/Ads.xml");
                adDocument.Save(filename);
                TagsHelper.RemoveAdNodeCache();
                result = true;
            }
            return(result);
        }
Example #2
0
        public static XmlElement CreateNewAdNode(string newads, string type, System.Collections.Generic.Dictionary <string, string> newadsAttrs)
        {
            XmlDocument adDocument = TagsHelper.GetAdDocument();
            XmlElement  xml        = adDocument.CreateElement("Ad");

            xml.SetAttribute("Type", type);
            xml.SetAttribute("Id", newads);
            foreach (string s in newadsAttrs.Keys)
            {
                xml.SetAttribute(s, newadsAttrs[s]);
            }
            if (!newadsAttrs.ContainsKey("DivCss"))
            {
                xml.SetAttribute("DivCss", "");
            }
            if (!newadsAttrs.ContainsKey("ImgStyle"))
            {
                xml.SetAttribute("ImgStyle", "");
            }
            if (!newadsAttrs.ContainsKey("ImageAttr"))
            {
                xml.SetAttribute("ImageAttr", "");
            }
            return(xml);
        }
Example #3
0
        public static bool UpdateAdNode(int aId, string type, System.Collections.Generic.Dictionary <string, string> adnode)
        {
            bool        result     = false;
            XmlDocument adDocument = TagsHelper.GetAdDocument();
            XmlNode     xmlNode    = TagsHelper.FindAdNode(aId, type);

            if (xmlNode != null)
            {
                if (adnode.ContainsKey("Id"))
                {
                    adnode.Remove("Id");
                }
                foreach (System.Collections.Generic.KeyValuePair <string, string> current in adnode)
                {
                    xmlNode.Attributes[current.Key].Value = current.Value;
                }
                string filename = HttpContext.Current.Request.MapPath(HiContext.Current.GetSkinPath() + "/config/Ads.xml");
                adDocument.Save(filename);
                TagsHelper.RemoveAdNodeCache();
                result = true;
            }
            return(result);
        }
Example #4
0
        public static XmlNode FindNewAdNode(string id, string type)
        {
            XmlDocument adDocument = TagsHelper.GetAdDocument();

            return(adDocument.SelectSingleNode(string.Format("//Ad[@Id='{0}' and @Type='{1}']", id, type)));
        }