Exemplo n.º 1
0
        public void GetFilterSQL()
        {
            //QueryParameterInfo[]  parInfos = new MB.Util.Serializer.QueryParameterXmlSerializer().DeSerializer(xmlFilterParams);
            //string sqlFilter = MB.Orm.DbSql.SqlShareHelper.Instance.QueryParametersToSqlString(null, parInfos);


            QueryParameterInfo info1 = new QueryParameterInfo("Code", "111", Util.DataFilterConditions.Equal);
            QueryParameterInfo info2 = new QueryParameterInfo("Date", "222", Util.DataFilterConditions.Between);

            info2.Value2 = "333";
            QueryParameterInfo info3 = new QueryParameterInfo("Name", "4444", Util.DataFilterConditions.Like);

            QueryParameterInfo[] parInfos = new QueryParameterInfo[3];
            parInfos[0] = info1;
            parInfos[1] = info2;
            parInfos[2] = info3;


            string sqlFilter = MB.Orm.DbSql.SqlShareHelper.Instance.QueryParametersToSqlString(null, parInfos);

            string xmlFilterParams = @"<FilterRoot AdvanceFilter='False'><Parameter><PropertyName>CREATE_DATE</PropertyName><Value><![CDATA[2007/5/3 0:00:00]]></Value><Value2><![CDATA[2012/5/17 0:00:00]]></Value2><Condition>Between</Condition><DataType>DateTime</DataType><OrderIndex>0</OrderIndex><Limited>False</Limited><MultiValue>False</MultiValue></Parameter><Parameter><PropertyName>LAST_MODIFIED_DATE</PropertyName><Value><![CDATA[2007/5/17 0:00:00]]></Value><Value2><![CDATA[2012/5/17 0:00:00]]></Value2><Condition>Between</Condition><DataType>DateTime</DataType><OrderIndex>0</OrderIndex><Limited>False</Limited><MultiValue>False</MultiValue></Parameter></FilterRoot>";

            parInfos = new MB.Util.Serializer.QueryParameterXmlSerializer().DeSerializer(xmlFilterParams);

            sqlFilter = MB.Orm.DbSql.SqlShareHelper.Instance.QueryParametersToSqlString(null, parInfos);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 动态聚组查询获取数据
 /// </summary>
 /// <param name="setting"></param>
 /// <param name="xmlFilterParams"></param>
 /// <returns></returns>
 public virtual System.Data.DataSet GetDynamicGroupQueryData(MB.Util.Model.DynamicGroupSetting setting, string xmlFilterParams)
 {
     using (MB.Orm.DB.OperationDatabaseScope scope = new OperationDatabaseScope(true)) {
         QueryParameterInfo[] filters = new MB.Util.Serializer.QueryParameterXmlSerializer().DeSerializer(xmlFilterParams);
         return(new ObjectEditHelper().GetDynamicGroupQueryData(setting, filters));
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// 根据过滤的条件获取指定类型实体对象的集合。
 /// </summary>
 /// <param name="xmlFilterParams">QueryParameterInfo[] 系列化后的字符窜</param>
 /// <returns>得到的实体集合</returns>  // [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
 public virtual IList GetObjects(int dataInDocType, string xmlFilterParams)
 {
     using (MB.Orm.DB.OperationDatabaseScope scope = new OperationDatabaseScope(true)) {
         QueryParameterInfo[] filters = new MB.Util.Serializer.QueryParameterXmlSerializer().DeSerializer(xmlFilterParams);
         var qh = MessageHeaderHelper.GetQueryBehavior(_MessageHeaderKey); //modify by aifang 动态列设置  var qh = MessageHeaderHelper.GetQueryBehavior();
         return(new ObjectEditHelper(qh).GetObjects <System.Object>(this, ConvertDataInDocType(dataInDocType), filters));
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 系列为XML 字符窜。
        /// </summary>
        /// <returns></returns>
        public string SerializerToXmlString()
        {
            if (_XmlSerializer == null)
            {
                _XmlSerializer = new MB.Util.Serializer.QueryParameterXmlSerializer();
            }

            return(_XmlSerializer.Serializer(_DataList.ToArray()));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 提供对象数组转换为集合类的处理。
        /// </summary>
        /// <param name="xmlFilterParams">查询参数系列化字符窜</param>
        public QueryParameterHelper(string xmlFilterParams)
        {
            if (_XmlSerializer == null)
            {
                _XmlSerializer = new MB.Util.Serializer.QueryParameterXmlSerializer();
            }
            var filters = _XmlSerializer.DeSerializer(xmlFilterParams);

            _DataList = new List <QueryParameterInfo>(filters);
        }
Exemplo n.º 6
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            //frmTestMain frm = new frmTestMain();
            //frm.ShowDialog();
            // Form2 frm = new Form2();
            // frm.ShowDialog();

            List <MB.Util.Model.QueryParameterInfo> pars = new List <QueryParameterInfo>();

            pars.Add(new QueryParameterInfo("Name", "站三", DataFilterConditions.Equal));
            pars.Add(new QueryParameterInfo("Code", "站三234525", DataFilterConditions.GreaterOrEqual));
            pars.Add(new QueryParameterInfo("Address", "站三2352525", DataFilterConditions.Equal));

            MB.Util.Serializer.QueryParameterXmlSerializer s = new MB.Util.Serializer.QueryParameterXmlSerializer();
            string xml = s.Serializer(pars.ToArray());

            MB.Util.Model.QueryParameterInfo[] pp = s.DeSerializer(xml);
        }