Beispiel #1
0
        void analysisEditor_DataSourceCreating(object sender, DataSourceCreatingEventArgs e)
        {
            CriteriaOperator userCriteria = null;

            if (e.AnalysisInfo != null)
            {
                if (!string.IsNullOrEmpty(e.AnalysisInfo.Criteria))
                {
                    using (ObjectSpace.CreateParseCriteriaScope()) {
                        userCriteria = CriteriaWrapper.ParseCriteriaWithReadOnlyParameters(e.AnalysisInfo.Criteria, e.AnalysisInfo.DataType);
                    }
                }

                var analysisEditorBase   = (AnalysisEditorBase)sender;
                var criteriaOperatorArgs = new CriteriaOperatorArgs(analysisEditorBase, e.AnalysisInfo);
                var analysisEditorArgs   = new AnalysisEditorArgs(analysisEditorBase, e.AnalysisInfo);
                InvokeDatasourceCreating(analysisEditorArgs);
                InvokeApplyingCollectionCriteria(criteriaOperatorArgs);
                e.DataSource = analysisEditorArgs.Handled
                                   ? analysisEditorArgs.DataSource
                                   : ObjectSpace.CreateCollection(e.AnalysisInfo.DataType,
                                                                  userCriteria & criteriaOperatorArgs.Criteria & _criteriaOperator);
                e.Handled = true;
                InvokeDataSourceCreated(analysisEditorArgs);
            }
        }
Beispiel #2
0
 private string GetCriteriaFromView()
 {
     using (ObjectSpace.CreateParseCriteriaScope()) {
         var criteriaWrapper = new CriteriaWrapper(View.ObjectTypeInfo.Type, View.Model.Filter, false);
         new FilterWithObjectsProcessor(ObjectSpace).Process(criteriaWrapper.CriteriaOperator, FilterWithObjectsProcessorMode.StringToObject);
         return(CriteriaOperator.ToString(criteriaWrapper.CriteriaOperator));
     }
 }