File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
dotnet/src/dotnetframework/GxClasses/Helpers Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 3
3
using System . Linq ;
4
4
using System . Text ;
5
5
using System . Threading . Tasks ;
6
+
6
7
using GeneXus . Utils ;
7
8
using GeneXus . Http . Client ;
9
+
8
10
using System . Web ;
11
+
9
12
using GeneXus . Mime ;
13
+
14
+ using System . Globalization ;
15
+
10
16
#if NETCORE
11
17
using System . Text . Json ;
12
18
using System . Text . Json . Serialization ;
@@ -371,8 +377,21 @@ public Guid GetBodyGuid(string varName)
371
377
}
372
378
373
379
public Decimal GetBodyNum ( string varName )
374
- {
375
- return Decimal . Parse ( GetJsonStr ( varName ) , System . Globalization . NumberStyles . Float ) ;
380
+ {
381
+ try
382
+ {
383
+ return Decimal . Parse ( GetJsonStr ( varName ) , NumberStyles . Float , CultureInfo . InvariantCulture ) ;
384
+ }
385
+ catch ( FormatException )
386
+ {
387
+ Console . WriteLine ( "Failed to parse number due to format exception." ) ;
388
+ }
389
+ catch ( OverflowException )
390
+ {
391
+ Console . WriteLine ( "Failed to parse number due to overflow exception." ) ;
392
+ }
393
+ // Return a empty value in case of an exception
394
+ return 0m ;
376
395
}
377
396
public long GetBodyLong ( string varName )
378
397
{
You can’t perform that action at this time.
0 commit comments