Пример #1
0
        public void Deplacer_Dossier(Dossier pathd, Dossier d)
        {
            if (!d.Exists(d.GetNom(), pathd.Getlistdir()))
            {
                if (d.GetDroitacces().Equals("RW") || d.GetDroitacces().Equals("RWX"))
                {
                    if (d.GetEmplacement() == null)
                    {
                        d.GetProprietaire().Getlistdirlist().Remove(d);
                    }
                    else
                    {
                        d.GetEmplacement().Getlistofdir().Remove(d);
                    }
                    d.SetEmplacement(pathd);
                    pathd.Setlisd(d);
                }
                else
                {
                    return;
                }
            }

            else
            {
                return;
            }
        }
Пример #2
0
        public string Supprimer_dossier(Dossier directory, bool u)
        {
            string         ok = null, nok = null;
            List <Dossier> list = new List <Dossier>();

            if (!u)
            {
                list = directory.GetProprietaire().Getlistdirlist();
            }
            if (u)
            {
                list = directory.GetEmplacement().Getlistofdir();
            }

            ok  = "your directory was deleted  !";
            nok = "you can't !";


            int stop = list.Count;

            if (directory.GetDroitacces().Equals("RW"))
            {
                list.Remove(directory);
                db.deletedirectory(directory.Getid());
                return(ok);
            }
            else
            {
                return(nok + ", you don't have the right ");
            }
        }
Пример #3
0
        public void clonelist(List <Dossier> oldlist, Dossier ds)
        {
            List <Dossier> newlist = ds.Getlistofdir();

            oldlist.ForEach((item) =>
            {
                Dossier d = new Dossier(item, ds);
                item.Getlistofdir().Clear();
                item.Getlistoffiles().Clear();
                db.chargerdossierdsd(ds.GetProprietaire(), item);
                db.Chargerlesfichierdsd(ds.GetProprietaire(), item);
                newlist.Add(d);
                db.Insertdirectoryd(item.GetNom(), ds.GetProprietaire().GetNom(), "RW", item.GetDatecreation(), 0, ds.GetNom(), ds.Getid());

                clonelist(item.Getlistofdir(), d);
                f.clonelist(item.Getlistoffiles(), d);
            });
            ds.setthedlidt(newlist);
            //return newlist;
        }
Пример #4
0
        public Dossier(Dossier d, Dossier ds)
        {
            nom           = d.GetNom();
            date_creation = DateTime.Now;
            proprietaire  = d.GetProprietaire();
            taille        = 0;
            emplacement   = ds;
            _id           = db.lastindex() + 1;
            droitacces droita = new droitacces();

            droita.Setdroitacces("RW");
            droit_acces = droita;
        }
Пример #5
0
        public void clonelist(List <fichier> oldlist, Dossier ds)
        {
            List <fichier> newlist = ds.Getlistoffiles();

            oldlist.ForEach((item) =>
            {
                fichier newf = new fichier(item, ds);
                newlist.Add(newf);
                db.insertfile(ds, ds.GetProprietaire(), "txt", item.GetNom(), d, 0, "RW");
                newf.Setblob(item.GetBlob());
            });

            ds.Settheflist(newlist);
        }
Пример #6
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);
            }
        }