/// <summary> /// 根据XML加载范围查找项 /// </summary> /// <param name="xml">XML</param> /// <param name="lstScope">范围集合</param> internal static void LoadScopeItems(Stream stm, ScopeList lstScope) { XmlDocument doc = new XmlDocument(); doc.Load(stm); XmlNodeList nodeList = doc.GetElementsByTagName("item"); foreach (XmlNode node in nodeList) { string propertyName = null; ScopeType stype = ScopeType.Between; ConnectType ctype = ConnectType.And; object value1 = null; object value2 = null; XmlAttribute attPropertyName = node.Attributes["propertyname"]; if (attPropertyName != null) { propertyName = attPropertyName.InnerText; } XmlAttribute attScopeType = node.Attributes["scopetype"]; if (attScopeType != null) { stype = (ScopeType)Convert.ToInt32(attScopeType.InnerText); } XmlAttribute attConnectType = node.Attributes["connecttype"]; if (attConnectType != null) { ctype = (ConnectType)Convert.ToInt32(attConnectType.InnerText); } foreach (XmlNode itemNode in node.ChildNodes) { object value = null; Type objType = null; XmlAttribute attType = itemNode.Attributes["datatype"]; if (attType != null) { objType = Type.GetType(attType.InnerText); } else { objType = typeof(string); } value = ListXMLExtends.StringToValue(itemNode.InnerText, objType); if (itemNode.Name == "value1") { value1 = value; } else if (itemNode.Name == "value2") { value2 = value; } } Scope objScope = new Scope(propertyName, value1, value2, stype, ctype); lstScope.Add(objScope); } }
/// <summary> /// 添加一个项 /// </summary> /// <param name="prm">查询子项</param> /// <param name="filter">筛选条件</param> public void Add(BQLEntityTableHandle prm, ScopeList filter) { ShowChildItem item = new ShowChildItem(); item.ChildItem = prm; item.FilterScope = filter; base.Add(item); }
/// <summary> /// 添加新条件的范围 /// </summary> /// <param name="lstScope">条件集合</param> /// <returns>返回是否添加成功</returns> public bool AddScopeList(ScopeList lstScope) { if (lstScope.HasInner) { HasInner = lstScope.HasInner; } this.Add(new Scope(null, lstScope, null, ScopeType.Scope, ConnectType.And)); return(true); }
/// <summary> /// 添加一个项 /// </summary> /// <param name="prm">查询子项</param> /// <param name="filter">筛选条件</param> public void Add(BQLEntityTableHandle prm, BQLCondition filterCondition) { ScopeList filter = new ScopeList(); filter.Add(filterCondition); ShowChildItem item = new ShowChildItem(); item.ChildItem = prm; item.FilterScope = filter; base.Add(item); }
/// <summary> /// 读取信息集合 /// </summary> /// <param name="info">信息</param> /// <returns></returns> public static void LoadScopeItems(string info, ScopeList lstScope, Encoding encode) { MemoryStream stm = new MemoryStream(); StreamWriter writer = new StreamWriter(stm, encode); try { writer.Write(info); writer.Flush(); stm.Position = 0; LoadScopeItems(stm, lstScope); } finally { writer.Close(); stm.Close(); } }
/// <summary> /// 返回集合项的XML字符串 /// </summary> /// <param name="items">集合项</param> /// <returns></returns> internal static string GetScopeXmlString(ScopeList lstScope, Encoding encode) { string ret = null; MemoryStream stm = new MemoryStream(); GetScopeXml(lstScope, encode, stm); StreamReader reader = new StreamReader(stm, encode); try { stm.Position = 0; ret = reader.ReadToEnd(); } finally { reader.Close(); stm.Close(); } return(ret); }
/// <summary> /// 获取范围List的XML /// </summary> /// <param name="lstScope">范围集合</param> /// <param name="encode">编码</param> /// <returns></returns> internal static void GetScopeXml(ScopeList lstScope, Encoding encode, Stream stm) { XmlDocument doc = new XmlDocument(); string strxmlBase = ""; strxmlBase += "<?xml version=\"1.0\" encoding=\"" + encode.BodyName + "\" ?>"; strxmlBase += "<root></root>"; doc.LoadXml(strxmlBase); XmlNode rootNode = doc.GetElementsByTagName("root")[0]; foreach (Scope objScope in lstScope) { XmlElement ele = doc.CreateElement("item"); //添加属性 XmlAttribute attPropertyName = doc.CreateAttribute("propertyname"); attPropertyName.InnerText = objScope.PropertyName; ele.Attributes.Append(attPropertyName); XmlAttribute attScopeType = doc.CreateAttribute("scopetype"); attScopeType.InnerText = ((int)objScope.ScopeType).ToString(); ele.Attributes.Append(attScopeType); XmlAttribute attConnectType = doc.CreateAttribute("connecttype"); attConnectType.InnerText = ((int)objScope.ConnectType).ToString(); ele.Attributes.Append(attConnectType); //添加值 if (objScope.Value1 != null) { AppendValue(doc, ele, "value1", objScope.Value1, objScope); } if (objScope.Value2 != null) { AppendValue(doc, ele, "value2", objScope.Value2, objScope); } rootNode.AppendChild(ele); } doc.Save(stm); }
public SortList(ScopeList lstScope) : base() { _lstScope = lstScope; }
private ScopeList _belongList;//所属的集合 /// <summary> /// 要现实的实体集合 /// </summary> /// <param name="belong"></param> internal ShowEntityCollection(ScopeList belong) { _belongList = belong; }
/// <summary> /// 添加新条件的范围 /// </summary> /// <param name="lstScope">条件集合</param> /// <param name="conntype">连接类型</param> /// <returns>返回是否添加成功</returns> public bool AddScopeList(ScopeList lstScope, ConnectType conntype) { this.Add(new Scope(null, lstScope, null, ScopeType.Scope, conntype)); return(true); }
/// <summary> /// 读取信息集合 /// </summary> /// <param name="info">信息</param> /// <returns></returns> public static void LoadScopeItems(string info, ScopeList lstScope) { LoadScopeItems(info, lstScope, ListXMLExtends.defaultEncoding); }
/// <summary> /// 返回集合项的XML字符串 /// </summary> /// <param name="items">集合项</param> /// <returns></returns> internal static string GetScopeXmlString(ScopeList lstScope) { return(GetScopeXmlString(lstScope, ListXMLExtends.defaultEncoding)); }
public ScopePropertyCollection(ScopeList belong) { _belong = belong; }