Exemple #1
0
 public void AddStandardConditionIfNotEmpty(string fieldId, object value, string oper)
 {
     if (!value.IsNullOrEmpty())
     {
         ConditionItems.Add(new SearchConditionItemDto(fieldId, fieldId, value.Str(), oper, false));
     }
 }
        private void RenderConditions()
        {
            string category = null;
            var    margin   = new Thickness(16, 0, 0, 0);

            foreach (var item in ConditionItems.OrderBy(c => c.Category).ThenBy(c => c.Text))
            {
                if (item.Category != category)
                {
                    category = item.Category;

                    var c = new ListBoxItem
                    {
                        Content         = category,
                        IsEnabled       = false,
                        FontWeight      = FontWeights.Bold,
                        BorderThickness = new Thickness(0, 0, 0, 1),
                        BorderBrush     = SystemColors.ControlDarkBrush,
                        Foreground      = SystemColors.WindowTextBrush,
                        Margin          = new Thickness(4, 8, 4, 0)
                    };

                    Conditions.Items.Add(c);
                }

                var listBoxItem = new ListBoxItem
                {
                    Content = RenderText(item.Text.Trim()),
                    Tag     = item,
                    Margin  = margin
                };

                Conditions.Items.Add(listBoxItem);
            }
        }
Exemple #3
0
        public AggregatedConditionDto(SearchConditionDto search, SortConditionDto sort) : this()
        {
            if (search != null)
            {
                ConditionItems.AddRange(search.Items);
            }

            if (sort != null)
            {
                SortItems.AddRange(sort.Items);
            }
        }
Exemple #4
0
        private void DeserializeData(string json)
        {
            Argument.IsNotNullOrWhitespace(() => json);

            using (var stream = new MemoryStream())
                using (var streamWriter = new StreamWriter(stream))
                {
                    streamWriter.Write(json);
                    streamWriter.Flush();
                    stream.Position = 0L;

                    var root =
                        (ConditionTreeItem)_serializer.Deserialize(typeof(ConditionGroup), stream, null);

                    ConditionItems.Clear();
                    ConditionItems.Add(root);
                }
        }