public void Chargerlesfichierdsd(Utulisateur user, Dossier directory) { fichier d; string smt = "SELECT nom,proprietair,emplacement,format,droitacces,datecreation,blob,id FROM dbo.Fichier Where proprietair=@owner and emplacement=@parent "; cmd = new SqlCommand(smt, conn); cmd.Parameters.AddWithValue("@owner", user.GetNom()); cmd.Parameters.AddWithValue("@parent", directory.Getid()); SqlDataReader rs = cmd.ExecuteReader(); while (rs.Read()) { if (rs.IsDBNull(6)) { d = new fichier(rs.GetString(0), rs.GetString(3), user, directory, rs.GetInt32(7)); } else { byte[] byteData = (byte[])rs[6]; d = new fichier(rs.GetString(0), rs.GetString(3), user, directory, byteData); } directory.Setlistfichier(d); } rs.Close(); }
public void insertfile(Dossier d, Utulisateur user, string format, string nom, DateTime date, float taille, string droitacces) { string smt = "INSERT INTO dbo.Fichier(nom,emplacement,proprietair,datecreation,format,taille,droitacces) VALUES( @Name,@emplacement,@proprietair,@datecreation,@format,@taille,@droitacces)"; cmd = new SqlCommand(smt, conn); cmd.Parameters.AddWithValue("@Name", nom); cmd.Parameters.AddWithValue("@emplacement", d.Getid()); cmd.Parameters.AddWithValue("@proprietair", user.GetNom()); cmd.Parameters.AddWithValue("@datecreation", date); cmd.Parameters.AddWithValue("@format", format); cmd.Parameters.AddWithValue("@taille", taille); cmd.Parameters.AddWithValue("@droitacces", droitacces); cmd.ExecuteNonQuery(); }
public void chargerdossierdsd(Utulisateur user, Dossier directory) { string smt = "SELECT nom,proprietair,taille,droitacces,datecreation,emplacement,idemplacement,Id FROM dbo.Dossier Where proprietair=@owner and idemplacement=@idemplacement "; cmd = new SqlCommand(smt, conn); cmd.Parameters.AddWithValue("@owner", user.GetNom()); cmd.Parameters.AddWithValue("@idemplacement", directory.Getid()); SqlDataReader rs = cmd.ExecuteReader(); while (rs.Read()) { Dossier d = new Dossier(rs.GetString(0), rs.GetDateTime(4), user, directory, rs.GetInt32(7)); directory.Setlisd(d); } rs.Close(); }