PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Kronos/Kronos/CLASSES/ExcelDataExtract.cs

https://github.com/lle/soen341kronos
C# | 48 lines | 36 code | 9 blank | 3 comment | 0 complexity | 04c370ee07b6414681a6313b8f054b8d MD5 | raw file
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Web;
 5using LinqToExcel;
 6using System.Web.UI;
 7using System.IO;
 8using LinqToSqlShared;
 9using Remotion.Data.Linq;
10namespace Kronos.CLASSES
11{
12    public class StudentsTranscript
13    {
14        public string Course { get; set; }
15        public string Status { get; set; }
16    }
17
18    public class ExcelDataExtract : System.Web.UI.Page
19    {
20       private IQueryable returned_transcript;
21
22        public ExcelDataExtract(string username)
23        {
24         var transcript_sheet=new ExcelQueryFactory();
25         //transcript_sheet.DatabaseEngine;
26         transcript_sheet.FileName=Server.MapPath("/transcripts/" + username);
27         transcript_sheet.AddMapping<StudentsTranscript>(x => x.Course, "Course");
28         transcript_sheet.AddMapping<StudentsTranscript>(x => x.Status, "Grade");
29        var StudentsTranscript = from x in transcript_sheet.Worksheet<StudentsTranscript>() select x;
30          returned_transcript=StudentsTranscript;
31
32
33            //test to see if it works
34
35
36          foreach (var t in StudentsTranscript)
37              System.Diagnostics.Debug.WriteLine(t.Course);
38
39
40        }
41        //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
42        public IQueryable processed_transcript()
43        {
44            return returned_transcript;
45        }
46
47    }
48}