PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 0ms 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
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using LinqToExcel;
  6. using System.Web.UI;
  7. using System.IO;
  8. using LinqToSqlShared;
  9. using Remotion.Data.Linq;
  10. namespace Kronos.CLASSES
  11. {
  12. public class StudentsTranscript
  13. {
  14. public string Course { get; set; }
  15. public string Status { get; set; }
  16. }
  17. public class ExcelDataExtract : System.Web.UI.Page
  18. {
  19. private IQueryable returned_transcript;
  20. public ExcelDataExtract(string username)
  21. {
  22. var transcript_sheet=new ExcelQueryFactory();
  23. //transcript_sheet.DatabaseEngine;
  24. transcript_sheet.FileName=Server.MapPath("/transcripts/" + username);
  25. transcript_sheet.AddMapping<StudentsTranscript>(x => x.Course, "Course");
  26. transcript_sheet.AddMapping<StudentsTranscript>(x => x.Status, "Grade");
  27. var StudentsTranscript = from x in transcript_sheet.Worksheet<StudentsTranscript>() select x;
  28. returned_transcript=StudentsTranscript;
  29. //test to see if it works
  30. foreach (var t in StudentsTranscript)
  31. System.Diagnostics.Debug.WriteLine(t.Course);
  32. }
  33. //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
  34. public IQueryable processed_transcript()
  35. {
  36. return returned_transcript;
  37. }
  38. }
  39. }