public void setSousFamillesBD() { try { DataBase db = new DataBase(dataBasePath); DataTable dt = db.selectQuery("SELECT * FROM SousFamilles"); SousFamille sousFamille; Famille famille; foreach (DataRow rows in dt.Rows) { //Recherche famille correspondante à refFamille "rows[1]" famille = this.getFamille(rows[1].ToString()); //Creation Famille temporaire sousFamille = new SousFamille(System.Convert.ToInt32(rows[0]), famille, rows[2].ToString()); Console.WriteLine(sousFamille.ToString()); //Ajout a la famille de la liste this.listeSousFamilles.Add(sousFamille); } } catch (Exception ex) { Console.WriteLine(ex); } }
public Famille getFamilleParSousFamille(string refSousFamille) { //Cherche sous famille correspondant a refSousFamille SousFamille sousFamille = this.getSousFamille(refSousFamille); string refFamille = sousFamille.RefFamille.RefFamille.ToString(); //this.SetConnection(); // DataBase db = new DataBase(dataBasePath); SQLiteCommand command = new SQLiteCommand("SELECT RefFamille,Nom FROM Familles WHERE RefFamille =@refFamille", this.sql_con); command.Parameters.AddWithValue("@refFamille", refFamille); this.sql_con.Open(); Famille famille = null; using (SQLiteDataReader sqReader = command.ExecuteReader()) { if (sqReader.Read()) { famille = new Famille(System.Convert.ToInt32(sqReader["RefFamille"]), String.Format("{0}", sqReader["Nom"])); } } this.sql_con.Close(); return(famille); }
public Article(string Ref, string Descrip, float Price, int Quantity, Marque Brand, SousFamille ChildFamily) { RefArticle = Ref; Description = Descrip; PrixHT = Price; Quantite = Quantity; Marque = Brand; SousFamille = ChildFamily; }
public Article(string RefArticle, string Description, SousFamille SousFamille, Marque Marque, float PrixHT, int Quantite) { this.Ref_Article = RefArticle; this.Description = Description; this.SousFamille = SousFamille; this.Marque = Marque; this.PrixHT = PrixHT; this.Quantite = Quantite; }
public Article(string refArticle, string description, SousFamille refSousFamille, Marque refMarque, double prixHT, int quantite) { this.refArticle = refArticle; this.description = description; this.refSousFamille = refSousFamille; this.refMarque = refMarque; this.prixHT = prixHT; this.quantite = quantite; }
//Overide de la methode equals pour comparer les objets par rapport aux attributs public override bool Equals(object obj) { SousFamille sf = obj as SousFamille; if (sf == null) { return(false); } return(refSousFamille == sf.RefSousFamille && refFamille == sf.RefFamille && nom == sf.Nom); }
public void supprimerSousFamille(SousFamille sousFamille) { this.listeSousFamilles.Remove(sousFamille); }
public void ajouterSousFamille(SousFamille sousFamille) { this.listeSousFamilles.Add(sousFamille); }