Beispiel #1
0
        private void BindFilterFile()
        {
            CriteriaOperator currentCriteria = _viewContext.GetFilter(_gridFilter);
            var viewItems = GetListFilterItems();
            var items     = viewItems.OrderBy(i => i.Order).ToList();
            GalleryItemGroup itemGroup = new GalleryItemGroup();

            foreach (var item in items)
            {
                GalleryItem galleryItem = new FilterGalleryItem(item);
                galleryItem.Caption    = item.DisplayName;
                galleryItem.Image      = WinFormsResourceService.GetBitmap("tag");
                galleryItem.HoverImage = galleryItem.Image;
                string filterString   = item.FilterString;
                bool   isCrietiaEqual = IsCriteriaOperatorEquals(currentCriteria, CriteriaOperator.TryParse(filterString));
                galleryItem.Checked = isCrietiaEqual;
                itemGroup.Items.Add(galleryItem);
            }
            if (!itemGroup.Items.Cast <GalleryItem>().Any(i => i.Checked) && itemGroup.Items.Count > 0)
            {
                itemGroup.Items.Cast <GalleryItem>().Last().Checked = true;
            }
            this.Gallery.Groups.Clear();
            this.Gallery.Groups.Add(itemGroup);
        }
Beispiel #2
0
        private void SaveFilter()
        {
            if (string.IsNullOrEmpty(this.ObjectName))
            {
                throw new Exception("ObjectName is empty in filter");
            }
            CriteriaOperator projectOperator   = Context.GetFilter("ProjectId");
            CriteriaOperator iterationOperator = Context.GetFilter("ProjectIterationId");
            CriteriaOperator memberOperator    = Context.GetFilter("MemberId");

            if (projectOperator != null)
            {
                _config.Set <string>(projectOperator.ToString(), this.ObjectName + ProjectConfigId);
            }
            if (iterationOperator != null)
            {
                _config.Set <string>(iterationOperator.ToString(), this.ObjectName + IterationConfigId);
            }
            if (memberOperator != null)
            {
                _config.Set <string>(memberOperator.ToString(), this.ObjectName + MemberConfigId);
            }
        }