Beispiel #1
0
 private void CreateNode(List <Dossiers> nodes, Dossiers parent)
 {
     foreach (Dossiers node in nodes)
     {
         if (node.id == parent.id_Parent)
         {
             node.items.Add(parent);
         }
         else
         {
             CreateNode(node.items, parent);
         }
     }
 }
Beispiel #2
0
        public Dossiers Renommer(string id, string nom)
        {
            MySqlDataReader reader = BDD.RunQuery(String.Format(BDD.renommerDossier, id, nom));

            reader = BDD.RunQuery(String.Format(BDD.getDossier, id));
            reader.Read();

            Dossiers doss = new Dossiers
            {
                id        = reader.GetInt32("id"),
                id_Parent = reader.GetInt32("idParent"),
                nom       = reader.GetString("nom")
            };

            return(doss);
        }
Beispiel #3
0
        public Dossiers AjoutDossier(string id_Parent, string nom)
        {
            MySqlDataReader reader         = BDD.RunQuery(String.Format(BDD.ajoutDossier, id_Parent, nom));
            long            lastInsertedId = BDD.cmdMySQL.LastInsertedId;

            reader = BDD.RunQuery(String.Format(BDD.getDossier, lastInsertedId));
            reader.Read();
            Dossiers tempFile = new Dossiers
            {
                id        = reader.GetInt32("id"),
                id_Parent = reader.GetInt32("idParent"),
                nom       = reader.GetString("nom")
            };

            return(tempFile);
        }
Beispiel #4
0
        private void RetrieveTree()
        {
            List <Dossiers> foldersData = new List <Dossiers>();

            MySqlDataReader reader = BDD.RunQuery(BDD.getDossiers);

            while (reader.Read())
            {
                Dossiers tempFold = new Dossiers
                {
                    id        = reader.GetInt32("id"),
                    id_Parent = reader.GetInt32("idParent"),
                    nom       = reader.GetString("nom"),
                    items     = new List <Dossiers>()
                };

                foldersData.Add(tempFold);
            }

            this._treeStructure = ParseFoldersData(foldersData);
        }