Exemplo n.º 1
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (!DScnxBd.verifierExitanceCNE(textBox3.Text))
            {
                DataRow ligne = DScnxBd.ds.Tables["etudiant"].NewRow();

                ligne[0] = textBox3.Text;
                ligne[1] = textBox5.Text;
                ligne[2] = textBox4.Text;
                if (radioButton1.Checked)
                {
                    ligne[3] = 'f';
                }
                else
                {
                    ligne[3] = 'h';
                }

                ligne[4] = (DateTime)dateTimePicker1.Value;
                ligne[5] = textBox6.Text;
                ligne[6] = textBox7.Text;
                ligne[7] = comboBox3.SelectedValue;


                DScnxBd.ds.Tables["etudiant"].Rows.Add(ligne);
            }
            else
            {
                MessageBox.Show("l'etudiant eexiste deja");
            }
        }
Exemplo n.º 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            DScnxBd bd = new DScnxBd();

            Application.Run(new Form1());
        }
        private void button2_Click(object sender, EventArgs e)
        {
            for (int i = 1; i <= ws.UsedRange.Rows.Count; i++)
            {
                if (!DScnxBd.verifierExitanceCNE(ws.Cells[i, 1].Value))
                {
                    DataRow ligne = DScnxBd.ds.Tables["etudiant"].NewRow();
                    for (int j = 1; j <= ws.UsedRange.Columns.Count; j++)
                    {
                        if (j == 5)
                        {
                            ligne[j - 1] = (DateTime)ws.Cells[i, j].Value;
                        }
                        else if (j == 8)
                        {
                            for (int k = 0; k < DScnxBd.ds.Tables["filliere"].Rows.Count; k++)
                            {
                                if (DScnxBd.ds.Tables["filliere"].Rows[k][1].ToString().Trim() == ws.Cells[i, j].Value)
                                {
                                    ligne[j - 1] = DScnxBd.ds.Tables["filliere"].Rows[k][0];
                                }
                            }
                        }
                        else
                        {
                            ligne[j - 1] = ws.Cells[i, j].Value;
                        }
                    }
                    DScnxBd.ds.Tables["etudiant"].Rows.Add(ligne);
                }
                else
                {
                    MessageBox.Show("L'etudiant numero " + i + "existe deja");
                }
            }

            this.Dispose();
        }