示例#1
0
        /// <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, BQLCondition filterCondition)
        {
            ScopeList filter = new ScopeList();

            filter.Add(filterCondition);
            ShowChildItem item = new ShowChildItem();

            item.ChildItem   = prm;
            item.FilterScope = filter;
            base.Add(item);
        }