/// <summary> ///选中的行政代码 /// </summary> /// <param name="items"></param> public static void SaveDMToHibernate(IList <PropertyNodeItem> items) { IList <string> expanded = new List <string>(); IList <string> selected = new List <string>(); foreach (PropertyNodeItem item in items) { foreach (PropertyNodeItem child in item.FindChildAll()) { if (child.IsExpanded) { expanded.Add(child.Name); } if (child.IsSelected != null && child.IsSelected.Value) { selected.Add(child.Name); } } } HibernateUtils hibernate = HibernateUtils.GetInstance(); string ex = Utils.ListToString(expanded, "、"); hibernate.SaveEntity(new SoftwareConfig("xzdmExpanded", ex)); string sel = Utils.ListToString(selected, "、"); hibernate.SaveEntity(new SoftwareConfig("xzdmSelected", sel)); }
/// <summary> /// 刷新实体 /// </summary> /// <param name="key"></param> /// <param name="value"></param> public static void Refresh(string key, string value) { SoftwareConfig config = FindConfig(key); if (config == null) { config = new SoftwareConfig(key, value); hibernateUtils.SaveEntity(config); } else { if (!config.Value.Equals(value)) { config.Value = value; hibernateUtils.SaveEntity(config); } } }