Beispiel #1
0
        public Point LoadPoint(int idPoint)
        {
            List <Point> children;
            Point        current = null;

            int[] path = GetPathReversed(idPoint);
            if (path.Length == 0)
            {
                return(null);
            }
            foreach (int p in path)
            {
                current = GetPoint(p);
                if (current == null)
                {
                    return(null);
                }
                else
                {
                    if (!current.Loaded)
                    {
                        children = current.Children;
                        PointsUpdate?.Invoke(new PointEventArgs()
                        {
                            ParentPoint = current, Points = children
                        });
                    }
                }
            }
            return(current);
        }
Beispiel #2
0
        private void LoadChildren(Point point)
        {
            List <Point> children;

            children = point.Children;
            PointsUpdate?.Invoke(new PointEventArgs()
            {
                ParentPoint = point, Points = children
            });
            foreach (Point c in children)
            {
                LoadChildren(c);
            }
        }
Beispiel #3
0
        public List <Point> Search(string searchString)
        {
            List <Point> children;
            List <Point> result = new List <Point>();
            Point        current;
            string       sql = string.Format(@"
select id_point from points where pointname like '%{0}%'
and dbo.treerootid(id_point) in ({1})",
                                             searchString, string.Join(",", roots.Select(r => r.ID.ToString())));
            DataTable found = m.GetData(sql, 60);

            foreach (DataRow row in found.Rows)
            {
                current = this.GetPoint((int)row[0]);
                if (current == null)
                {
                    int[] path = GetPathReversed((int)row[0]);
                    foreach (int id in path)
                    {
                        current = this.GetPoint(id);
                        if (current == null)
                        {
                            break;
                        }
                        if (!current.Loaded)
                        {
                            children = current.Children;
                            PointsUpdate?.Invoke(new PointEventArgs()
                            {
                                Points = children, ParentPoint = current
                            });
                        }
                    }
                }
                if (current?.ID == (int)row[0])
                {
                    result.Add(current);
                }
            }
            return(result);
        }