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); } } }
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); }
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); }
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); }