private void BtnStudentNew_Click(object sender, EventArgs e) { frmStudent sf = new frmStudent(null, true); sf.ShowDialog(); if (sf.UserHasChosen) { List <Student> ls = (List <Student>)DgwStudents.DataSource; ls.Add(sf.CurrentStudent); DgwStudents.DataSource = null; DgwStudents.DataSource = ls; DgwStudents.Refresh(); } }
private void DgwStudents_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { List <Student> ls = (List <Student>)(DgwStudents.DataSource); Student s = ls[e.RowIndex]; s.SchoolYear = currentClass.SchoolYear; frmStudent fs = new frmStudent(s, true); fs.ShowDialog(); Class c = (Class)CmbClasses.SelectedItem; FillClassData(c); } }
private void BtnStudentNew_Click(object sender, EventArgs e) { if (CmbClasses.Text == "") { MessageBox.Show("Scegliere una classe"); return; } frmStudent sf = new frmStudent(null, true); sf.ShowDialog(); if (sf.UserHasChosen) { db.PutStudentInClass(sf.CurrentStudent.IdStudent, ((Class)(CmbClasses.SelectedItem)).IdClass); DgwStudents.DataSource = db.GetStudentsOfClassList(TxtOfficialSchoolAbbreviation.Text, idSchoolYear, CmbClasses.Text, false); } }
private void BtnStudentNew_Click(object sender, EventArgs e) { if (CmbClasses.Text == "") { MessageBox.Show("Scegliere una classe"); return; } frmStudent sf = new frmStudent(null, true); sf.ShowDialog(); if (sf.UserHasChosen) { Commons.bl.PutStudentInClass(sf.CurrentStudent.IdStudent, ((Class)(CmbClasses.SelectedItem)).IdClass); DgwStudents.DataSource = Commons.bl.GetStudentsOfClassList(TxtOfficialSchoolAbbreviation.Text, idSchoolYear, CmbClasses.Text, false); } else { MessageBox.Show("Studente non aggiunto alla classe \n(premere 'Scegli' nella finestra appena chiusa)"); } }