This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Protected Sub OnError(uri As System.Uri, ex As System.Exception) | |
'Display thr formatted message | |
Select Case ex.GetType() | |
Case GetType(System.Net.WebException) | |
MessageBox.Show(FormatMessage(CType(ex, System.Net.WebException))) | |
Case GetType(MYOB.AccountRight.SDK.ApiCommunicationException) | |
MessageBox.Show(FormatMessage(CType(ex.InnerException, System.Net.WebException))) | |
Case GetType(MYOB.AccountRight.SDK.ApiOperationException) | |
MessageBox.Show(ex.Message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void OnError(Uri uri, Exception ex) | |
{ | |
//Display the formatted message | |
switch (ex.GetType().Name) | |
{ | |
case "WebException": | |
MessageBox.Show(FormatMessage((WebException) ex)); | |
break; | |
case "ApiCommunicationException": | |
MessageBox.Show(FormatMessage((WebException) ex.InnerException)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.IO | |
Imports Newtonsoft.Json | |
Imports Newtonsoft.Json.Converters | |
Imports System.Runtime.CompilerServices | |
Public Module JsonExtensions | |
<Extension()> | |
Public Function ToJson(ByVal entity As Object) As String | |
Dim serializer = New JsonSerializer() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.IO; | |
using Newtonsoft.Json; | |
using Newtonsoft.Json.Converters; | |
public static class JsonExtensions | |
{ | |
public static string ToJson(this object entity) | |
{ | |
var serializer = new JsonSerializer(); | |
serializer.Converters.Add(new StringEnumConverter()); |