private static void Load() { if (loaded) { return; } loaded = true; var doc = new XmlDocument(); doc.LoadXml(NamingPeopleResource.PeopleNames); items.Clear(); foreach (XmlNode node in doc.SelectNodes("/root/item")) { var item = new PeopleNamesItem { Id = node.SelectSingleNode("id").InnerText, SchemaName = node.SelectSingleNode("names/schemaname").InnerText, GroupHeadCaption = node.SelectSingleNode("names/grouphead").InnerText, GroupCaption = node.SelectSingleNode("names/group").InnerText, GroupsCaption = node.SelectSingleNode("names/groups").InnerText, UserCaption = node.SelectSingleNode("names/user").InnerText, UsersCaption = node.SelectSingleNode("names/users").InnerText, UserPostCaption = node.SelectSingleNode("names/userpost").InnerText, RegDateCaption = node.SelectSingleNode("names/regdate").InnerText, GuestCaption = node.SelectSingleNode("names/guest").InnerText, GuestsCaption = node.SelectSingleNode("names/guests").InnerText, }; items.Add(item); } }
public static void SetPeopleNames(PeopleNamesItem custom) { var settings = SettingsManager.Instance.LoadSettings <PeopleNamesSettings>(TenantProvider.CurrentTenantID); custom.Id = PeopleNamesItem.CustomID; settings.ItemID = PeopleNamesItem.CustomID; settings.Item = custom; SettingsManager.Instance.SaveSettings <PeopleNamesSettings>(settings, TenantProvider.CurrentTenantID); }
public static void SetPeopleNames(PeopleNamesItem custom) { var settings = PeopleNamesSettings.Load(); custom.Id = PeopleNamesItem.CustomID; settings.ItemID = PeopleNamesItem.CustomID; settings.Item = custom; settings.Save(); }
public static void Load() { var path = HttpContext.Current.Server.MapPath("~/Core/Users/PeopleNames.xml"); var doc = new XmlDocument(); doc.Load(path); _items.Clear(); foreach (XmlNode node in doc.SelectNodes("/root/item")) { var item = new PeopleNamesItem(); item.Id = node.SelectSingleNode("id").InnerText; item.SortOrder = Convert.ToInt32(node.SelectSingleNode("sortorder").InnerText); item.SchemaName = node.SelectSingleNode("names/schemaname").InnerText; item.GlobalHeadCaption = node.SelectSingleNode("names/globalhead").InnerText; item.GroupHeadCaption = node.SelectSingleNode("names/grouphead").InnerText; item.GroupCaption = node.SelectSingleNode("names/group").InnerText; item.GroupsCaption = node.SelectSingleNode("names/groups").InnerText; item.UserCaption = node.SelectSingleNode("names/user").InnerText; item.UsersCaption = node.SelectSingleNode("names/users").InnerText; item.AddUsersCaption = node.SelectSingleNode("names/addusers").InnerText; item.UserPostCaption = node.SelectSingleNode("names/userpost").InnerText; item.RegDateCaption = node.SelectSingleNode("names/regdate").InnerText; var expNode = node.SelectSingleNode("exceptions"); if (expNode != null) { foreach (XmlNode lngNode in expNode.ChildNodes) { foreach (XmlNode lngExpNode in lngNode.ChildNodes) { item.Exceptions.Add(new PeopleNamesException() { LngISO2 = lngNode.Name, ResourcePath = lngExpNode.Attributes["key"].InnerText, Value = lngExpNode.InnerText }); } } } _items.Add(item); } _items.Sort((i1, i2) => Comparer <int> .Default.Compare(i1.SortOrder, i2.SortOrder)); _isLoad = true; }