public void ReadExcelTest()
        {
            excelService = Mvx.IoCProvider.Resolve <IExcelService>();

            var    assembly     = Assembly.GetExecutingAssembly();
            string resourceName = assembly.GetManifestResourceNames()
                                  .Single(str => str.Contains(classSheetName));

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
            {
                excelService.OpenFile(stream, classSheetName);
            }
            excelService.ReadTables();

            classSheet = excelService.GetSheet();

            mathe     = excelService.GetMathe();
            deutsch   = excelService.GetDeutsch();
            sachkunde = excelService.GetSachkunde();
            englisch  = excelService.GetEnglisch();
            kunst     = excelService.GetKunst();
            werken    = excelService.GetWerken();
            musik     = excelService.GetMusik();
            sport     = excelService.GetSport();
            ethik     = excelService.GetEthik();
            religion  = excelService.GetReligion();
            gesamtHj  = excelService.GetGesamtHj();
            gesamtEj  = excelService.GetGesamtEj();
            lehrer    = excelService.GetLehrer();
        }
Ejemplo n.º 2
0
    public void ClassGetSheet()
    {
        var    excel = Excel;
        ISheet sheet = excel.GetSheetAt(2);

        Assert.AreEqual(5, SheetInfo.GetColumnCount(sheet));
        Assert.AreEqual(11, SheetInfo.GetRowCount(sheet));

        SheetInfo.TryGetSheetInfo(sheet, opt, out SheetInfo sheetInfo);
        var x = ClassSheet.GetOrNull(sheetInfo);

        Assert.AreEqual(4, x.Contents.Length);
    }
        public static List <Data.Models.Teacher> GetTeachers(ClassSheet classSheet)
        {
            List <Data.Models.Teacher> dbTeachers = new List <Data.Models.Teacher>();

            foreach (var excelTeacher in classSheet.Lehrer)
            {
                Data.Models.Teacher dbTeacher = new Data.Models.Teacher();

                dbTeacher.FirstName    = excelTeacher.Vorname;
                dbTeacher.LastName     = excelTeacher.Nachname;
                dbTeacher.Abbreviation = excelTeacher.Kuerzel;

                dbTeachers.Add(dbTeacher);
            }

            return(dbTeachers);
        }