상속: DbContext
        // Method to select data from the database
        public static IEnumerable<ReportsUI> GetReportData()
        {
            using (torontoDB db = new torontoDB())
            {

                var reportData = from c in db.ElectionContributions.AsEnumerable()

                                 // filter the report. This is hardcoded, but we should be taking these values
                                 // from select boxes on the view

                                 where c.ElectionType == ("Mayoral") && c.ElectionYear == (Convert.ToDouble(2010)) && c.WardNum == 2

                                  select new ReportsUI                                       // Create new ReportUI object and assign it the values selected from the database
                                  {
                                      ElectionType = c.ElectionType,
                                      ElectionYear = c.ElectionYear,
                                      WardNum = c.WardNum,
                                      ContributorFirstName = c.ContributorFirstName,
                                      ContributorLastName = c.ContributorLastName,
                                      CandidateLastName = c.CandidateLastName,
                                      ContributionTypeDesc = c.ContributionTypeDesc
                                  };

                return reportData.ToArray();                                                // ToArray() method is needed to prevent DbContext error

            }
        }
        // Method to select data from the database
        // report 2 from results
        public static IEnumerable<ReportsUI> GetReportData2()
        {
            using (torontoDB db = new torontoDB())
            {

                var reportData2 = from c in db.ElectionResults.AsEnumerable()

                                 // filter the report. This is hardcoded, but should be taking these values
                                 // from select boxes on the view

                                 where c.ElectionType == ("Council") && c.ElectionYear == (Convert.ToDouble(2006)) && c.NumVotes >= 5000

                                 select new ReportsUI                                    // Create new ReportUI object and assign it the values selected from the database
                                 {
                                     ElectionType = c.ElectionType,
                                     ElectionYear = c.ElectionYear,
                                     CandidateFirstName = c.CandidateFirstName,
                                     CandidateLastName = c.CandidateLastName,
                                     WardNum = c.WardNum,
                                     NumVotes = c.NumVotes
                                 };

                return reportData2.ToArray();                                                // ToArray() method is needed to prevent DbContext error

            }
        }
        // Method to select data from the database
        public static IEnumerable<ReportsUI> GetReportData(string ElectionType, int ElectionYear, int WardNum, String CandidateLastName, String ContributionTypeDesc)
        {
            using (torontoDB db = new torontoDB())
            {

                var reportData = from c in db.ElectionContributions.AsEnumerable()

                                 where c.ElectionType == (ElectionType) && c.ElectionYear == (Convert.ToDouble(ElectionYear)) && c.WardNum == (Convert.ToDouble(WardNum)) && c.CandidateLastName == CandidateLastName && c.ContributionTypeDesc == (ContributionTypeDesc)

                                 select new ReportsUI                                       // Create new ReportUI object and assign it the values selected from the database
                                 {
                                     ElectionType = c.ElectionType,
                                     ElectionYear = c.ElectionYear,
                                     WardNum = c.WardNum,
                                     ContributorFirstName = c.ContributorFirstName,
                                     ContributorLastName = c.ContributorLastName,
                                     CandidateLastName = c.CandidateLastName,
                                     ContributionTypeDesc = c.ContributionTypeDesc,
                                     Amount = c.Amount
                                 };

                return reportData.ToArray();                                                // ToArray() method is needed to prevent DbContext error

            }
        }