コード例 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                clientDAO repo = new clientDAO();

                dataGridView1.DataSource = repo.Liste();
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
        private void buttonValider_Click(object sender, EventArgs e)
        {
            if (insert == true)
            {
                //client newcli = new client
                //{
                newcli.cli_nom     = textBoxNom.Text;
                newcli.cli_adresse = textBoxAdresse.Text;
                newcli.cli_contact = textBoxTel.Text;
                //newcli.cli_type = Convert.ToString(cli_type);
                //};

                clientDAO repo = new clientDAO();

                repo.Insert(newcli);

                dataGridView1.DataSource = repo.Liste();
            }
            if (update == true)
            {
                //client newcli = new client
                //{
                newcli.cli_numero  = clinumero;
                newcli.cli_nom     = textBoxNom.Text;
                newcli.cli_adresse = textBoxAdresse.Text;
                newcli.cli_contact = textBoxTel.Text;
                //cli_type = Convert.ToString(cli_type),
                //};

                clientDAO repo = new clientDAO();

                repo.Update(newcli);

                dataGridView1.DataSource = repo.Liste();
            }
            if (delete == true)
            {
                newcli.cli_numero = clinumero;


                clientDAO repo = new clientDAO();

                repo.Delete(newcli);

                dataGridView1.DataSource = repo.Liste();
            }
        }