private bool ValidateCell(ExcelData <TColumnName> excelData, int i) { if (string.IsNullOrWhiteSpace(excelData.GetColumnValues(column)[i]) || excelData.GetColumnValues(column)[i].Equals("ERROR", StringComparison.InvariantCultureIgnoreCase)) { return(false); } return(true); }
protected override int Parse(ExcelData <TColumnName> excelData, int i) { string data = excelData.GetColumnValues(column)[i]; var manufacturer = _repository.Manufacturers.FirstOrDefault(x => string.Equals(x.Name, data, StringComparison.OrdinalIgnoreCase)); return(manufacturer?.Id ?? 0); }
protected override decimal?Parse(ExcelData <TColumnName> excelData, int i) { string data = excelData.GetColumnValues(column)[i]; decimal value; if (!decimal.TryParse(data, out value) || value < 0) { return(null); } return(value); }
protected override bool?Parse(ExcelData <TColumnName> excelData, int i) { string data = excelData.GetColumnValues(column)[i]; bool value; if (!bool.TryParse(data, out value)) { return(null); } return(value); }
protected override string Parse(ExcelData <TColumnName> excelData, int i) { return(excelData.GetColumnValues(column)[i]); }