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();
        }
Exemplo n.º 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());
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 4
0
        public override string ToString()
        {
            string fp = "";

            if (_value is string && PathTree.IsPathTree((string)_value))
            {
                fp = (string)_value;
            }
            else if (_value is PathTree)
            {
                fp = ((PathTree)_value).ToString();
            }
            string ret = null;

            if (_value == null)
            {
                ret = string.Format("({0} is null)"
                                    , Column
                                    );
            }
            else if (string.IsNullOrEmpty(_value.ToString()))
            {
                return("");
            }
            else
            {
                ret = string.Format("({0} = '{1}')"
                                    , Column
                                    , fp
                                    );
            }

            if (_IsFull && !string.IsNullOrEmpty(fp))
            {
                ret += string.Format(" OR ({0} like '{1}.%')"
                                     , Column
                                     , fp
                                     );
                ret = string.Format("({0})", ret);
            }

            return(ret);
        }