Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dta = new DataTable();

            if (textBox1.Text == "" || textBox2.Text == "" || textBox7.Text == "" || textBox8.Text == "")
            {
                MessageBox.Show("Veuillez remplir tout les champs", "Ajoute Echouee", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                o.conex();
                o.cmd = new SqlCommand("Select * from Locateurs where CIN = '" + textBox2.Text + "' or NomComplete ='" + textBox7.Text + "'", o.cn);
                o.dr  = o.cmd.ExecuteReader();
                dta.Load(o.dr);
                o.Deconex();

                if (dta.Rows.Count == 0)
                {
                    o.conex();
                    o.cmd = new SqlCommand("Insert into Locateurs values ('" + textBox2.Text + "','" + textBox7.Text + "','" + dateTimePicker1.Text.ToString() + "','" + textBox1.Text + "','" + textBox8.Text + "')", o.cn);
                    o.cmd.ExecuteNonQuery();
                    MessageBox.Show("Locateur Bien Ajoutee", "Ajoute Reussi", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    o.Deconex();
                    this.Hide();
                    NouvelleLocation L = new NouvelleLocation();
                    L.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Le Nom ou Le CIN que vous avez saisie appartient deja a un Locateur ", "Ajoute Echouee", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            NouvelleLocation NN = new NouvelleLocation();

            NN.ShowDialog();
            this.Close();
        }
Ejemplo n.º 3
0
        private void nouvelleLocationToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            NouvelleLocation a = new NouvelleLocation();

            a.ShowDialog();
        }