Exemplo n.º 1
0
        private void createCombinedFilter()
        {
            //create combined filter
              IFilter selected_filter1 = ((FilterBriefInfoForCmb)cmbFilter1OfCombinedFilter.SelectedItem).getFilter();
              IFilter selected_filter2 = ((FilterBriefInfoForCmb)cmbFilter2OfCombinedFilter.SelectedItem).getFilter();

              IFilter newFilter;

              if (cmbOperatorOfCombinedFilter.Text == "AND")
              {
            newFilter = new CombinedFilter_AND(txtFilterName.Text, selected_filter1, selected_filter2);
              }
              else
            newFilter = new CombinedFilter_OR(txtFilterName.Text, selected_filter1, selected_filter2);
              Data.insertFilter(newFilter);
        }
Exemplo n.º 2
0
        void demoTaoANDFilterVaApplyFilter()
        {
            //lay tag
              IEnumerator<ITag> arrTag = Data.getTagCollection().GetEnumerator();
              arrTag.MoveNext();
              ITag fromTag = arrTag.Current;
              arrTag.MoveNext();
              ITag toTag = arrTag.Current;

              //tao operator
              IOperator strContainOper = StringContaining.getInstance();

              IFilter filterForm5 = new BasicFilter("From 5", fromTag, strContainOper, "5");
              IFilter filterTo2 = new BasicFilter("To 2", toTag, strContainOper, "2");
              AbstractFilter filterFrom5AndTo2 = new CombinedFilter_AND("From 5 and to 2", filterForm5, filterTo2);

              //thu apply cac filter cho email

              foreach (IEmail e in Data.getEmailCollection())
              {
            if (filterFrom5AndTo2.apply(e))
              MessageBox.Show("tim thay roi:" + fromTag.getEmailTag(e) + toTag.getEmailTag(e));
              }
        }