1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| // ajouter un cours aux inscriptions, en cliquant sur un cours non suivi
private void notCoursDetudDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
DataGridViewRow row = notCoursDetudDataGridView.Rows[e.RowIndex];
int num = Convert.ToInt32(row.Cells[0].Value);
DataRow nvEnreg;
nvEnreg = ecoleDataSet.Inscription.NewInscriptionRow();
nvEnreg["numCours"] = num;
nvEnreg["numEtud"] = textBoxIdEtud.Text;
nvEnreg["année"] = DateTime.Now.Year.ToString();
nvEnreg["nom"] = textBoxNom.Text;
nvEnreg["prénom"] = textBoxPrenom.Text;
ecoleDataSet.Inscription.Rows.Add(nvEnreg);
inscriptionTableAdapter.Update(ecoleDataSet.Inscription);
Console.WriteLine();
this.coursTableAdapter.CoursDetud(this.ecoleDataSet.Cours, numero);
this.notCoursDetudTableAdapter.notCoursDetud(this.ecoleDataSet.notCoursDetud, numero);
Console.WriteLine(nvEnreg.RowState);
}
//enlever une inscription, en cliquant sur un cours suivi
private void coursDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
DataGridViewRow row = coursDataGridView.Rows[e.RowIndex];
DataRow nvEnreg;
int ncours = Convert.ToInt32(row.Cells[0].Value);
int netud = Convert.ToInt32(textBoxIdEtud.Text);
string ndate = Convert.ToString(row.Cells[3].Value);
ndate = ndate.Trim();
//nvEnreg = ecoleDataSet.Inscription.FindBynumCoursnumEtudannée(ncours, netud, ndate);
inscriptionTableAdapter.Delete(ncours, netud, ndate);
ecoleDataSet.AcceptChanges();
this.inscriptionTableAdapter.Update(ecoleDataSet.Inscription);
this.coursTableAdapter.Update(ecoleDataSet.Cours);
this.coursTableAdapter.CoursDetud(this.ecoleDataSet.Cours, numero);
this.notCoursDetudTableAdapter.notCoursDetud(this.ecoleDataSet.notCoursDetud, numero);
this.tableAdapterManager.UpdateAll(this.ecoleDataSet); |
Partager