private void frmNewYear_Load(object sender, EventArgs e) { // school data currentSchool = db.GetSchool(TxtOfficialSchoolAbbreviation.Text); // first default year in the "years" combo int anno = 2009; for (; anno <= DateTime.Now.Year; anno++) { CmbPresentSchoolYear.Items.Add((anno - 2000).ToString("00") + ((anno + 1) - 2000).ToString("00")); } int nAnni = CmbPresentSchoolYear.Items.Count; if (DateTime.Now.Month >= 9) { CmbPresentSchoolYear.SelectedItem = CmbPresentSchoolYear.Items[nAnni - 1]; } else { CmbPresentSchoolYear.SelectedItem = CmbPresentSchoolYear.Items[nAnni - 2]; } CmbPresentSchoolYear.Text = idStartYear; }
private void FrmClassesManagement_Load(object sender, EventArgs e) { // school data currentSchool = db.GetSchool(TxtOfficialSchoolAbbreviation.Text); // primo anno di default del combo con gli anni int anno = 2009; for (; anno <= DateTime.Now.Year; anno++) { CmbSchoolYear.Items.Add((anno - 2000).ToString("00") + ((anno + 1) - 2000).ToString("00")); } int nAnni = CmbSchoolYear.Items.Count; if (DateTime.Now.Month >= 9) { CmbSchoolYear.SelectedItem = CmbSchoolYear.Items[nAnni - 1]; } else { CmbSchoolYear.SelectedItem = CmbSchoolYear.Items[nAnni - 2]; } idSchoolYear = CmbSchoolYear.SelectedItem.ToString(); CmbClasses.DataSource = db.GetClassesOfYear(TxtOfficialSchoolAbbreviation.Text, idSchoolYear); }