示例#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);
        }
示例#2
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);
        }