public void UpdateFromage(Fromage unFromage) { Dictionary <string, string> values = new Dictionary <string, string>(); values["pays_origine_id"] = unFromage.Pays_origine_id.ToString(); values["nom"] = "'" + unFromage.Nom.Replace("'", "\\'") + "'"; values["creation"] = "'" + unFromage.Creation.ToString("yyyy'-'MM'-'dd") + "'"; values["image"] = "'" + unFromage.Image.Replace("'", "\\'") + "'"; mydbal.Update("fromage", values, "id = " + unFromage.Id); }
public void Insert(Fromage theFromage) { string query = "fromage (id, pays_origine_id, name, creation, image) VALUES (" + theFromage.Id + "," + theFromage.Origin.Id + ",'" + theFromage.Name.Replace("'", "''") + "','" + theFromage.Creation.ToString("yyyy-MM-dd") + "','" + theFromage.Image + "')"; this.thedbal.Insert(query); }
public void Update(Fromage myFromage) { string query = "fromage SET id = " + myFromage.Id + ", name = '" + myFromage.Name.Replace("'", "''") + "', pays_origine_id = " + myFromage.Origin.Id + ", creation = '" + myFromage.Creation.ToString("yyyy-MM-dd") + "', image = '" + myFromage.Image + "' " + "WHERE id = " + myFromage.Id; this.thedbal.Update(query); }
public void insertfile(string path, string delimiter) { using (var reader = new StreamReader("fromage.csv")) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) { csv.Configuration.Delimiter = delimiter; csv.Configuration.PrepareHeaderForMatch = (string header, int index) => header.ToLower(); Fromage record = new Fromage(); var records = csv.EnumerateRecords(record); foreach (Fromage fr in records) { this.InsertFromage(fr); } } }
public void insertfil() { using (var reader = new StreamReader("fromages.csv")) 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); Console.WriteLine(records); foreach (var r in records) { insert(r); } } }
public void MainCSV() { using (var reader = new StreamReader("fromages.csv")) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) { csv.Configuration.Delimiter = ";"; csv.Configuration.PrepareHeaderForMatch = (string header, int index) => header.ToLower(); var record = new Fromage(); var records = csv.EnumerateRecords(record); foreach (var item in records) { this.Insert(item); } } Console.WriteLine("importation de fromage réussit"); }
public void InsertFromCSV(string filename) { using (var reader = new StreamReader(filename)) using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) { csv.Configuration.Delimiter = ";"; csv.Configuration.RegisterClassMap <FromageMap>(); csv.Configuration.PrepareHeaderForMatch = (string header, int index) => header.ToLower(); var record = new Fromage(); IEnumerable <Fromage> records = csv.EnumerateRecords(record); foreach (Fromage r in records) { Console.WriteLine(r.Id + "-" + r.Name + "-" + r.Origin.Name); this.Insert(record); } } }
public void Insert(Fromage unFromage) { string query = "Fromage VALUES " + "(" + unFromage.getIdentifiant() + "," + unFromage.getIdPays() + ",'" + unFromage.getNom() + "','" + unFromage.getDureeAffinage() + "','" + unFromage.getDateCreation() + "','" + unFromage.getImage() + "','" + unFromage.getRecette() + "','" + unFromage.getHistoire() + "');"; this._DBAL.Insert(query); }
public void Delete(Fromage UnFromage) { thedbal.Delete("Fromage where id = " + UnFromage.Id + " ;"); }
public void Delete(Fromage UnFromage) { _mydbal.Insert("DELETE FROM fromage where " + UnFromage.Id + " ;"); }
public void Update(Fromage UnFromage) { _mydbal.Insert("UPDATE fromage set id = " + UnFromage.Id + ", id_pays_origin = " + UnFromage.Idpays.Id + ", nom = " + UnFromage.Nom + ",creation = '" + UnFromage.Creation + "', image = " + UnFromage.Image + " Where id = " + UnFromage.Id + " ;"); }
public void Insert(Fromage Unfromage) { Console.WriteLine("INSERT INTO fromage (id,pays_origine_id,nom,creation,image) values (" + Unfromage.Id + ", " + Unfromage.Idpays.Id + ", '" + Unfromage.Nom + "', " + Unfromage.Creation + ", '" + Unfromage.Image + "') ;"); _mydbal.Insert("INSERT INTO fromage (id,pays_origine_id,nom,creation,image) values (" + Unfromage.Id + ", " + Unfromage.Idpays.Id + ", '" + Unfromage.Nom + "', '" + Unfromage.Creation + "', '" + Unfromage.Image + "') ;"); }
public void Delete(Fromage unFromage) { string query = "Fromage WHERE id = " + unFromage.Id; this.thedbal.Delete(query); }
public void Delete(Fromage unFromage) { string query = "Fromage WHERE identifiant = " + unFromage.getIdentifiant() + ";"; this._DBAL.Delete(query); }
public void delete(Fromage fromage) { NewDbal.Delete("DELETE FROM fromage where id = '" + fromage.Id + "';"); }
public void DeleteFromage(Fromage unFromage) { mydbal.Delete("Fromage", "id = " + unFromage.Id); }
public void update(Fromage fromage) { NewDbal.Update("update fromage set id=" + fromage.Id + ",pays_origine_id=" + fromage.Pays_origine_id + ",nom='" + fromage.Nom + "',creation=" + fromage.Creation + ",image='" + fromage.Image + "' where id=" + fromage.Id + ";"); }
public void Delete(Fromage unFromage) { string query = " fromage where name = '" + unFromage.Name + "';"; this.thedbal.Delete(query); }
public void Delete(Fromage myFromage) { string query = "fromage where id = '" + myFromage.Id + "'"; this.thedbal.Delete(query); }
public void Update(Fromage unFromage) { string query = "Fromage SET identifiant = " + unFromage.getIdentifiant() + ", idPays = " + unFromage.getIdPays() + ", nom = '" + unFromage.getNom() + "' , DureeAffinage = '" + unFromage.getDureeAffinage() + "', DateCreation = '" + unFromage.getDateCreation() + "', image = '" + unFromage.getImage() + "', recette = '" + unFromage.getRecette() + "', histoire = '" + unFromage.getHistoire() + "' WHERE identifiant = " + unFromage.getIdentifiant() + " ;"; this._DBAL.Update(query); }
public void insert(Fromage fromage) { NewDbal.Insert("INSERT INTO fromage(id,pays_origine_id,nom, creation, image ) VALUES(" + fromage.Id + "," + fromage.Pays_origine_id + ",'" + fromage.Nom + "','" + fromage.Creation + "','" + fromage.Image + "')"); }