Repository.Import.MatchImport.Les C# (CSharp) Method

Les() public method

public Les ( OfficeOpenXml.ExcelWorksheet sheet ) : ExcelMatch
sheet OfficeOpenXml.ExcelWorksheet
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;
        }

Usage Example

Ejemplo n.º 1
0
        public void LesInn(byte[] excelBytes)
        {
            using (var stream = new MemoryStream(excelBytes))
            {
                stream.Position = 0;
                using (ExcelPackage excelFile = new ExcelPackage(stream))
                {
                    var excel = excelFile.Workbook;

                    var excelMatch = new MatchImport.ExcelMatch();

                    Les(excel, "Match", x => excelMatch = _matchImport.Les(x));
                    Les(excel, "Poster", x => _postImport.Les(x, excelMatch));
                    Les(excel, "Lag", x => _lagImport.Les(x, excelMatch));
                    Les(excel, "Deltakere", x => _deltakerImport.Les(x, excelMatch));
                }
            }
        }