From c23de44dc68c70fcce0871a7792ffc96304eea48 Mon Sep 17 00:00:00 2001 From: Amazos Date: Sun, 4 Jul 2021 21:30:32 +0400 Subject: [PATCH] fixed type of the field ExtFieldCustomData --- .../Examples/Orders/AddScheduledOrder.vb | 8 ++--- Route4MeSDKLibrary/DataTypes/Order.vb | 30 +++++++++++-------- .../Route4MeManagerUnitTest..vb | 6 +--- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Route4Me Route Optimization Examples/Examples/Orders/AddScheduledOrder.vb b/Route4Me Route Optimization Examples/Examples/Orders/AddScheduledOrder.vb index b1ba970..b5973eb 100644 --- a/Route4Me Route Optimization Examples/Examples/Orders/AddScheduledOrder.vb +++ b/Route4Me Route Optimization Examples/Examples/Orders/AddScheduledOrder.vb @@ -21,12 +21,10 @@ Namespace Route4MeSDKTest.Examples .EXT_FIELD_last_name = "Carol", .EXT_FIELD_email = "lcarol654@yahoo.com", .EXT_FIELD_phone = "897946541", - .EXT_FIELD_custom_data = (New List(Of Dictionary(Of String, String))() From { - New Dictionary(Of String, String)() From { + .EXT_FIELD_custom_data = New Dictionary(Of String, String)() From { {"order_type", "scheduled order"} - } - }).ToArray(), - .day_scheduled_for_YYMMDD = "2017-12-20", + }, + .day_scheduled_for_YYMMDD = DateTime.Now.ToString("yyyy-MM-dd"), .local_time_window_end = 39000, .local_time_window_end_2 = 46200, .local_time_window_start = 37800, diff --git a/Route4MeSDKLibrary/DataTypes/Order.vb b/Route4MeSDKLibrary/DataTypes/Order.vb index 7a8caf7..e193790 100644 --- a/Route4MeSDKLibrary/DataTypes/Order.vb +++ b/Route4MeSDKLibrary/DataTypes/Order.vb @@ -1,4 +1,5 @@ -Imports Route4MeSDKLibrary.Route4MeSDK.QueryTypes +Imports Newtonsoft.Json +Imports Route4MeSDKLibrary.Route4MeSDK.QueryTypes Imports System.Runtime.Serialization Namespace Route4MeSDK.DataTypes @@ -151,22 +152,27 @@ Namespace Route4MeSDK.DataTypes Public Property EXT_FIELD_phone As String ''' - ''' Custom data + ''' Not serialized - for prevention wrong data (e.g. Dictionary(Of String, String)()) ''' - - Public Property EXT_FIELD_custom_data() As Dictionary(Of String, String)() + + Public Property EXT_FIELD_custom_data As Dictionary(Of String, String) Get - Return _ext_field_custom_data + Return If( + EXT_FIELD_custom_data2 IsNot Nothing AndAlso EXT_FIELD_custom_data2.[GetType]() = GetType(Dictionary(Of String, String)), + CType(EXT_FIELD_custom_data2, Dictionary(Of String, String)), + Nothing + ) End Get - Set(ByVal value As Dictionary(Of String, String)()) - If value.[GetType]() = GetType(Dictionary(Of String, String)()) Then - _ext_field_custom_data = value - Else - _ext_field_custom_data = Nothing - End If + Set(ByVal value As Dictionary(Of String, String)) + EXT_FIELD_custom_data2 = value End Set End Property - Private _ext_field_custom_data As Dictionary(Of String, String)() + + ''' + ''' Custom data - serialized + ''' + + Private Property EXT_FIELD_custom_data2 As Object ''' ''' Local timezone string diff --git a/Route4meSDKLibraryUnitTests/Route4MeManagerUnitTest..vb b/Route4meSDKLibraryUnitTests/Route4MeManagerUnitTest..vb index b129cca..3f04d93 100644 --- a/Route4meSDKLibraryUnitTests/Route4MeManagerUnitTest..vb +++ b/Route4meSDKLibraryUnitTests/Route4MeManagerUnitTest..vb @@ -8955,11 +8955,7 @@ End Class .EXT_FIELD_last_name = "Carol", .EXT_FIELD_email = "lcarol654@yahoo.com", .EXT_FIELD_phone = "897946541", - .EXT_FIELD_custom_data = (New List(Of Dictionary(Of String, String))() From { - New Dictionary(Of String, String)() From { - {"order_type", "scheduled order"} - } - }).ToArray(), + .EXT_FIELD_custom_data = New Dictionary(Of String, String)() From {{"order_type", "scheduled order"}}, .day_scheduled_for_YYMMDD = "2017-12-20", .local_time_window_end = 39000, .local_time_window_end_2 = 46200,