Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
                    }
                }
        }
Exemplo n.º 5
0
 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);
             }
         }
 }
Exemplo n.º 6
0
        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");
        }
Exemplo n.º 7
0
        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);
                    }
                }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
 public void Delete(Fromage UnFromage)
 {
     thedbal.Delete("Fromage where id = " + UnFromage.Id + " ;");
 }
Exemplo n.º 10
0
 public void Delete(Fromage UnFromage)
 {
     _mydbal.Insert("DELETE FROM fromage where " + UnFromage.Id + " ;");
 }
Exemplo n.º 11
0
 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 + " ;");
 }
Exemplo n.º 12
0
 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 + "') ;");
 }
Exemplo n.º 13
0
        public void Delete(Fromage unFromage)
        {
            string query = "Fromage WHERE id = " + unFromage.Id;

            this.thedbal.Delete(query);
        }
Exemplo n.º 14
0
        public void Delete(Fromage unFromage)
        {
            string query = "Fromage WHERE identifiant = " + unFromage.getIdentifiant() + ";";

            this._DBAL.Delete(query);
        }
Exemplo n.º 15
0
 public void delete(Fromage fromage)
 {
     NewDbal.Delete("DELETE FROM fromage where id = '" + fromage.Id + "';");
 }
Exemplo n.º 16
0
 public void DeleteFromage(Fromage unFromage)
 {
     mydbal.Delete("Fromage", "id = " + unFromage.Id);
 }
Exemplo n.º 17
0
 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 + ";");
 }
Exemplo n.º 18
0
        public void Delete(Fromage unFromage)
        {
            string query = " fromage where name = '" + unFromage.Name + "';";

            this.thedbal.Delete(query);
        }
Exemplo n.º 19
0
        public void Delete(Fromage myFromage)
        {
            string query = "fromage where id = '" + myFromage.Id + "'";

            this.thedbal.Delete(query);
        }
Exemplo n.º 20
0
        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);
        }
Exemplo n.º 21
0
 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 + "')");
 }