private void LOGIN_Click(object sender, EventArgs e) { mydb db = new mydb(); bool b; Utulisateur newusers = new Utulisateur(); droitacces droit = new droitacces(); db.Chargerlesinfos(newusers); string nom = username.Text.ToString(); string password = this.password.Text.ToString(); Utulisateur newuser = newusers.Session(newusers, nom, password); if (newuser == null) { b = false; } else { b = true; } if (b) { session session = new session(newuser, this); username.Text = ""; this.password.Text = ""; this.Visible = false; session.Visible = true; } else { MessageBox.Show("wrong passwordor username !"); } }
public Dossier getthefolder(string name, Utulisateur user) { Dossier[] list = user.Getlistdossier(); int i = 0; int stop = list.Length - 1; while (i < stop) { Dossier d = list[i]; string nom; while ((d != null) && (i < stop)) { nom = d.GetNom().Trim(); if (nom.Equals(name)) { return(d); } else { i++; } } return(null); } return(null); }
public Utulisateur Creation_user(Utulisateur newuser, string user, string pass) { newuser = new Utulisateur(user, pass); newuser.Setlistusers(newuser); return(newuser); }
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 List <Dossier> Searchuser(string nom, Utulisateur user) { List <Dossier> ds = new List <Dossier>(); string nom2 = nom; int i = 0; if (user.Getlistdossier() != null) { int p = user.Getlistdossier().Length; while (i < p) { if (user.Getlistdossier()[i].GetNom().Equals(nom)) { ds.Add(user.Getlistdossier()[i]); } //ds = Searchussersdirectory(nom2, user.Getlistdossier()[i], user,ds); i++; } return(ds); } else { return(ds); } }
public Dossier(string name, DateTime d, Utulisateur user, Dossier emplacementf, int id) { nom = name; date_creation = d; proprietaire = user; _id = id; emplacement = emplacementf; droitacces droita = new droitacces(); droita.Setdroitacces("RW"); droit_acces = droita; }
public Dossier() { nom = null; date_creation = DateTime.Now; proprietaire = null; taille = 0; emplacement = null; droitacces droita = new droitacces(); droita.Setdroitacces("RW"); droit_acces = droita; }
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; }
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(); }
public fichier Creation_fichieru(string name, string format, Utulisateur user, int i) { //if (Exists(user.Getlistfiles, name)) //{ // return null; //} db.insertfileuser(user, format, name, d, 0, "RW"); fichier newfile = new fichier(name, format, user, null, db.lastindexf()); user.Setlistfiles(newfile); return(newfile); }
public void Chargerlesinfos(Utulisateur user) { string smt = "SELECT nom,password FROM dbo.Utilisateur "; cmd = new SqlCommand(smt, conn); SqlDataReader rs = cmd.ExecuteReader(); while (rs.Read()) { Utulisateur u = new Utulisateur(rs.GetString(0), rs.GetString(0)); user.Setlistusers(u); } rs.Close(); }
public fichier(fichier f, Dossier ds) { nom = f.GetNom(); this.format = f.GetFormat(); proprietair = f.GetPropritaire(); emplacement = ds; taille = 1; _id = db.lastindexf() + 1; Blob = f.GetBlob(); droitacces dr = new droitacces(); dr.Setdroitacces("RW"); droit_acces = dr; }
public fichier() { nom = null; this.format = null; proprietair = null; emplacement = null; taille = 1; Blob = null; droitacces dr = new droitacces(); dr.Setdroitacces("RW"); droit_acces = dr; }
public fichier(string name, string format, Utulisateur user, Dossier directoty, byte[] blobl) { nom = name; this.format = format; proprietair = user; emplacement = directoty; taille = 1; _id = 0; Blob = blobl; droitacces dr = new droitacces(); dr.Setdroitacces("RW"); droit_acces = dr; }
public bool verifconnexion(dbStockContext db, string nom, string motdepasse) { Utulisateur user = new Utulisateur(); user.Nom_Utilisateur = nom; user.Mot_de_passe = motdepasse; if (db.Utulisateurs.SingleOrDefault(s => s.Nom_Utilisateur == nom && s.Mot_de_passe == motdepasse) != null) { return(true); } else { return(false); } }
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(); }
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; } }
public bool Login(Utulisateur user, string name, string pass) { Utulisateur[] list = user.Getlistusers(); int i = 0; while (list[i] != null) { if (list[i].GetNom().Equals(name) && list[i].Getpassword().Equals(pass)) { return(true); } else { i++; } } return(false); }
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(); }
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); } }
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); } }
public void Chargerlesdossierdsd(Utulisateur u) { int stop = u.Getlistdossier().Length - 1; int i = 0; if (stop == 0) { return; } else { while (stop > i) { chargerdossierdsd(u, u.Getlistdossier()[i]); i++; } } }
public void chargerlesfichier(Utulisateur user) { int stop = user.Getlistdossier().Length - 1; int i = 0; if (stop == 0) { return; } else { while (stop > i) { Chargerlesfichierdsd(user, user.Getlistdossier()[i]); i++; } } }
public Dossier getth(int node, Utulisateur user, List <Dossier> listof, List <Dossier> searchpath) { // List<Dossier> searchpath = new List<Dossier>(); foreach (Dossier get in listof) { get.Getlistofdir().Clear(); db.chargerdossierdsd(user, get); searchpath.Add(get); if (get.Getid().Equals(node)) { return(get); } return(getth(node, user, get.Getlistofdir(), searchpath)); } return(null); }
public Utulisateur Session(Utulisateur user, string name, string pass) { Utulisateur[] list = user.Getlistusers(); int i = 0; int stop = list.Length; while (i < stop) { if (list[i].GetNom().Trim().Equals(name) && list[i].Getpassword().Trim().Equals(pass)) { return(list[i]); } else { i++; } } return(null); }
public bool Exists(Utulisateur user, string name) { Dossier[] list = user.Getlistdossier(); int i = 0; int stop = list.Length; stop--; while (i <= stop) { while ((list[i] != null)) { if (list[i].GetNom().Equals(name)) { return(true); } i++; break; } } return(false); }
public void Showmyinfos(Utulisateur user) { int i = 0; int stop = Getlistdossier().Length; stop--; while (i <= stop) { while (user.Getlistdossier()[i] != null) { Console.WriteLine(i + 1 + "-" + user.Getlistdossier()[i].GetNom() + "-" + user.Getlistdossier()[i].GetProprietaire().GetNom() + "-" + user.Getlistdossier()[i].GetDroitacces() + "-" + user.Getlistdossier()[i].GetTaille() + "-" + user.Getlistdossier()[i].GetDatecreation()); i++; break; } } return; }
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); } }
private bool Existsfileu(Utulisateur directory, string name) { fichier[] list = directory.Getlistfiles(); int i = 0; int stop = list.Length - 1; while (i < stop) { while ((list[i] != null)) { if (list[i].GetNom().Equals(name)) { return(true); } else { i++; } } return(false); } return(false); }
public List <Dossier> Searchussersdirectory(string nom, Dossier dir, Utulisateur user, List <Dossier> ds) { int i = 0; if (dir.Getlistdir() != null) { int p = dir.Getlistdir().Length; while (i < p) { if (dir.Getlistdir()[i].Equals(nom)) { ds.Add(dir.Getlistdir()[i]); } dir.Getlistdir()[i].Searchussersdirectory(nom, dir.Getlistdir()[i], user, ds); i++; } return(ds); } else { return(ds); } }