public void delete(fromage unfromage) { string FromageDelete; FromageDelete = ("pays where id ='" + unfromage.Id + "'"); _dbal.Delete(FromageDelete); }
public void update(fromage unfromage) { string FromageUpdate; FromageUpdate = ("pays set id ='" + unfromage.Id + "', pays_origine = '" + unfromage.Pays_origine.Replace("'", "''") + "' , nom = '" + unfromage.Nom.Replace("'", "''") + "', creation = '" + unfromage.Creation.Replace("'", "''") + "', image = '" + unfromage.Image + "'"); _dbal.Update(FromageUpdate); }
static void Main(string[] arg) { dbal ledbal = new dbal(); //FP.Execquery("INSERT INTO Pays (id, nom) values (1, 'France')"); //pays unpays = new pays(2, "France"); DAOPays pays = new DAOPays(ledbal); //pays.insert(unpays); //pays.delete(unpays); //pays.update(unpays); fromage fromage = new fromage(1, 1, "'raclette'", "'09/09/2020'", "image"); DAOFromage unfromage = new DAOFromage(ledbal); //lefromage.insert(fromage); //lefromage.delete(fromage); //fromage.update(lefromage); pays.InsertByFile("C://Users//SIO2//Desktop//ClubFromage_cs//bin//Debug//netcoreapp3.1//pays.csv"); DataSet lesPays = ledbal.RQuery("SELECT * FROM Pays"); foreach (DataRow r in lesPays.Tables[0].Rows) { Console.WriteLine(r["id"]); } foreach (DataRow maligne in ledbal.SelectAll("pays").Rows) { Console.WriteLine(maligne["nom"]); } /*foreach (DataRow row in ledbal.SelectByFile("Pays", "nom like 'P%'").Rows) * { * Console.WriteLine(row["nom"]); * }*/ DataRow id = ledbal.SelectById("Pays", 3); Console.WriteLine(id["id"] + " " + id["nom"].ToString()); pays.SelectAll(); pays.SelectByName("France"); pays.SelectById(12); unfromage.SelectAll(); unfromage.SelectByName("Camembert"); unfromage.SelectById(12); }
public void insert(fromage unfromage) { string FromageInsert; FromageInsert = ("fromage(id, pays_origine, nom, creation, image) values(" + unfromage.Id + "," + unfromage.Pays_origine.Replace("'", "''") + "," + unfromage.Nom.Replace("'", "''") + "," + unfromage.Creation.Replace("'", "''") + "," + unfromage.Image + ")"); _dbal.Insert(FromageInsert); }
public fromage SelectById(int idFromage) { DataRow id = _dbal.SelectById("fromage", idFromage); fromage idfro = new fromage((int)id["id"], (int)id["paysorigineid"], (string)id["nom"], (string)id["creation"], (string)id["image"]); Console.WriteLine(idfro.Nom); return(idfro); }
public fromage SelectByName(string namefromage) { DataRow nom = _dbal.SelectByField("fromage", "nom like '" + namefromage + "'").Rows[0]; fromage unfro = new fromage((int)nom["id"], (int)nom["paysorigineid"], (string)nom["nom"], (string)nom["creation"], (string)nom["image"]); Console.WriteLine(unfro.Id); return(unfro); }
public void InsertFromCSV(string chemin) { using (var reader = new StreamReader(chemin)) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) { csv.Configuration.Delimiter = ";"; csv.Configuration.PrepareHeaderForMatch = (string header, int index) => header.ToLower(); var record = new fromage(); IEnumerable <fromage> records = csv.EnumerateRecords(record); foreach (fromage fromage in records) { insert(fromage); } } }
public void update(fromage lefromage) { string query = " fromage set nom = 'tome' where id = " + lefromage.Id + ";"; _dbal.Update(query); }
public void delete(fromage lefromage) { string query = " FROM fromage where id = " + lefromage.Id + ";"; _dbal.Delete(query); }
public void insert(fromage lefromage) { string query = " fromage values " + "(" + lefromage.Id + "," + lefromage.Paysorigineid + "," + lefromage.Nom + "," + lefromage.Creation + "," + lefromage.Image + ");"; _dbal.Insert(query); }