Exemplo n.º 1
0
        public void insertCit(Citoyen citoyen)
        {
            Citoyen c1 = new Citoyen();

            dataBase = new DataBase();
            dataBase.insertCitoyen(c1);
        }
Exemplo n.º 2
0
        private void ok_Btn_Click(object sender, EventArgs e)
        {
            Citoyen c1 = new Citoyen();

            c1.setcin(textcin2.Text);
            c1.setNom(textnom.Text);
            c1.setPrenom(textprenom.Text);
            c1.setAdresse(textadress.Text);
            c1.setAge(Convert.ToInt32(textage.Text));
            c1.setMaladie_grave(textmalad.Text);
            c1.setEtat(Convert.ToInt32(textetat.Text));
            metier = new Metier();
            metier.insertCit(c1);
        }
 public void insertCitoyen(Citoyen citoyen)
 {
     if (OpenConnection())
     {
         String sql = "INSERT INTO Citoyen(cin,nom,prenom,age,adresse,etat,maladie_grave) VALUES('" + citoyen.getcin() + "','" + citoyen.getNom() + "','" +
                      citoyen.getPrenom() + "'," + citoyen.getAge() + ",'" + citoyen.getAdresse() + "'," + citoyen.getEtat() + ",'" + citoyen.getMaladie_grave() + "')";
         try
         {
             SqlCommand command = new SqlCommand(sql, con);
             command.ExecuteNonQuery();
             CloseConnection();
             MessageBox.Show("DONE");
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }