soen341kronos /Kronos/Kronos/CLASSES/ExcelDataExtract.cs

Language C# Lines 48
MD5 Hash 04c370ee07b6414681a6313b8f054b8d
Repository https://github.com/lle/soen341kronos.git View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using LinqToExcel;
using System.Web.UI;
using System.IO;
using LinqToSqlShared;
using Remotion.Data.Linq;
namespace Kronos.CLASSES
{
    public class StudentsTranscript
    {
        public string Course { get; set; }
        public string Status { get; set; }
    }

    public class ExcelDataExtract : System.Web.UI.Page
    {
       private IQueryable returned_transcript;

        public ExcelDataExtract(string username)
        {
         var transcript_sheet=new ExcelQueryFactory();
         //transcript_sheet.DatabaseEngine;
         transcript_sheet.FileName=Server.MapPath("/transcripts/" + username);
         transcript_sheet.AddMapping<StudentsTranscript>(x => x.Course, "Course");
         transcript_sheet.AddMapping<StudentsTranscript>(x => x.Status, "Grade");
        var StudentsTranscript = from x in transcript_sheet.Worksheet<StudentsTranscript>() select x;
          returned_transcript=StudentsTranscript;


            //test to see if it works


          foreach (var t in StudentsTranscript)
              System.Diagnostics.Debug.WriteLine(t.Course);


        }
        //an excel file needs to have two records for the student record; the first column is the course; second column is either the grade or pass fail status
        public IQueryable processed_transcript()
        {
            return returned_transcript;
        }

    }
}
Back to Top