protected T ReadCellValue(ExcelWorksheet worksheet, string pos, [CallerMemberName] string name = null)
        {
            T ret;

            var value = worksheet.Cells[pos].Value;

            readExceptionRules = new ExceptionDecoration();
            readExceptionRules = new noNullreadException(readExceptionRules);
            readExceptionRules.checkWithValue(value, name);

            var type      = typeof(T);
            var converter = TypeDescriptor.GetConverter(type);

            ret = (T)converter.ConvertFromString(value.ToString());
            readExceptionRules = new noNegativereadException(readExceptionRules);
            readExceptionRules.checkWithValue(ret, name);
            return(ret);
        }
示例#2
0
 public noNegativereadException(IReadExceptionRules readExceptionRules)
 {
     this.readExceptionRule = readExceptionRules;
 }
示例#3
0
 public noNullreadException(IReadExceptionRules readExceptionRules)
 {
     this.readExceptionRule = readExceptionRules;
 }