public void ReloadSearch(string search)
        {
            currentParentFP = treeRoot;
            treeSet.FilterApply(delegate(TD dat)
            {
                return(BaseDat.ToString(dat).Contains(search));
            });

            cardSet.LoadFilter.Reset();
            if (currentParentFP != null)
            {
                cardSet.LoadFilter.AddWhere(new FilterTree(currentParentFP, true));
            }
            List <FilterUnitBase> lf = new List <FilterUnitBase>();

            if (PathCard.IsPathCard(search))
            {
                lf.Add(new FilterCard(new PathCard(search)));
            }
            else if (PathTree.IsPathTree(search))
            {
                lf.Add(new FilterTree(search, true));
            }
            lf.Add(new FilterString("Name", '%' + search + '%', true));
            cardSet.LoadFilter.AddWhere(new FilterOR(lf.ToArray()));
            cardSet.Load();

            AddTreeSet(treeSet, cardSet);
            treeSet.FilterReset();
            Refresh();
        }
예제 #2
0
 public override string ToString()
 {
     if (_value is PathCard)
     {
         return(fmtCard((PathCard)_value));
     }
     else if (_value is PathTree)
     {
         FilterTree fltTree = new FilterTree(Table, _columnTree, (PathTree)_value, false);
         return(fltTree.ToString());
     }
     else if (_value is string)
     {
         string sv = (string)_value;
         if (PathCard.IsPathCard(sv))
         {
             return(fmtCard(new PathCard(sv)));
         }
         else if (PathTree.IsPathTree(sv))
         {
             FilterTree fltTree = new FilterTree(Table, _columnTree, sv, false);
             return(fltTree.ToString());
         }
     }
     throw new ArgumentException("FilterCard - ошибка в значении " + _value.ToString());
 }
예제 #3
0
 protected override void OnParse(ConvertEventArgs cevent)
 {
     if (cevent.DesiredType == typeof(PathTree))
     {
         if (cevent.Value is string && PathTree.IsPathTree((string)cevent.Value))
         {
             cevent.Value = new PathTree((string)cevent.Value);
         }
     }
     else if (cevent.DesiredType == typeof(PathCard))
     {
         if (cevent.Value is string && PathCard.IsPathCard((string)cevent.Value))
         {
             cevent.Value = new PathCard((string)cevent.Value);
         }
     }
     else if (cevent.DesiredType == typeof(Guid))
     {
         if (cevent.Value is string)
         {
             try
             {
                 cevent.Value = new Guid((string)cevent.Value);
             }
             catch
             {
                 cevent.Value = null;
             }
         }
     }
     else
     {
         base.OnParse(cevent);
     }
 }
예제 #4
0
 private string fmtCard(PathCard card)
 {
     return(string.Format("({0}{1} = '{3}' and {0}{2} = {4}) "
                          , string.IsNullOrEmpty(Table) ? "" : Table + "."
                          , _columnTree
                          , _columnCard
                          , card.Parent.ToString()
                          , card.Code
                          ));
 }
예제 #5
0
 public FilterCard(string table, PathCard card) : this(table, "Parent_FP", "Code", card)
 {
 }
예제 #6
0
 public FilterCard(PathCard card) : this("", "Parent_FP", "Code", card)
 {
 }