Esempio n. 1
0
 public DType Accept(TFint type, string x)
 {
     if (int.TryParse(x, out var b))
     {
         return(DFint.ValueOf(b));
     }
     else
     {
         throw new Exception($"{x} 不是int类型");
     }
 }
        public DType Accept(TFint type, ExcelStream x)
        {
            var d = x.Read();

            if (CheckNull(type.IsNullable, d))
            {
                return(null);
            }
            var ds = d.ToString();

            //if (field?.Remapper is TEnum te)
            //{
            //    if (te.DefineEnum.TryValueByNameOrAlias(ds, out var c))
            //    {
            //        return new DFint(c);
            //    }
            //}
            if (!int.TryParse(ds, out var v))
            {
                throw new InvalidExcelDataException($"{d} 不是 int 类型值");
            }
            return(DFint.ValueOf(v));
        }
Esempio n. 3
0
 public DType Accept(TFint type, XElement x, DefAssembly ass)
 {
     return(DFint.ValueOf(int.Parse(x.Value.Trim())));
 }
 public DType Accept(TFint type, object x, DefAssembly ass)
 {
     return(DFint.ValueOf((int)x));
 }
Esempio n. 5
0
 public DType Accept(TFint type, JsonElement x, DefAssembly ass)
 {
     return(DFint.ValueOf(x.GetInt32()));
 }