//------------------------------------------------------------------ public bool DeleteModule(int moduleID) { bool res = false; XmlNodeList nodesList = XmlDoc.SelectNodes("/SiteUsersDataModules/Module[@ModuleTypeID='" + moduleID + "']"); foreach (XmlNode module in nodesList) { XmlNode parentnode = module.ParentNode; parentnode.RemoveChild(module); } //XmlDoc.Save(DCServer.MapPath("~") + SiteDesign.ModulesOptionsConfigs + "SiteUsersDataModules.config"); SiteConfigurationManager.UpdateSiteUsersDataModules(XmlDoc); res = true; return(res); }
//------------------------------------------------------------------ public bool UpdateModule(UsersDataGlobalOptions usersDataModule) { bool res = false; XmlNodeList nodesList = XmlDoc.SelectNodes("/SiteUsersDataModules/Module[@ModuleTypeID='" + usersDataModule.ModuleTypeID + "']"); if (nodesList.Count == 1) { XmlElement oldModuleNode = (XmlElement)nodesList[0]; oldModuleNode.Attributes.RemoveAll(); PopulateXmlNodeFromModule(usersDataModule, oldModuleNode); //XmlDoc.Save(DCServer.MapPath("~") + SiteDesign.ModulesOptionsConfigs+"SiteUsersDataModules.config"); SiteConfigurationManager.UpdateSiteUsersDataModules(XmlDoc); res = true; } return(res); }
public bool AddModule(UsersDataGlobalOptions usersDataModule) { bool res = false; XmlNodeList nodeList = XmlDoc.SelectNodes("/SiteUsersDataModules/Module[@ModuleTypeID='" + usersDataModule.ModuleTypeID + "']"); if (nodeList.Count == 0) { //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx XmlElement xmlNewModule = XmlDoc.CreateElement("Module"); xmlNewModule = PopulateXmlNodeFromModule(usersDataModule, xmlNewModule); XmlNode commonParent = XmlDoc.SelectSingleNode("/SiteUsersDataModules"); commonParent.AppendChild(xmlNewModule); //XmlDoc.Save(DCServer.MapPath("~") + SiteDesign.ModulesOptionsConfigs+"SiteUsersDataModules.config"); SiteConfigurationManager.UpdateSiteUsersDataModules(XmlDoc); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx res = true; } return(res); }