public Module(Guid id, string modLibele, Gamme modGamme, Matiere modMatiere, double prixBase) { this.modLibele = modLibele; this.modGamme = modGamme; this.modMatiere = modMatiere; this.prixBase = prixBase; this.modId = id; }
/// <summary> /// /// </summary> /// <param name="modLibele"></param> /// <param name="modGamme"></param> /// <param name="modMatiere"></param> /// <param name="prixBase"></param> /// <param name="modParametres"></param> public Module(Guid modId, string modLibele, Gamme modGamme, Matiere modMatiere, double prixBase, List <Parametre> modParametres, string uniteUsage) { this.modLibele = modLibele; this.modGamme = modGamme; this.modMatiere = modMatiere; this.prixBase = prixBase; this.modParametres = modParametres; this.modId = modId; this.uniteUsage = uniteUsage; }
public static Boolean AjouterGamme(Gamme maGamme) { try { NpgsqlConnection conn; conn = new NpgsqlConnection(chaineConnection); conn.Open(); NpgsqlCommand MyCmd = null; // id , nom , prenom, nomRue,codePostal,ville,tel,email,numRue string query = @"INSERT INTO ""Gamme"" VALUES ('" + maGamme.gamId.ToString() + "','" + maGamme.gamLibelle + "')"; Debug.WriteLine(query); MyCmd = new NpgsqlCommand(query, conn); MyCmd.ExecuteNonQuery(); //Exécution conn.Close(); return(true); } catch (Exception ex) { Debug.WriteLine(ex.Message); return(false); } }
public static Gamme GetGamme(string id) { NpgsqlConnection conn; conn = new NpgsqlConnection(chaineConnection); conn.Open(); string query = @"SELECT id,nom FROM ""Gamme"" where id ='" + id + "'"; Debug.WriteLine(query); NpgsqlCommand command = new NpgsqlCommand(query, conn); NpgsqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { Gamme OneGamme = new Gamme(new Guid(dr[0].ToString()), dr[1].ToString()); conn.Close(); return(OneGamme); } conn.Close(); return(null); }
/// <summary> /// Changer la gamme d'un module /// </summary> /// <param name="g">La gamme</param> public void changerGamme(Gamme g) { this.modGamme = g; }