private ExpressionEvaluator GetExpressionEvaluator(CriteriaOperator criteria)
 {
     if (criteria.ToString() == lastCriteria)
         return lastEvaluator;
     lastCriteria = criteria.ToString();
     PropertyDescriptorCollection pdc = ((ITypedList)_View.DataSource).GetItemProperties(null);
     lastEvaluator = new ExpressionEvaluator(pdc, criteria, false);
     return lastEvaluator;
 }
        private ExpressionEvaluator GetExpressionEvaluator(CriteriaOperator criteria)
        {
            if (criteria.ToString() == lastCriteria)
            {
                return(lastEvaluator);
            }
            lastCriteria = criteria.ToString();
            PropertyDescriptorCollection pdc = ((ITypedList)_View.DataSource).GetItemProperties(null);

            lastEvaluator = new ExpressionEvaluator(pdc, criteria, false);
            return(lastEvaluator);
        }
Пример #3
0
        public override void SynchronizeModel()
        {
            Model.AutoExpandAllGroups = Control.OptionsBehavior.AutoExpandAllGroups;
            Model.IsGroupPanelVisible = Control.OptionsView.ShowGroupPanel;
            var modelListViewWin = Model;

            if (modelListViewWin != null)
            {
                (modelListViewWin).FilterEnabled = Control.ActiveFilterEnabled;
                if (!ReferenceEquals(Control.ActiveFilterCriteria, null) && _columnViewEditor.CollectionSource != null)
                {
                    (modelListViewWin).Filter = CriteriaOperator.ToString(Control.ActiveFilterCriteria);
                }
                else
                {
                    (modelListViewWin).Filter = null;
                }
            }
            var modelListViewShowAutoFilterRow = Model as IModelListViewShowAutoFilterRow;

            if (modelListViewShowAutoFilterRow != null)
            {
                (modelListViewShowAutoFilterRow).ShowAutoFilterRow = Control.OptionsView.ShowAutoFilterRow;
            }
            var modelListViewShowFindPanel = Model as IModelListViewShowFindPanel;

            if (modelListViewShowFindPanel != null)
            {
                (modelListViewShowFindPanel).ShowFindPanel = Control.IsFindPanelVisible;
            }
        }
Пример #4
0
    protected void ModifyFilterExpression(string FieldName, object value, ASPxCardView victim)
    {
        var criterias = CriteriaColumnAffinityResolver.SplitByColumnNames(CriteriaOperator.Parse(victim.FilterExpression)).Item2;

        BinaryOperatorType operatorType;

        if (FieldName == "ProductName")
        {
            operatorType = BinaryOperatorType.Like;
            value       += "%";
        }
        else
        {
            operatorType = BinaryOperatorType.Equal;
        }


        if (!criterias.Keys.Contains(FieldName))
        {
            criterias.Add(FieldName, new BinaryOperator(FieldName, value, operatorType));
        }
        else
        {
            criterias[FieldName] = new BinaryOperator(FieldName, value, operatorType);
        }
        victim.FilterExpression = CriteriaOperator.ToString(GroupOperator.And(criterias.Values));
    }
        public bool CodeRuleDefinifionEditingStringData_CRUD()
        {
            //Set data to input control
            //Guid selectedCodeRuleDataTypeId = Guid.Parse(cbCodeRuleDataType.SelectedItem.Value.ToString());
            //CodeRuleStringData codeRuleStringData =
            //    (CodeRuleStringData)codeRuleDataBO.GetCodeRuleData(session, CodeRuleDefinitionId, selectedCodeRuleDataTypeId);
            //if (codeRuleStringData != null)
            //{
            //    cbCodeRuleDataType.Value =
            //        codeRuleStringData.CodeRuleDataFormatId.CodeRuleDataTypeId.CodeRuleDataTypeId.ToString();

            //    SetCodeRuleDataFormatCriteria();

            //    cbCodeRuleDataFormat.Value =
            //        codeRuleStringData.CodeRuleDataFormatId.CodeRuleDataFormatId.ToString();
            //    txtStringValue.Text = codeRuleStringData.StringValue;
            //}
            //else
            //{
            //    SetCodeRuleDataFormatCriteria();
            //}

            SetCodeRuleDataFormatCriteria();

            dsCodeRuleData.TypeName = typeof(CodeRuleStringData).FullName;
            CriteriaOperator criteria = CriteriaOperator.And(
                new BinaryOperator("CodeRuleDataId", CodeRuleDataId),
                new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                );

            dsCodeRuleData.Criteria = criteria.ToString();
            formlayoutCodeRuleDefinitionEditingForm.DataBind();

            return(true);
        }
Пример #6
0
        private bool IsFilterEqual(CriteriaOperator filter1, CriteriaOperator filter2)
        {
            string filterString1 = (object)filter1 == null ? string.Empty : filter1.ToString();
            string filterString2 = (object)filter2 == null ? string.Empty : filter2.ToString();

            return(filterString1 == filterString2);
        }
    protected void ModifyFilterExpression(string FieldName, object value, ASPxGridView targetGrid)
    {
        var criterias = CriteriaColumnAffinityResolver.SplitByColumnNames(CriteriaOperator.Parse(targetGrid.FilterExpression)).Item2;

        CriteriaOperator co = null;

        if (FieldName == "ProductName")
        {
            value += "%";
            co     = new FunctionOperator("Like", new OperandProperty(FieldName), new OperandValue(value));
        }
        else
        {
            co = new BinaryOperator(FieldName, value, BinaryOperatorType.Equal);
        }
        if (!criterias.Keys.Contains(FieldName))
        {
            criterias.Add(FieldName, co);
        }
        else
        {
            criterias[FieldName] = co;
        }
        targetGrid.FilterExpression = CriteriaOperator.ToString(GroupOperator.And(criterias.Values));
    }
Пример #8
0
        private void SetCriteriaForOrganization()
        {
            //Get CUSTOMER trading type
            TradingCategory customerTradingCategory =
                NAS.DAL.Util.getXPCollection <TradingCategory>(session, "Code", "CUSTOMER").FirstOrDefault();
            //Get SUPPLIER trading type
            TradingCategory supplierTradingCategory =
                NAS.DAL.Util.getXPCollection <TradingCategory>(session, "Code", "SUPPLIER").FirstOrDefault();

            CriteriaOperator criteria = CriteriaOperator.And(
                CriteriaOperator.Or(
                    new ContainsOperator("OrganizationCategories",
                                         CriteriaOperator.And(
                                             new BinaryOperator("TradingCategoryId.TradingCategoryId", customerTradingCategory.TradingCategoryId),
                                             new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                                             )
                                         ),
                    new ContainsOperator("OrganizationCategories",
                                         CriteriaOperator.And(
                                             new BinaryOperator("TradingCategoryId.TradingCategoryId", supplierTradingCategory.TradingCategoryId),
                                             new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                                             )
                                         )
                    ),
                new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                );

            dsSourceOrg.Criteria = criteria.ToString();
            cbSourceOrganization.DataBindItems();
        }
Пример #9
0
        private void ShowFilterXpo()
        {
            CriteriaOperator criteria = ActiveFilterCriteria;

            new GenericMessageBox(criteria.ToString(),
                                  "Filter Criteria XPO Text");
        }
Пример #10
0
        public bool IsTheSame(FilterObjectbase right)
        {
            CriteriaOperator co  = GetCondition();
            CriteriaOperator cor = right.GetCondition();

            return((ReferenceEquals(null, co) ? "" : co.ToString()).Equals(ReferenceEquals(null, cor) ? "" : cor.ToString()));
        }
        public static IQueryable ApplyFilter(this IQueryable query, IList <GridViewGroupInfo> groupInfoList)
        {
            var criteria = GroupOperator.And(
                groupInfoList.Select(i => new BinaryOperator(i.FieldName, i.KeyValue, BinaryOperatorType.Equal))
                );

            return(query.ApplyFilter(CriteriaOperator.ToString(criteria)));
        }
Пример #12
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));
     }
 }
Пример #13
0
 public void Replace(ref CriteriaOperator criteriaOperator, string matchString, CriteriaOperator replaceOperator)
 {
     if (criteriaOperator.ToString() == matchString)
     {
         criteriaOperator = replaceOperator;
         return;
     }
     Extract(criteriaOperator, matchString, replaceOperator);
 }
Пример #14
0
 public void Remove(ref CriteriaOperator criteriaOperator, string removeString)
 {
     if (criteriaOperator.ToString() == removeString)
     {
         criteriaOperator = null;
         return;
     }
     Extract(criteriaOperator, removeString);
 }
Пример #15
0
 public void Remove(ref CriteriaOperator criteriaOperator, string removeString)
 {
     if (criteriaOperator.ToString() == removeString)
     {
         criteriaOperator = null;
         return;
     }
     Extract(criteriaOperator, removeString);
 }
Пример #16
0
 public void Replace(ref CriteriaOperator criteriaOperator, string matchString, CriteriaOperator replaceOperator)
 {
     if (criteriaOperator.ToString() == matchString)
     {
         criteriaOperator = replaceOperator;
         return;
     }
     Extract(criteriaOperator, matchString, replaceOperator);
 }
Пример #17
0
 protected override void Process(BinaryOperator theOperator)
 {
     if (!ReferenceEquals(_criteria, null) && !ReferenceEquals(theOperator, null) &&
         (_criteria.ToString() == theOperator.ToString()))
     {
         _match = true;
     }
     base.Process(theOperator);
 }
Пример #18
0
 internal static Expression <Func <TEntity, bool> > GetFilterExpression(CriteriaOperator criteria)
 {
     try {
         return(CriteriaOperatorToExpressionConverter.GetGenericWhere <TEntity>(criteria));
     }
     catch (Exception e) {
         throw new NotSupportedException("Error in Filter:" + CriteriaOperator.ToString(criteria), e);
     }
 }
Пример #19
0
 private void InitDataSource()
 {
     if (Strategy != null)
     {
         dsVoucherTransaction.TypeName = Strategy.GetConcreteVoucherType().FullName;
         CriteriaOperator criteria = Strategy.GetVoucherTransactionCriteria(VoucherId);
         dsVoucherTransaction.Criteria = criteria.ToString();
         gridviewAllocation.DataBind();
     }
 }
        public override object Authenticate(IObjectSpace objectSpace)
        {
            object user = objectSpace.FindObject(UserType, findUserCriteria);

            if (user == null)
            {
                throw new AuthenticationException(findUserCriteria.ToString());
            }
            return(user);
        }
Пример #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CriteriaOperator criteria = CriteriaOperator.And(
                new BinaryOperator("BillType", (byte)BillType),
                new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE, BinaryOperatorType.GreaterOrEqual)
                );

            dsSalesInvoice.Criteria = criteria.ToString();

            salesInvoiceEditingForm.BillType = BillType;
        }
Пример #22
0
        public void When_PropertyPath_Is_A_Collection_Without_Chain()
        {
            XPMemberInfo collectionMemberInfo = GetCollectionMemberInfo();

            Isolate.WhenCalled(() => XpandReflectionHelper.GetXpMemberInfo(null, "Orders")).WithExactArguments().WillReturn(collectionMemberInfo);
            var parser = new PropertyPathParser(null, Session.DefaultSession);

            CriteriaOperator criteriaOperator = parser.Parse("Orders", "Amount=50");

            Assert.AreEqual("[Orders][[Amount] = 50]", criteriaOperator.ToString());
        }
Пример #23
0
        public virtual void SaveUserData(State state)
        {
            SaveLayout(state, "GridLayout", EntityGridView);
            CriteriaOperator criteria = Context.GetFilter("GridFilter");

            state["Fileter"] = null;
            if ((object)criteria != null)
            {
                state["Fileter"] = criteria.ToString();
            }
            //SaveLayout(state, "DockManager", dockManager1);
        }
Пример #24
0
 private string GetHintPanelText(FiltersByCollectionWrapper filtersByCollectionWrapper, CriteriaOperator criteriaOperator)
 {
     if (!(ReferenceEquals(criteriaOperator, null)))
     {
         var wrapper = new LocalizedCriteriaWrapper(filtersByCollectionWrapper.BinaryOperatorLastMemberClassType, criteriaOperator);
         wrapper.UpdateParametersValues();
         CriteriaOperator userFriendlyFilter = CriteriaOperator.Clone(wrapper.CriteriaOperator);
         new FilterWithObjectsUserFrendlyStringProcessor(filtersByCollectionWrapper.BinaryOperatorLastMemberClassType).Process(userFriendlyFilter);
         return(userFriendlyFilter.ToString());
     }
     return(null);
 }
Пример #25
0
    public static FilterItem CreateItem(this Dictionary <string, FilterItem> self, string name, CriteriaOperator criteria, bool custom = false)
    {
        var key = string.Format("{0}_{1}", name, custom);

        if (!self.ContainsKey(key) || custom)
        {
            var expression = !object.ReferenceEquals(criteria, null) ? criteria.ToString() : string.Empty;
            self[key] = new FilterItem()
            {
                Name = name, Expression = expression, IsCustom = custom
            };
        }
        return(self[key]);
    }
Пример #26
0
        public static CriteriaOperator Parse(string propertyPath, CriteriaOperator criteriaOperator) {
            while (propertyPath.IndexOf(".", StringComparison.Ordinal) > -1) {
                propertyPath = propertyPath.Substring(0, propertyPath.IndexOf(".", StringComparison.Ordinal)) + "[" +
                               propertyPath.Substring(propertyPath.IndexOf(".", StringComparison.Ordinal) + 1) + "]";
            }
            for (int i = propertyPath.Length - 1; i > -1; i--)
                if (propertyPath[i] != ']') {
                    propertyPath = propertyPath.Substring(0, i + 1) + "[" + criteriaOperator.ToString() + "]" +
                                   new string(']', propertyPath.Length - i - 1);
                    break;
                }

            return CriteriaOperator.Parse(propertyPath);
        }
Пример #27
0
        public override void InitXpoDatasource(XpoDataSource datasource)
        {
            //Set TypeName
            datasource.TypeName = typeof(NAS.DAL.Nomenclature.Organization.Department).FullName;
            //Set Criteria
            CriteriaOperator criteria = CriteriaOperator.And(
                //row status is active
                new BinaryOperator("OrganizationId.OrganizationId", Utility.CurrentSession.Instance.AccessingOrganizationId),
                new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                );

            datasource.Criteria       = criteria.ToString();
            datasource.DefaultSorting = "Code";
        }
        void SetFilter(CriteriaOperator criteria)
        {
            xpCollection1.Criteria = criteria;

            if (ReferenceEquals(criteria, null))
            {
                labelControl1.Text = string.Empty;
            }
            else
            {
                labelControl1.Text = criteria.ToString();
            }
            labelControl2.Text = string.Format("Total row count: {0}", xpCollection1.Count);
        }
Пример #29
0
        protected string GetDisplayText(OperandProperty firstOperand, CriteriaOperator op)
        {
            OperandValue v = op as OperandValue;

            if (!ReferenceEquals(v, null))
            {
                return(node.OwnerControl.FilterColumns.GetValueScreenText(firstOperand, v.Value));
            }
            OperandProperty p = op as OperandProperty;

            if (!ReferenceEquals(p, null))
            {
                return(GetDisplayText(p));
            }
            return(CriteriaOperator.ToString(op));
        }
Пример #30
0
        private static object GetMetadata(CriteriaOperator @operator)
        {
            var type = @operator.GetType();
            var info = type.GetMember(@operator.ToString());

            if ((info != null) && (info.Length > 0))
            {
                var attrs = info[0].GetCustomAttributes(typeof(CriteriaOperatorMetadataAttribute), false);
                if ((attrs != null) && (attrs.Length > 0))
                {
                    return(attrs[0]);
                }
            }

            return(null);
        }
Пример #31
0
        public static CriteriaOperator Parse(string propertyPath, CriteriaOperator criteriaOperator)
        {
            while (propertyPath.IndexOf(".")>-1)
            {
                propertyPath = propertyPath.Substring(0, propertyPath.IndexOf(".")) + "[" +
                               propertyPath.Substring(propertyPath.IndexOf(".") + 1) + "]";
            }
            //            string replace = criteriaOperator.ToString().Replace("[","").Replace("]","").Replace(" ","");
            for (int i = propertyPath.Length-1; i > -1; i--)
                if (propertyPath[i] != ']')
                {
                    propertyPath = propertyPath.Substring(0, i+1) + "[" + criteriaOperator.ToString() + "]" +
                                   new string(']', propertyPath.Length - i-1);
                    break;
                }

            return CriteriaOperator.Parse(propertyPath);
        }
Пример #32
0
        public static CriteriaOperator Parse(string propertyPath, CriteriaOperator criteriaOperator)
        {
            while (propertyPath.IndexOf(".") > -1)
            {
                propertyPath = propertyPath.Substring(0, propertyPath.IndexOf(".")) + "[" +
                               propertyPath.Substring(propertyPath.IndexOf(".") + 1) + "]";
            }
            for (int i = propertyPath.Length - 1; i > -1; i--)
            {
                if (propertyPath[i] != ']')
                {
                    propertyPath = propertyPath.Substring(0, i + 1) + "[" + criteriaOperator.ToString() + "]" +
                                   new string(']', propertyPath.Length - i - 1);
                    break;
                }
            }

            return(CriteriaOperator.Parse(propertyPath));
        }
        public override void InitXpoDatasource(XpoDataSource datasource)
        {
            Session session = null;

            try
            {
                session = XpoHelper.GetNewSession();
                //Set TypeName
                datasource.TypeName = typeof(NAS.DAL.Nomenclature.Organization.Organization).FullName;
                //Set Criteria
                //Get CUSTOMER trading type
                TradingCategory customerTradingCategory =
                    session.FindObject <TradingCategory>(new BinaryOperator("Code", "CUSTOMER"));

                CriteriaOperator criteria = CriteriaOperator.And(
                    //row status is active
                    new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE),
                    //find customer and customer
                    new ContainsOperator("OrganizationCategories",
                                         CriteriaOperator.And(
                                             new BinaryOperator("TradingCategoryId.TradingCategoryId",
                                                                customerTradingCategory.TradingCategoryId),
                                             new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                                             )
                                         )
                    );

                datasource.Criteria       = criteria.ToString();
                datasource.DefaultSorting = "Code";
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (session != null)
                {
                    session.Dispose();
                }
            }
        }
        public void ApplyFindFilter(SearchInfoBase searchInfo)
        {
            if (searchInfo == null)
            {
                return;
            }
            SchedulerSearchInfo si = searchInfo as SchedulerSearchInfo;
            FilterCondition     filterCondition = si.FilterCondition;
            string searchtext = si.SearchText;

            if (searchtext == null)
            {
                ResetFilter();
                return;
            }

            CriteriaOperator filterCriteria = PrepareFilter(searchtext, filterCondition);

            this.Storage.Appointments.Filter = filterCriteria.ToString();
        }
Пример #35
0
        public override void InitXpoDatasource(XpoDataSource datasource)
        {
            Session session = null;

            try
            {
                session = XpoHelper.GetNewSession();
                //Set TypeName
                datasource.TypeName = typeof(NAS.DAL.Nomenclature.Organization.Organization).FullName;
                //Set Criteria
                OrganizationType subOrgOrganizationType =
                    Util.getXPCollection <OrganizationType>(session, "Name",
                                                            OrganizationTypeConstant.NAAN_CUSTOMER_SUB_ORGANIZATION.Value).FirstOrDefault();

                CriteriaOperator criteria = CriteriaOperator.And(
                    CriteriaOperator.Or(
                        new BinaryOperator("OrganizationId", Utility.CurrentSession.Instance.AccessingOrganizationId),
                        new BinaryOperator("OrganizationTypeId.OrganizationTypeId",
                                           subOrgOrganizationType.OrganizationTypeId)
                        ),
                    //row status is active
                    new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                    );

                datasource.Criteria       = criteria.ToString();
                datasource.DefaultSorting = "Code";
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (session != null)
                {
                    session.Dispose();
                }
            }
        }