瀏覽代碼

Merge remote-tracking branch 'origin/kenric' into frank

frankvandenbos 2 月之前
父節點
當前提交
c286e6ec73

+ 12 - 0
InABox.Core/DigitalForms/Layouts/Fields/DFLayoutDoubleField/DFLayoutDoubleFieldProperties.cs

@@ -1,4 +1,5 @@
 using Newtonsoft.Json.Linq;
+using System;
 
 namespace InABox.Core
 {
@@ -39,6 +40,17 @@ namespace InABox.Core
             var value = entry.GetValue();
             if (value is double d)
                 return d;
+            if (value != null && value.GetType().IsNumeric())
+            {
+                try
+                {
+                    return Convert.ToDouble(value);
+                }
+                catch (Exception)
+                {
+                    return null;
+                }
+            }
             if (double.TryParse(value as string, out var result))
                 return result;
             return null;