public frmGradesClassSummary(Class Class, GradeType GradeType,
                                     SchoolSubject Subject)
        {
            InitializeComponent();

            db = new DbAndBusiness(Commons.PathAndFileDatabase);

            currentClass     = Class;
            currentGradeType = GradeType;
            currentSubject   = Subject;

            // fill the combos of lookup tables
            List <GradeType> listGradeTypes = db.GetListGradeTypes();

            cmbSummaryGradeType.DisplayMember = "Name";
            cmbSummaryGradeType.ValueMember   = "idGradeType";
            cmbSummaryGradeType.DataSource    = listGradeTypes;

            List <SchoolSubject> listSubjects = db.GetListSchoolSubjects(false);

            cmbSchoolSubjects.DisplayMember = "Name";
            cmbSchoolSubjects.ValueMember   = "idSchoolSubject";
            cmbSchoolSubjects.DataSource    = listSubjects;

            List <SchoolPeriod> listPeriods = db.GetSchoolPeriods(Class.SchoolYear);

            cmbSchoolPeriod.DataSource = listPeriods;
            // select the combo item of the partial period of the DateTime.Now
            foreach (SchoolPeriod sp in listPeriods)
            {
                if (sp.DateFinish > DateTime.Now && sp.DateStart < DateTime.Now &&
                    sp.IdSchoolPeriodType == "P")
                {
                    cmbSchoolPeriod.SelectedItem = sp;
                }
            }
            currentClass     = Class;
            currentGradeType = GradeType;
            currentSubject   = Subject;
        }
        private void frmGradesStudentsSummary_Load(object sender, EventArgs e)
        {
            if (currentStudent == null)
            {
                MessageBox.Show("Non è stato passato nessun studente");
                this.Close();
            }

            // student's name label
            lblCurrentStudent.Text = currentStudent.ToString();
            TxtIdStudent.Text      = currentStudent.IdStudent.ToString();
            lblSum.Text            = "";

            // fill the combos of lookup tables
            List <GradeType> listGrades = db.GetListGradeTypes();

            cmbSummaryGradeType.DisplayMember = "Name";
            cmbSummaryGradeType.ValueMember   = "idGradeType";
            cmbSummaryGradeType.DataSource    = listGrades;
            cmbSummaryGradeType.SelectedValue = currentGradeType.IdGradeType;

            List <SchoolSubject> listSubjects = db.GetListSchoolSubjects(false);

            cmbSchoolSubjects.DisplayMember = "Name";
            cmbSchoolSubjects.ValueMember   = "idGradeType";
            cmbSchoolSubjects.DataSource    = listSubjects;
            cmbSchoolSubjects.SelectedValue = currentSchoolSubject.IdSchoolSubject;

            List <SchoolPeriod> listPeriods = db.GetSchoolPeriods(currentSchoolYear);

            cmbSchoolPeriod.DataSource = listPeriods;

            dgwNotes.DataSource = db.AnnotationsAboutThisStudent(currentStudent, currentSchoolYear,
                                                                 chkAnnotationsShowActive.Checked);

            RefreshData();
        }