Beispiel #1
0
        private SearchCriteriaCollection SearchDialogGetSearchCriterias()
        {
            SearchCriteriaCollection sc = new SearchCriteriaCollection();

            SearchStringElement where = SearchStringElement.Undefined;
            if (textSearchExpression.Text.Length > 0)
            {
                if (checkBoxRssSearchInTitle.Checked)
                {
                    where |= SearchStringElement.Title;
                }
                if (checkBoxRssSearchInDesc.Checked)
                {
                    where |= SearchStringElement.Content;
                }
                if (checkBoxRssSearchInCategory.Checked)
                {
                    where |= SearchStringElement.Subject;
                }
                if (checkBoxRssSearchInLink.Checked)
                {
                    where |= SearchStringElement.Link;
                }
            }

            StringExpressionKind kind = StringExpressionKind.LuceneExpression;
//			if (radioRssSearchSimpleText.Checked)
//				kind = StringExpressionKind.Text;
//			else if (radioRssSearchRegEx.Checked)
//				kind = StringExpressionKind.RegularExpression;
//			else if (radioRssSearchExprXPath.Checked)
//				kind = StringExpressionKind.XPathExpression;

            SearchCriteriaString scs = new SearchCriteriaString(textSearchExpression.Text, where, kind);

            sc.Add(scs);

            if (this.IsAdvancedOptionReadStatusActive)
            {
                SearchCriteriaProperty scp = new SearchCriteriaProperty();
                scp.BeenRead = !checkBoxRssSearchUnreadItems.Checked;
                scp.WhatKind = PropertyExpressionKind.Unread;
                sc.Add(scp);
            }

            if (this.IsAdvancedOptionItemAgeActive)
            {
                SearchCriteriaAge sca = new SearchCriteriaAge();
                if (this.optionSetItemAge.CheckedIndex == 0)
                {
                    sca.WhatKind = DateExpressionKind.NewerThan;
                }
                else
                {
                    sca.WhatKind = DateExpressionKind.OlderThan;
                }
                sca.WhatRelativeToToday = Utils.RssSearchItemAgeToTimeSpan(this.comboRssSearchItemAge.SelectedIndex);
                sc.Add(sca);
            }

            if (this.IsAdvancedOptionItemPostedActive)
            {
                if (comboBoxRssSearchItemPostedOperator.SelectedIndex == 0)
                {
                    sc.Add(new SearchCriteriaAge(dateTimeRssSearchItemPost.Value, DateExpressionKind.Equal));
                }
                else if (comboBoxRssSearchItemPostedOperator.SelectedIndex == 1)
                {
                    sc.Add(new SearchCriteriaAge(dateTimeRssSearchItemPost.Value, DateExpressionKind.OlderThan));
                }
                else if (comboBoxRssSearchItemPostedOperator.SelectedIndex == 2)
                {
                    sc.Add(new SearchCriteriaAge(dateTimeRssSearchItemPost.Value, DateExpressionKind.NewerThan));
                }
                else
                {
                    // handle case: either one date is greater than the other or equal
                    if (dateTimeRssSearchItemPost.Value > dateTimeRssSearchPostBefore.Value)
                    {
                        sc.Add(new SearchCriteriaDateRange(dateTimeRssSearchPostBefore.Value, dateTimeRssSearchItemPost.Value));
                    }
                    else if (dateTimeRssSearchItemPost.Value < dateTimeRssSearchPostBefore.Value)
                    {
                        sc.Add(new SearchCriteriaDateRange(dateTimeRssSearchItemPost.Value, dateTimeRssSearchPostBefore.Value));
                    }
                    else
                    {
                        sc.Add(new SearchCriteriaAge(dateTimeRssSearchPostBefore.Value, DateExpressionKind.Equal));
                    }
                }
            }

            return(sc);
        }
Beispiel #2
0
 public SearchCriteriaString(string what, SearchStringElement where, StringExpressionKind kind)
 {
     this.What     = what;
     this.Where    = where;
     this.WhatKind = kind;
 }