private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            Voitures V = new Voitures();

            V.ShowDialog();
            this.Close();
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox2.Text == "" || textBox3.Text == "Ex : 0000|X|00" || comboBox3.SelectedIndex == -1 || comboBox2.SelectedIndex == -1 || textBox7.Text == "")
     {
         MessageBox.Show("Soyez sure que tout les champs sont remplit " + "\n" + "Avant de cliquer Ajouter", "Ajoute echoue", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         o.conex();
         o.cmd = new SqlCommand("insert into Voitures values('" + textBox2.Text + "','" + textBox3.Text + "','" + Convert.ToInt32(numericUpDown2.Value) + " Places" + "','" + comboBox3.SelectedItem.ToString() + "','" + comboBox2.SelectedItem.ToString() + "','" + textBox7.Text + "','" + "Oui" + "','" + Convert.ToInt32(numericUpDown1.Value) + " DH" + "')", o.cn);
         o.cmd.ExecuteNonQuery();
         MessageBox.Show("Voiture Bien Ajoutee", "Ajoute Reussi", MessageBoxButtons.OK, MessageBoxIcon.Information);
         o.Deconex();
         this.Hide();
         Voitures VA = new Voitures();
         VA.ShowDialog();
         this.Close();
     }
 }
示例#3
0
 private void Enregistrer_Click(object sender, EventArgs e)
 {
     if (textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "" && comboBox2.SelectedIndex != -1 && comboBox3.SelectedIndex != -1 && textBox7.Text != "" && textBox9.Text != "")
     {
         o.conex();
         o.cmd = new SqlCommand("Update Voitures set Marque ='" + textBox2.Text + "', Matricule ='" + textBox3.Text + "', Capacite ='" + Convert.ToInt32(numericUpDown2.Value) + " Places" + "', Boite_Vitesse ='" + comboBox2.SelectedItem.ToString() + "', Carburant ='" + comboBox3.SelectedItem.ToString() + "', Couleur ='" + textBox7.Text + "', Disponibilite ='" + comboBox1.SelectedItem.ToString() + "', Prix_Par_Jour ='" + Convert.ToInt32(numericUpDown1.Value) + " DH" + "' where IdVoiture = '" + textBox1.Text + "'", o.cn);
         o.cmd.ExecuteNonQuery();
         MessageBox.Show("Voiture " + textBox1.Text + " Bien Modifie", "Modification Reussi", MessageBoxButtons.OK, MessageBoxIcon.Information);
         o.Deconex();
         this.Hide();
         Voitures VA = new Voitures();
         VA.ShowDialog();
         this.Close();
     }
     else
     {
         MessageBox.Show("Soyez sure que tout les champs sont remplit " + "\n" + "Avant de cliquer Enregistrer", "Modification echoue", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#4
0
        private void menuVoituresToolStripMenuItem1_Click_1(object sender, EventArgs e)
        {
            Voitures a = new Voitures();

            a.ShowDialog();
        }