private static void LesGeobox(ExcelWorksheet sheet, int row, ExcelMatch match) { var point = sheet.GetValue(ExcelSheet.Match.GeoBox_NW_latitude, row); if (!string.IsNullOrEmpty(point)) { match.GeoboxNWLatitude = double.Parse(point); } point = sheet.GetValue(ExcelSheet.Match.GeoBox_NW_longitude, row); if (!string.IsNullOrEmpty(point)) { match.GeoboxNWLongitude = double.Parse(point); } point = sheet.GetValue(ExcelSheet.Match.GeoBox_SE_latitude, row); if (!string.IsNullOrEmpty(point)) { match.GeoboxSELatitude = double.Parse(point); } point = sheet.GetValue(ExcelSheet.Match.GeoBox_SE_longitude, row); if (!string.IsNullOrEmpty(point)) { match.GeoboxSELongitude = double.Parse(point); } }
private void LesVåpenOppsett(ExcelWorksheet sheet, int row, ExcelMatch match) { var våpen = sheet.GetValue(ExcelSheet.Match.Pr_lag_FELLE, row); if (!string.IsNullOrEmpty(våpen)) { match.PrLagFelle = int.Parse(våpen); } våpen = sheet.GetValue(ExcelSheet.Match.Pr_lag_BOMBE, row); if (!string.IsNullOrEmpty(våpen)) { match.PrLagBombe = int.Parse(våpen); } }
private void AddOrUpdate(ExcelMatch match) { using (var context = _dataContextFactory.Create()) { var existing = (from m in context.Matcher where m.MatchId == match.MatchId select m).FirstOrDefault(); if (existing == null) { context.Matcher.Add(match.GetMatch()); } else { match.Update(existing); } context.SaveChanges(); } }
public static ExcelMatch FromMatch(Match match) { var excelMatch = new ExcelMatch(); if (match == null) { return(excelMatch); } excelMatch.MatchId = match.MatchId; excelMatch.Navn = match.Navn; excelMatch.StartTid = match.StartTid; excelMatch.SluttTid = match.SluttTid; excelMatch.GeoboxNWLatitude = match.GeoboxNWLatitude; excelMatch.GeoboxNWLongitude = match.GeoboxNWLongitude; excelMatch.GeoboxSELatitude = match.GeoboxSELatitude; excelMatch.GeoboxSELongitude = match.GeoboxSELongitude; return(excelMatch); }
public ExcelMatch Les(ExcelWorksheet sheet) { var row = 2; var match = new ExcelMatch { MatchId = Guid.Parse(sheet.GetValue(ExcelSheet.Match.MatchId, row)), Navn = sheet.GetValue(ExcelSheet.Match.Navn, row), StartTid = DateTime.Parse(sheet.GetValue(ExcelSheet.Match.Starttid, row)), SluttTid = DateTime.Parse(sheet.GetValue(ExcelSheet.Match.Sluttid, row)), DefaultPoengFordeling = sheet.GetValue(ExcelSheet.Match.DefaultPostPoengfordeling, row) }; LesGeobox(sheet, row, match); LesVåpenOppsett(sheet, row, match); AddOrUpdate(match); LeggInnVåpen(); return match; }
public ExcelMatch Les(ExcelWorksheet sheet) { var row = 2; var match = new ExcelMatch { MatchId = Guid.Parse(sheet.GetValue(ExcelSheet.Match.MatchId, row)), Navn = sheet.GetValue(ExcelSheet.Match.Navn, row), StartTid = DateTime.Parse(sheet.GetValue(ExcelSheet.Match.Starttid, row)), SluttTid = DateTime.Parse(sheet.GetValue(ExcelSheet.Match.Sluttid, row)), DefaultPoengFordeling = sheet.GetValue(ExcelSheet.Match.DefaultPostPoengfordeling, row) }; LesGeobox(sheet, row, match); LesVåpenOppsett(sheet, row, match); AddOrUpdate(match); LeggInnVåpen(); return(match); }
private static void LesGeobox(ExcelWorksheet sheet, int row, ExcelMatch match) { var point = sheet.GetValue(ExcelSheet.Match.GeoBox_NW_latitude, row); if (!string.IsNullOrEmpty(point)) match.GeoboxNWLatitude = double.Parse(point); point = sheet.GetValue(ExcelSheet.Match.GeoBox_NW_longitude, row); if (!string.IsNullOrEmpty(point)) match.GeoboxNWLongitude = double.Parse(point); point = sheet.GetValue(ExcelSheet.Match.GeoBox_SE_latitude, row); if (!string.IsNullOrEmpty(point)) match.GeoboxSELatitude = double.Parse(point); point = sheet.GetValue(ExcelSheet.Match.GeoBox_SE_longitude, row); if (!string.IsNullOrEmpty(point)) match.GeoboxSELongitude = double.Parse(point); }
public static ExcelMatch FromMatch(Match match) { var excelMatch = new ExcelMatch(); if (match == null) return excelMatch; excelMatch.MatchId = match.MatchId; excelMatch.Navn = match.Navn; excelMatch.StartTid = match.StartTid; excelMatch.SluttTid = match.SluttTid; excelMatch.GeoboxNWLatitude = match.GeoboxNWLatitude; excelMatch.GeoboxNWLongitude = match.GeoboxNWLongitude; excelMatch.GeoboxSELatitude = match.GeoboxSELatitude; excelMatch.GeoboxSELongitude = match.GeoboxSELongitude; return excelMatch; }
private void LesVåpenOppsett(ExcelWorksheet sheet, int row, ExcelMatch match) { var våpen = sheet.GetValue(ExcelSheet.Match.Pr_lag_FELLE, row); if (!string.IsNullOrEmpty(våpen)) match.PrLagFelle = int.Parse(våpen); våpen = sheet.GetValue(ExcelSheet.Match.Pr_lag_BOMBE, row); if (!string.IsNullOrEmpty(våpen)) match.PrLagBombe = int.Parse(våpen); }