Esempio n. 1
0
 public void BaseConstructor()
 {
     FiltersGroup fg = new FiltersGroup ();
     Assert.IsInstanceOfType (typeof(IList<IFilter>), fg.Filters);
     Assert.IsEmpty (fg.Filters);
     Assert.AreEqual (Concatenation.And, fg.Concatenator);
 }
Esempio n. 2
0
        public void BaseConstructor()
        {
            FiltersGroup fg = new FiltersGroup();

            Assert.IsInstanceOfType(typeof(IList <IFilter>), fg.Filters);
            Assert.IsEmpty(fg.Filters);
            Assert.AreEqual(Concatenation.And, fg.Concatenator);
        }
Esempio n. 3
0
        public AnalysisViewItem(string name, FiltersGroup group, string from, string to)
        {
            InitializeComponent();
            _group             = group;
            RepresentativeName = name;

            Show(from, to);
        }
Esempio n. 4
0
        public EditFiltersGroup()
        {
            InitializeComponent();
            var group = new FiltersGroup("");

            RepresentativeName = Properties.strings.addFiltersGroupRN;
            Init(group);
        }
Esempio n. 5
0
 public Groups(FiltersGroup group, List <IOperation> operations)
 {
     ListOfGroups = new List <Group>();
     Group        = group;
     Group.Items.Sort((x, y) => x.Value.CompareTo(y.Value));
     foreach (var item in group.Items)
     {
         if (item.Key is Filter key)
         {
             ListOfGroups.Add(new Group(key, operations));
         }
     }
 }
Esempio n. 6
0
        private UIElement GroupToStackPanel(FiltersGroup groups)
        {
            var result = new StackPanel
            {
                Orientation = Orientation.Vertical,
                Margin      = new Thickness(0, 0, 0, 0),
            };

            var borderGroup = new Border
            {
                Style           = (Style)FindResource("MyBorderMedium"),
                BorderThickness = new Thickness(1, 1, 1, 1),
                Height          = RefHeight,
            };

            borderGroup.Child = GroupHeaderToStackPanel(groups);
            result.Children.Add(CreateButtonWithBorderContent(borderGroup, groups, borderGroup.Child, "MyMediumGrey", new Thickness(0, 0, 0, 0), ClickInGroup));

            var stackPanel = new StackPanel
            {
                Orientation         = Orientation.Vertical,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin = new Thickness(0, 0, 0, 0)
            };

            foreach (var item in groups.Items)
            {
                switch (item.Key)
                {
                case FiltersGroup key:
                    stackPanel.Children.Add(GroupToBorder(key));
                    break;

                case Filter filter:
                    stackPanel.Children.Add(FilterToBorder(filter));
                    break;
                }
            }

            result.Children.Add(stackPanel);

            result.Children[1].Visibility = Visibility.Collapsed;

            return(result);
        }
Esempio n. 7
0
        private UIElement GroupToBorder(FiltersGroup group)
        {
            var border = new Border
            {
                Style           = (Style)FindResource("MyBorderMedium"),
                BorderThickness = new Thickness(0, 0, 0, 0),
                Height          = RefHeight - 5,
                Margin          = new Thickness(10, 0, 0, 0),
            };

            var button = new MyButton
            {
                Style   = (Style)FindResource("MyButtonLeft"),
                Content = group.Name,
                Height  = RefHeight - 5,
            };

            border.Child = button;

            return(border);
        }
Esempio n. 8
0
        public string GetFiltersModel(PageEnum page, FiltersGroup filtersGroup)
        {
            SearchFilterColumnsAll allFilters = new SearchFilterColumnsAll();

            switch (page)
            {
            case PageEnum.SearchResults:
                allFilters = (SearchFilterColumnsAll)System.Web.HttpContext.Current.Session["SearchFilterColumnsAll"];
                break;

            case PageEnum.SubgroupList:
                if (filtersGroup == FiltersGroup.MaterialInfo)
                {
                    allFilters = (SearchFilterColumnsAll)System.Web.HttpContext.Current.Session["SubgroupListMaterialInfo"];
                }
                else
                {
                    allFilters = (SearchFilterColumnsAll)System.Web.HttpContext.Current.Session["SubgroupListResults"];
                }

                break;

            case PageEnum.MaterialDetails:
                allFilters = (SearchFilterColumnsAll)System.Web.HttpContext.Current.Session["MaterialDetailsMaterialInfo"];
                break;

            default:
                break;
            }
            string allFiltersList = "";

            if (allFilters != null)
            {
                allFiltersList = Json.Encode(allFilters.AllFilters);
            }
            return(allFiltersList);
        }
Esempio n. 9
0
        public void Init(FiltersGroup group)
        {
            ViewsMemory.ChangeInFilters += ChangeInFilters;
            _filtersGroup = group;
            LoadFiltersAndFiltersGroups();
            _lblName.Text = group.Name;
            foreach (var item in group.Items)
            {
                switch (item.Key)
                {
                case FiltersGroup _:
                {
                    var tmp = _checkboxes.FirstOrDefault(c => ((KeyValuePair <IFilter, int>)c.Object).Key is FiltersGroup && ((FiltersGroup)((KeyValuePair <IFilter, int>)c.Object).Key).Name == ((FiltersGroup)item.Key).Name);
                    if (tmp != null)
                    {
                        tmp.IsChecked = true;
                        tmp.Content   = item.Value.ToString();
                    }

                    break;
                }

                case Filter _:
                {
                    var tmp = _checkboxes.FirstOrDefault(c => ((KeyValuePair <IFilter, int>)c.Object).Key is Filter && ((Filter)((KeyValuePair <IFilter, int>)c.Object).Key).Description == ((Filter)item.Key).Description);
                    if (tmp != null)
                    {
                        tmp.IsChecked = true;
                        tmp.Content   = item.Value.ToString();
                    }

                    break;
                }
                }
            }
        }
Esempio n. 10
0
        private UIElement GroupHeaderToStackPanel(FiltersGroup group)
        {
            var resultStackPanel = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                Margin      = new Thickness(0, 0, 0, 5),
                Height      = RefHeight + 3,
            };

            var checkbox = new CheckBoxWithObject
            {
                Object                     = group,
                VerticalAlignment          = VerticalAlignment.Top,
                Height                     = 20,
                Width                      = 20,
                VerticalContentAlignment   = VerticalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Right,
                IsChecked                  = group.Visibility,
            };

            checkbox.Checked   += Checkbox_Changed;
            checkbox.Unchecked += Checkbox_Changed;

            var button = new ButtonWithObject
            {
                Style   = (Style)FindResource("MyButton"),
                Content = new Image
                {
                    Source              = new BitmapImage(new Uri(@"..\img\edit-icon.png", UriKind.Relative)),
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                },
                Height              = 20,
                Width               = 20,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right,
                Object              = group,
            };

            button.Click += OpenEditMode;

            var button2 = new ButtonWithObject
            {
                Style   = (Style)FindResource("MyButton"),
                Content = new Image
                {
                    Source              = new BitmapImage(new Uri(@"..\img\x-icon.png", UriKind.Relative)),
                    VerticalAlignment   = VerticalAlignment.Stretch,
                    HorizontalAlignment = HorizontalAlignment.Stretch,
                },
                Height              = 20,
                Width               = 20,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right,
                Object              = group,
            };

            button2.Click += RemoveGroup;

            resultStackPanel.Children.Add(button2);
            resultStackPanel.Children.Add(button);
            resultStackPanel.Children.Add(checkbox);

            var borderDescription = CreateBorderWithLabel($"{group.Name}");

            resultStackPanel.Children.Add(borderDescription);

            return(resultStackPanel);
        }
Esempio n. 11
0
 public EditFiltersGroup(FiltersGroup group)
 {
     InitializeComponent();
     RepresentativeName = $"{Properties.strings.editFiltersGroupRN} {group.Name}";
     Init(group);
 }