Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        public void insertfileuser(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", -1);
            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();
        }
Ejemplo n.º 3
0
        public void Chargerlesfichierofuser(Utulisateur user)
        {
            Dossier dir = new Dossier();
            string  smt = "SELECT nom,proprietair,emplacement,format,droitacces,datecreation,id FROM dbo.Fichier Where proprietair=@owner and  emplacement =-1";

            cmd = new SqlCommand(smt, conn);
            cmd.Parameters.AddWithValue("@owner", user.GetNom());

            SqlDataReader rs = cmd.ExecuteReader();

            while (rs.Read())
            {
                fichier d = new fichier(rs.GetString(0), rs.GetString(3), user, null, rs.GetInt32(6));
                user.Setlistfiles(d);
            }
            rs.Close();
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        public Dossier Creat_sdirec(string name, DateTime d, Dossier user, Utulisateur newuser, int id)
        {
            Dossier[] list = user.Getlistdir();
            if (Exists(name, list))
            {
                return(null);
            }
            else

            {
                db.Insertdirectoryd(name, newuser.GetNom(), "RW", d, 0, user.GetNom(), id);
                Dossier newdirectory = new Dossier(name, d, user.GetProprietaire(), user, db.lastindex());
                user.Setlisd(newdirectory);


                return(newdirectory);
            }
        }
Ejemplo n.º 6
0
        public Dossier Creation_dossier(string name, DateTime d, Utulisateur user, int id)
        {
            if (Exists(name, user.Getlistdossier()))
            {
                return(null);
            }
            else

            {
                db.Insertdirectory(name, user.GetNom(), "RW", d, 0);
                Dossier newdirectory = new Dossier(name, d, user, null, db.lastindex());


                user.AddtlistDossier(newdirectory);

                return(newdirectory);
            }
        }
Ejemplo n.º 7
0
        public void Chargerlesdossier(Utulisateur user)
        {
            try
            {
                Dossier dir = new Dossier();
                string  smt = "SELECT Id,nom,proprietair,taille,droitacces,datecreation,emplacement FROM dbo.Dossier Where proprietair=@owner and idemplacement IS NULL or idemplacement<0";
                cmd = new SqlCommand(smt, conn);
                cmd.Parameters.AddWithValue("@owner", user.GetNom());

                SqlDataReader rs = cmd.ExecuteReader();

                while (rs.Read())
                {
                    Dossier d = new Dossier(rs.GetString(1), rs.GetDateTime(5), user, null, rs.GetInt32(0));
                    user.AddtlistDossier(d);
                }
                rs.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Ejemplo n.º 8
0
    public void Lister_dossier(Utulisateur directory, float taille)
    {
        int i    = 0;
        int stop = directory.Getlistfiles().Length;


        while (directory.Getlistfiles()[i] != null)
        {
            while (i < stop)
            {
                Console.WriteLine(i + 1 + "-" + directory.Getlistfiles()[i].GetNom()
                                  + "-" + directory.Getlistfiles()[i].GetDatecreation() + "-" + taille + directory.GetNom());
                i++;
            }
            return;
        }
    }