/// <summary> /// Erzeugt die Listen mit den Objekten aus der Anmeldung. /// </summary> public void Generate() { // Variablen initialisieren judoka = new List<Judoka>(); verein = new Verein(); // Ko-Kriterien if (!System.IO.File.Exists(fileName)) return; Excel.Application excel = null; Excel.Workbook workbook = null; Excel.Worksheet worksheet = null; try { // Worksheet Initialisieren excel = new Excel.Application(); workbook = excel.Workbooks.Open(fileName, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, null, false, false, false); worksheet = (Excel.Worksheet)workbook.Sheets.get_Item(1); // Verein auslesen verein.Name = GetSheetValue(worksheet, "B2"); verein.Kurzname = GetSheetValue(worksheet, "B2"); verein.Email = GetSheetValue(worksheet, "B7"); System.Text.StringBuilder sb = new StringBuilder(); sb.AppendLine(GetSheetValue(worksheet, "B3")); sb.AppendLine(GetSheetValue(worksheet, "B4")); sb.AppendLine(GetSheetValue(worksheet, "B5")); sb.AppendLine(GetSheetValue(worksheet, "B6")); verein.Adresse = sb.ToString(); // Kämpfer auslesen int counter = 1; while (HasSheetJudoka(counter, worksheet)) { Judoka j = new Judoka(); j.Vorname = GetSheetValue(worksheet, GetJudokaCell(counter, "C")); j.Nachname = GetSheetValue(worksheet, GetJudokaCell(counter, "B")); try { j.Geburtsdatum = DateTime.FromOADate(double.Parse(GetSheetValue(worksheet, GetJudokaCell(counter, "F")))); } catch (Exception) { j.Geburtsdatum = new DateTime(1900, 1, 1); } j.Gürtel = new Gürtel(GetSheetValue(worksheet, GetJudokaCell(counter, "D")), "9"); j.Geschlecht = new Geschlecht(GetSheetValue(worksheet, GetJudokaCell(counter, "E"))); j.Verein = verein; judoka.Add(j); counter++; } } catch (Exception) { throw; } finally { // Excel beenden workbook.Close(false, null, 0); workbook = null; excel.Quit(); excel = null; System.GC.WaitForPendingFinalizers(); } }
private VereinService() { _verein = new Verein(); InitialisiereMitglieder(); }
public async Task DeleteAsync(Verein verein) { _context.verein.Remove(verein); await _context.SaveChangesAsync(); }
public async Task UpdateAsync(Verein verein) { _context.verein.Update(verein); await _context.SaveChangesAsync(); }
public async Task AddAsync(Verein verein) { _context.verein.Add(verein); await _context.SaveChangesAsync(); }