Пример #1
0
        private void Form4_Load(object sender, EventArgs e)
        {
            List <Applicant>           applicants = appDatabase.SelectAllRecords();
            List <DataGridGroupObject> group      = new List <DataGridGroupObject>();
            var blist = new BindingList <Applicant>(applicants);

            dataGridView1.DataSource = blist;
        }
    public static List <Applicant> getSortedList()
    {
        List <Applicant> listApplicants = appDatabase.SelectAllRecords();

        foreach (var applicant in listApplicants)
        {
            var index  = listApplicants.IndexOf(applicant);
            var grades = new List <double> {
                applicant.MathGrade, applicant.InfoGrade, applicant.TestGrade
            };
            double avgPonderateGrade = applicant.TestGrade / 2 + applicant.BacGrade / 4 + grades.Max() / 4;

            applicant.AdmissionGrade = avgPonderateGrade;
        }

        var listApplicantsSortedByGrade = listApplicants.OrderByDescending(s => s.AdmissionGrade).ToList();

        return(listApplicantsSortedByGrade);
    }
Пример #3
0
        private void publishResults_Click(object sender, EventArgs e)
        {
            IApplicantDatabase appDatabase = ApplicantDatabase.InitializeDatabase("applicantTable.txt");

            TestPopulateDatabase(appDatabase);

            List <Applicant> listApplicants = appDatabase.SelectAllRecords();

            SortedList listApplicantsSortedByGrade = new SortedList();

            for (int iApp = 0; iApp < listApplicants.Count; iApp++)
            {
                Applicant applicant = listApplicants[iApp];

                double avgPonderateGrade = (applicant.BacGrade + applicant.InfoGrade + applicant.MathGrade) / 3;

                listApplicantsSortedByGrade.Add(avgPonderateGrade, applicant);
            }

            WriteResultsToPdfFile(listApplicantsSortedByGrade);
        }
 internal List <Applicant> SelectAllRecords()
 {
     return(appDatabase.SelectAllRecords());
 }