Пример #1
0
        private void CreateActiveFilterCriteria(NodeEventArgs e)
        {
            List <CriteriaOperator> listCriteriaOperator = new List <CriteriaOperator>();

            treelist.NodesIterator.DoLocalOperation((node) => {
                node.CheckState = e.Node.CheckState;
            }
                                                    , e.Node.Nodes);
            treelist.NodesIterator.DoOperation((node) =>
            {
                if (node.Level == 0)
                {
                    SetCheckNode(node);
                    if (node.Checked)
                    {
                        listCriteriaOperator.Add(GetFilterCriteriaByControlState(node));
                    }
                    else
                    {
                        treelist.NodesIterator.DoLocalOperation((childNode) =>
                        {
                            AddCriteria(childNode, listCriteriaOperator);
                        }, node.Nodes);
                    }
                }
            });
            this.View.ActiveFilterCriteria = GroupOperator.Or(listCriteriaOperator);
        }
Пример #2
0
//
        public override IEnumerator <gcrCodifDeal> GetEnumerator()
        {
            crmCParty user_party = null;

            if (crmUserParty.CurrentUserParty != null)
            {
                if (crmUserParty.CurrentUserParty.Value != null)
                {
                    user_party = (crmCParty)crmUserParty.CurrentUserPartyGet(this.session).Party;
                }
            }

            XPCollection <crmContractDeal> deals = new XPCollection <crmContractDeal>(
                PersistentCriteriaEvaluationBehavior.BeforeTransaction, this.session,
                GroupOperator.Or(
                    new BinaryOperator("Current.Customer.Party", user_party, BinaryOperatorType.Equal),
                    new BinaryOperator("Current.Supplier.Party", user_party, BinaryOperatorType.Equal)
                    )
                );

//            IList<gcrCodifDeal> result = new List<gcrCodifDeal>(10000);
//            foreach (crmContractDeal ldeal in deals) {
//                result.Add(new gcrCodifDeal(this.session, ldeal.Contract, user_party, ldeal));
//            }
            //            foreach ()
//            return GetQuery().GetEnumerator();
            return(deals.Select <crmContractDeal, gcrCodifDeal>(
                       x => new gcrCodifDeal(this.session, x.Contract, user_party, x)
                       ).GetEnumerator());
        }
        CriteriaOperator PrepareFilter(string searchString, FilterCondition condition)
        {
            switch (condition)
            {
            case FilterCondition.Contains:
                return(GroupOperator.Or(new FunctionOperator(FunctionOperatorType.Contains, "Subject", searchString),
                                        new FunctionOperator(FunctionOperatorType.Contains, "Location", searchString)));

            case FilterCondition.StartsWith:
                return(GroupOperator.Or(new FunctionOperator(FunctionOperatorType.StartsWith, new OperandProperty("Subject"), searchString),
                                        new FunctionOperator(FunctionOperatorType.StartsWith, new OperandProperty("Location"), searchString)));

            case FilterCondition.Like:
                return(GroupOperator.Or(new FunctionOperator(FunctionOperatorType.Contains, new OperandProperty("Subject"), searchString),
                                        new FunctionOperator(FunctionOperatorType.Contains, new OperandProperty("Location"), searchString)));

            case FilterCondition.Default:
                return(GroupOperator.Or(new FunctionOperator(FunctionOperatorType.Contains, new OperandProperty("Subject"), searchString),
                                        new FunctionOperator(FunctionOperatorType.Contains, new OperandProperty("Location"), searchString)));

            case FilterCondition.Equals:
                return(GroupOperator.Or(new BinaryOperator("Subject", searchString, BinaryOperatorType.Equal),
                                        new BinaryOperator("Location", searchString, BinaryOperatorType.Equal)));

            default:
                return(null);
            }
        }
Пример #4
0
        protected override void OnActivated()
        {
            base.OnActivated();
            var instance = ObjectSpace.FindObject <CompanySeller>(new BinaryOperator("Oid", SecuritySystem.CurrentUserId));

            if ((View is ListView) & (View.ObjectTypeInfo.Type == typeof(Invoice)))
            {
                ((ListView)View).CollectionSource.Criteria["Filter1"] = new BinaryOperator("Subsidiary", instance.Subsidiary);;
            }
            else
            if ((View is ListView) & (View.ObjectTypeInfo.Type == typeof(Product)))
            {
                CriteriaOperator op = GroupOperator.Or(new BinaryOperator("Subsidiary", instance.Subsidiary), new BinaryOperator("IsGlobal", true));
                ((ListView)View).CollectionSource.Criteria["InvoiceFilter"] = op;
            }
            // Perform various tasks depending on the target View.
        }
Пример #5
0
        public ActionResult Index()
        {
            #region --- Criteria Operator (parse), Group Operator, Binary Operator, Between Operator ---
            //1. binary with condition
            BinaryOperator          filter       = new BinaryOperator("Age", "23");
            XPCollection <Customer> dataCustomer = new XPCollection <Customer>(session, filter);

            BinaryOperator          filter1       = new BinaryOperator();
            XPCollection <Customer> dataCustomer1 = new XPCollection <Customer>(session, filter1);

            //2. Criteria Operator, Group Operator
            CriteriaOperator        filter2       = CriteriaOperator.Parse("Age < 20");
            CriteriaOperator        filter3       = CriteriaOperator.Parse("Age > 30");
            XPCollection <Customer> dataCustomer2 = new XPCollection <Customer>(session, GroupOperator.Or(filter2, filter3));



            CriteriaOperator        filter4       = CriteriaOperator.Parse("Age > 20");
            CriteriaOperator        filter5       = CriteriaOperator.Parse("Age < 30");
            XPCollection <Customer> dataCustomer3 = new XPCollection <Customer>(session, GroupOperator.And(filter4, filter5));

            //3. Between Operator
            CriteriaOperator        filter6       = new BetweenOperator("Age", 20, 30);
            XPCollection <Customer> dataCustomer4 = new XPCollection <Customer>(session, filter6);

            //4. Contain Operator ???
            //ContainsOperator filter7 = new ContainsOperator("Name","on");
            //XPCollection<Customer> dataCustomer5 = new XPCollection<Customer>(session, filter7);

            //5. In Operator
            //xpCollection1.Filter = new InOperator("Name", new string[] {"John", "Mike", "Nick"});

            #endregion
            return(View());
        }