예제 #1
0
        private void moduleDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            Module d = (Module)moduleBindingSource.Current;

            if (e.ColumnIndex == 5)
            {
                new ModuleBAO().Delete(d.ID);
                this.Actualiser();
            }
            if (e.ColumnIndex == 3)
            {
                FormeGestionPrecision fp = new FormeGestionPrecision();
                fp.getid(d);
                fp.Show();
            }
            if (e.ColumnIndex == 4)
            {
                FormeModule f = new FormeModule();
                f.Ismodify = true;
                f.getid(d.ID);
                f.update(d);
                f.ShowDialog();
                this.Actualiser();
            }
            try
            {
                //  int id = int.Parse(moduleDataGridView.SelectedRows[0].Cells[0].Value.ToString());

                foreach (var item in new ModuleBAO().Select())
                {
                    if (d.ID == item.ID)
                    {
                        dureeLabel1.Text      = item.Duree.ToString();
                        competenceLabel1.Text = item.Competence.ToString();
                        nomLabel1.Text        = item.Nom.ToString();
                    }
                }
            }
            catch (Exception r)
            {
                MessageBox.Show(r.ToString());
            }
        }