Пример #1
0
        private ObjectCollection searchAttribute(List <ObjectMaskDescription> Attributes)
        {
            ObjectCollection      AttObj = null;
            MultiFilterExpression fa     = myApplication.CreateMultiFilter();
            int i = 0;

            foreach (var item in Attributes)
            {
                i++;
                FilterExpression fe = myApplication.CreateFilter();
                fe.Add(AttributeId.Designation, BinaryOperator.Equal, item.Name);
                fa.AddFilter(fe);
            }
            return(AttObj);
        }
            private List <ObjectCollection> searchAttribute(List <ObjectMaskDescription> Attributes)
            {
                ObjectCollection        AttObj     = null;
                List <ObjectCollection> AttObjList = new List <ObjectCollection>();
                MultiFilterExpression   fa         = myApplication.CreateMultiFilter();
                int i = 0;

                try
                {
                    if (Attributes.Count != 0)
                    {
                        foreach (var item in Attributes)
                        {
                            i++;
                            FilterExpression fe = myApplication.CreateFilter();
                            var sxc             = (int)item.ID;
                            //fe.FindById((AttributeId)sxc);
                            fe.Add((AttributeId.Aid), BinaryOperator.Equal, sxc);
                            fa.AddFilter(fe);
                            if (i == 25)
                            {
                                AttObj = myApplication.Folders.Attributes.FindObjects(fa, true);
                                fe     = myApplication.CreateFilter();
                                AttObjList.Add(AttObj);
                            }
                            else if (i == 50)
                            {
                                AttObj = myApplication.Folders.Attributes.FindObjects(fa, true);
                                fe     = myApplication.CreateFilter();
                                AttObjList.Add(AttObj);
                            }
                        }
                        AttObj = myApplication.Folders.Attributes.FindObjects(fa, SearchBehavior.Deep);

                        var t = from u in AttObj from k in Attributes where u.Name != k.Name select k;
                        AttObjList.Add(AttObj);
                    }
                }
                catch { System.Windows.MessageBox.Show("Finding Attribute Failed", "System Error", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error); }
                return(AttObjList);
            }