public static bool UpdateAdNode(int aId, string type, Dictionary <string, string> adnode) { bool result = false; XmlDocument adDocument = TagsHelper.GetAdDocument(); XmlNode xmlNode = TagsHelper.FindAdNode(aId, type); if (xmlNode != null) { foreach (KeyValuePair <string, string> item in adnode) { xmlNode.Attributes[item.Key].Value = item.Value; } string filename = HttpContext.Current.Request.MapPath(HiContext.Current.GetPCHomePageSkinPath() + "/config/Ads.xml"); adDocument.Save(filename); new AspNetCache().Remove("AdFileCache-Admin"); result = true; } return(result); }
public static XmlNode FindAdNode(int id, string type) { XmlDocument adDocument = TagsHelper.GetAdDocument(); return(adDocument.SelectSingleNode($"//Ad[@Id='{id}' and @Type='{type}']")); }