Beispiel #1
0
        private static void SetAllFlat()
        {
            using (IDbConnection connection = Project.Current.GetConnection())
            {
                _allPackages = new Dictionary<int, Package>();
                _allPackagesTempForGettingChilds = new Dictionary<int, Package>();

                _allPackages.Add(0, new Package());

                connection.Open();
                IDbCommand command = connection.CreateCommand();
                command.CommandText = "SELECT [Package_ID], [Name], [Parent_ID] FROM [t_package] ORDER BY [tpos], [name]";

                using (IDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        int id = int.Parse(reader["Package_ID"].ToString());
                        int? parentId = int.Parse(reader["Parent_ID"].ToString());
                        string name = reader["Name"].ToString();

                        Package p = new Package {_id = id, Name = name, _parentId = parentId};

                        _allPackages.Add(id, p);
                        _allPackagesTempForGettingChilds.Add(id, p);
                    }

                    reader.Close();
                }
                connection.Close();
            }
        }
Beispiel #2
0
        private static void SetIdTree(Package p, string tree)
        {
            p.IdTree = tree + @"\" + p._id;

            foreach (Package child in p.Packages)
            {
                SetIdTree(child, p.IdTree);
            }
        }