Exemplo n.º 1
0
        public static bool modifierMedicament(Medicament unMedicament)
        {
            bool   test  = false;
            int    id    = unMedicament.getId();
            string nom   = unMedicament.getNom();
            int    stock = unMedicament.getStock();
            int    seuil = unMedicament.getSeuil();

            seConnecter();
            SqlCommand maCommande;
            String     requete = "Update medicaments set nom ='" + nom + "',stock=" + stock + ",seuil=" + seuil + " where id=" + id;

            maCommande = new SqlCommand(requete, laConnection);
            maCommande.ExecuteNonQuery();
            seDeconnecter();
            test = true;
            return(test);
        }
Exemplo n.º 2
0
        public static bool ajoutMedicament(Medicament unMedicament)
        {
            bool test = false;
            int  id   = trouverId("Medicaments");

            seConnecter();
            SqlCommand maCommande;
            String     requete = "Insert into medicaments values (" + unMedicament.getId() + ",'" + unMedicament.getNom() + "'," + unMedicament.getStock() + "," + unMedicament.getSeuil() + ")";

            maCommande = new SqlCommand(requete, laConnection);
            maCommande.ExecuteNonQuery();
            seDeconnecter();
            test = true;
            return(test);
        }