public List<TestAssessmentHeaderCollection> EnumerateHeaderData(Excel.Range range)
 {
     var headerData = new List<TestAssessmentHeaderCollection>();
     String fullname = "";
     fullname = Convert.ToString(((Excel.Range) range.Cells[2, 2]).Value2);
     string dob = Convert.ToString(((Excel.Range) range.Cells[3, 3]).Value2);
     string assessmentdate = Convert.ToString(((Excel.Range) range.Cells[4, 3]).Value2);
     string assesssmentAge = Convert.ToString(((Excel.Range) range.Cells[5, 3]).Value2);
     IStudentProfile getStudentAttribute = new GetStudentID();
     var studentNumber = 0;
     studentNumber = getStudentAttribute.StudentID(fullname);
     headerData.Add(new TestAssessmentHeaderCollection(studentNumber.ToString(), dob, assessmentdate, assesssmentAge));
     return headerData;
 }
        public override List<TestAssessmentMeasurmentCollection> GetTestMeasures(string studentFile)
        {
            // Open Excel Workbook.
            String filename = string.Empty;

            Excel.Application excelApp = new Excel.Application();
            Excel.Workbooks tmp = excelApp.Workbooks;

            var excelWorkbook = tmp.Open(@studentFile, Type.Missing, true, Type.Missing, Type.Missing,
                Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                Type.Missing, Type.Missing, Type.Missing, Type.Missing,
                Type.Missing, Type.Missing);

            excelApp.Visible = true;

            excelApp.DisplayAlerts = false;
            //String activeworksheet = "Accepted Test Indicies";
            var excelWorksheet = (Excel.Worksheet)excelWorkbook.Worksheets.Item[1];
            excelWorksheet.Select(true);
            excelWorksheet.Unprotect();
            excelApp.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable;

            var range = excelWorksheet.UsedRange;

            excelWorksheet.Cells[1, 1].EntireColumn.ColumnWidth = 15;
            excelWorksheet.Cells[1, 3].EntireColumn.ColumnWidth = 20;

               /*
            *Capture Student fullname from Excel file and then get their student number form the data store.
            * If student if no number is return then they does not exist therefore add the student fullname to the datastore.
            */

            String fullname="";
            var range1 = range.Cells[2, 2] as Excel.Range;
            if (range1 != null)
                fullname = Convert.ToString(range1.Value2);
            IStudentProfile getStudentAttribute = new GetStudentID();
            int studentNumber=0;
            studentNumber=getStudentAttribute.StudentID(fullname);

            /*Parse Student Assessment Data from Excel Open Excel Document*/

            IEnumerateExcelTestAssessmentData processStudentAssessmentData = new AssessmentTestDataEnumerator();

            var testAttribute = processStudentAssessmentData.EnumerateAllTestData(studentNumber.ToString(), range);

            /*Close Excel Workbook*/

            excelWorkbook.Close(0);
            excelApp.Application.Quit();
            GC.Collect();
            GC.WaitForPendingFinalizers();
            Marshal.ReleaseComObject(tmp);
            Marshal.ReleaseComObject(excelWorksheet);
            Marshal.ReleaseComObject(excelWorkbook);
            Marshal.ReleaseComObject(excelApp);

            return testAttribute;
        }