public static bool UpdateProductNode(int subjectId, string type, Dictionary <string, string> simplenode) { string filename = HttpContext.Current.Request.MapPath(HiContext.Current.GetPCHomePageSkinPath() + "/config/Products.xml"); bool result = false; XmlDocument productDocument = TagsHelper.GetProductDocument(); XmlNode xmlNode = TagsHelper.FindProductNode(subjectId, type); if (xmlNode != null) { foreach (KeyValuePair <string, string> item in simplenode) { xmlNode.Attributes[item.Key].Value = item.Value; } productDocument.Save(filename); new AspNetCache().Remove("SubjectProductFileCache-Admin"); result = true; } return(result); }
public static XmlNode FindProductNode(int subjectId, string type) { XmlDocument productDocument = TagsHelper.GetProductDocument(); return(productDocument.SelectSingleNode($"//Subject[@SubjectId='{subjectId}' and @Type='{type}']")); }