private async Task <int> ExportStudentSchoolClassAttendances(XlsReader xlsReader, EcfTableWriter ecfTableWriter, string[] ecfHeaders) { var ecfRecordCounter = 0; if (ecfHeaders != null && ecfHeaders.Length > 0) { await ecfTableWriter.WriteHeadersAsync(ecfHeaders); } else { await ecfTableWriter.WriteHeadersAsync( EcfHeaders.StudentId, EcfHeaders.SchoolClassId); } while (xlsReader.ReadLine()) { var student = new ExportStudent(_config, xlsReader); var schoolClass = new ExportSchoolClass(_config, xlsReader); if (!string.IsNullOrEmpty(schoolClass.Id)) { ecfTableWriter.SetValue(EcfHeaders.StudentId, student.Id); ecfTableWriter.SetValue(EcfHeaders.SchoolClassId, schoolClass.Id); await ecfTableWriter.WriteAsync(); ecfRecordCounter++; } } return(ecfRecordCounter); }
private async Task <int> ExportSchoolClasses(XlsReader xlsReader, EcfTableWriter ecfTableWriter, string[] ecfHeaders) { var ecfCache = new HashSet <string>(); var ecfRecordCounter = 0; if (ecfHeaders != null && ecfHeaders.Length > 0) { await ecfTableWriter.WriteHeadersAsync(ecfHeaders); } else { await ecfTableWriter.WriteHeadersAsync( EcfHeaders.Id, EcfHeaders.Code); } while (xlsReader.ReadLine()) { var schoolClass = new ExportSchoolClass(_config, xlsReader); if (!string.IsNullOrEmpty(schoolClass.Id) && !ecfCache.Contains(schoolClass.Id)) { ecfTableWriter.SetValue(EcfHeaders.Id, schoolClass.Id); ecfTableWriter.SetValue(EcfHeaders.Code, schoolClass.Code); await ecfTableWriter.WriteAsync(); ecfCache.Add(schoolClass.Id); ecfRecordCounter++; } } return(ecfRecordCounter); }
private async Task <int> ExportStudents(XlsReader xlsReader, EcfTableWriter ecfTableWriter, string[] ecfHeaders) { var ecfCache = new HashSet <string>(); var ecfRecordCounter = 0; if (ecfHeaders != null && ecfHeaders.Length > 0) { await ecfTableWriter.WriteHeadersAsync(ecfHeaders); } else { await ecfTableWriter.WriteHeadersAsync( EcfHeaders.Id, EcfHeaders.LastName, EcfHeaders.FirstName, EcfHeaders.MiddleName, EcfHeaders.NickName, EcfHeaders.Salutation, EcfHeaders.Gender, EcfHeaders.Birthdate); } while (xlsReader.ReadLine()) { var student = new ExportStudent(_config, xlsReader); if (!ecfCache.Contains(student.Id)) { ecfTableWriter.SetValue(EcfHeaders.Id, student.Id); ecfTableWriter.SetValue(EcfHeaders.LastName, student.LastName); ecfTableWriter.SetValue(EcfHeaders.FirstName, student.FirstName); ecfTableWriter.SetValue(EcfHeaders.MiddleName, student.MiddleName); ecfTableWriter.SetValue(EcfHeaders.NickName, student.NickName); ecfTableWriter.SetValue(EcfHeaders.Salutation, student.Salutation); ecfTableWriter.SetValue(EcfHeaders.Gender, student.Gender); ecfTableWriter.SetValue(EcfHeaders.Birthdate, student.BirthDate); await ecfTableWriter.WriteAsync(); ecfCache.Add(student.Id); ecfRecordCounter++; } } return(ecfRecordCounter); }
private async Task <int> ExportSubjects(XlsReader xlsReader, EcfTableWriter ecfTableWriter, string[] ecfHeaders) { var ecfCache = new HashSet <string>(); var ecfRecordCounter = 0; if (ecfHeaders != null && ecfHeaders.Length > 0) { await ecfTableWriter.WriteHeadersAsync(ecfHeaders); } else { await ecfTableWriter.WriteHeadersAsync( EcfHeaders.Id, EcfHeaders.Code); } while (xlsReader.ReadLine()) { for (int i = 1; i < 20; i++) { var subject = new ExportSubject(_config, xlsReader, $"Fach{i}"); if (!string.IsNullOrEmpty(subject.Id) && !ecfCache.Contains(subject.Id)) { ecfTableWriter.SetValue(EcfHeaders.Id, subject.Id); ecfTableWriter.SetValue(EcfHeaders.Code, subject.Code); await ecfTableWriter.WriteAsync(); ecfCache.Add(subject.Id); ecfRecordCounter++; } } } return(ecfRecordCounter); }