Пример #1
0
        public static string GetFilterString(this FilterScheme scheme, Context ctx, FormMetadata metadata)
        {
            if (scheme.Scheme.IsNullOrEmptyOrWhiteSpace())
            {
                return(string.Empty);
            }

            //字段比较条件元数据。
            var filterMetadata = FormMetaDataCache.GetCachedFilterMetaData(ctx);

            //过滤模型:解析过滤方案
            ListFilterModel filterModel = new ListFilterModel();

            filterModel.FilterObject.FilterMetaData = filterMetadata;
            filterModel.SetContext(ctx, metadata.BusinessInfo, metadata.BusinessInfo.GetForm().GetFormServiceProvider());
            filterModel.InitFieldList(metadata, null);

            //把过滤方案的XML内容,反序列化为对象
            DcxmlSerializer dcxmlSerializer = new DcxmlSerializer(new PreInsertDataDcxmlBinder());
            SchemeEntity    schemeEntity    = dcxmlSerializer.DeserializeFromString(scheme.Scheme) as SchemeEntity;

            //利用ListFilterModel, 翻译过滤条件
            filterModel.FilterObject.Setting = schemeEntity.FilterSetting;
            string statement = filterModel.FilterObject.GetFilterSQLString(ctx, TimeServiceHelper.GetSystemDateTime(ctx));

            return(statement);
        } //end metthod
Пример #2
0
        public static object StringToDataEntity(IDataEntityType dt, string xml)
        {
            DcxmlSerializer serializer = new DcxmlSerializer(new IDataEntityType[] { dt });

            return(serializer.DeserializeFromString(xml, null));
        }