Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
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);
        }
Example #4
0
        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);
        }
Example #5
0
 protected override string Parse(ExcelData <TColumnName> excelData, int i)
 {
     return(excelData.GetColumnValues(column)[i]);
 }