Added new notification nuget. Added auto regenerate JWT token on error.
This commit is contained in:
@@ -9,6 +9,7 @@ using System.Xml.Linq;
|
||||
using BodyshopPartner.Utils.Growls;
|
||||
using Interop.QBFC13;
|
||||
using Interop.QBXMLRP2;
|
||||
using ToastNotifications.Messages;
|
||||
|
||||
namespace BodyshopPartner.Utils
|
||||
{
|
||||
@@ -26,7 +27,7 @@ namespace BodyshopPartner.Utils
|
||||
|
||||
public static void ConnectToQuickBooks()
|
||||
{
|
||||
if(String.IsNullOrWhiteSpace(Properties.Settings.Default.QuickBooksFilePath) || !File.Exists(Properties.Settings.Default.QuickBooksFilePath))
|
||||
if (String.IsNullOrWhiteSpace(Properties.Settings.Default.QuickBooksFilePath) || !File.Exists(Properties.Settings.Default.QuickBooksFilePath))
|
||||
{
|
||||
throw new Exception("The QuickBooks file specified does not exist.");
|
||||
}
|
||||
@@ -35,12 +36,15 @@ namespace BodyshopPartner.Utils
|
||||
logger.Debug("Attempting to connect to QuickBooks...");
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Growler.AddNotification(new Notification()
|
||||
{
|
||||
Id = new Random().Next(),
|
||||
Title = Properties.Resources.Msg_QbConnection_Title,
|
||||
Message = Properties.Resources.Msg_QbConnection_Msg
|
||||
});
|
||||
string msg = Properties.Resources.Msg_QbConnection_Title + " " + Properties.Resources.Msg_QbConnection_Msg;
|
||||
|
||||
Notifications.notifier.ShowInformation(msg);
|
||||
//Growler.AddNotification(new Notification()
|
||||
//{
|
||||
// Id = new Random().Next(),
|
||||
// Title = Properties.Resources.Msg_QbConnection_Title,
|
||||
// Message = Properties.Resources.Msg_QbConnection_Msg
|
||||
//});
|
||||
});
|
||||
|
||||
rp = new RequestProcessor2Class();
|
||||
@@ -52,18 +56,21 @@ namespace BodyshopPartner.Utils
|
||||
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Growler.AddNotification(new Notification()
|
||||
{
|
||||
Id = new Random().Next(),
|
||||
Title = Properties.Resources.Msg_QbConnected_Title,
|
||||
Message = Properties.Resources.Msg_QbConnected_Msg
|
||||
});
|
||||
string msg = Properties.Resources.Msg_QbConnected_Title + " " + Properties.Resources.Msg_QbConnected_Msg;
|
||||
|
||||
Notifications.notifier.ShowInformation(msg);
|
||||
//Growler.AddNotification(new Notification()
|
||||
//{
|
||||
// Id = new Random().Next(),
|
||||
// Title = Properties.Resources.Msg_QbConnected_Title,
|
||||
// Message = Properties.Resources.Msg_QbConnected_Msg
|
||||
//});
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex);
|
||||
if(ex.Message.Contains("80040154 Class not registered"))
|
||||
if (ex.Message.Contains("80040154 Class not registered"))
|
||||
{
|
||||
logger.Error("QuickBooks Request Processor not registered. Is QuickBooks installed on this computer?");
|
||||
throw new Exception("QuickBooks Request Processor not registered. Is QuickBooks installed on this computer?");
|
||||
@@ -83,12 +90,16 @@ namespace BodyshopPartner.Utils
|
||||
rp.CloseConnection();
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Growler.AddNotification(new Notification()
|
||||
{
|
||||
Id = new Random().Next(),
|
||||
Title = Properties.Resources.Msg_QbDisconnection_Title,
|
||||
Message = Properties.Resources.Msg_QbDisconnection_Msg
|
||||
});
|
||||
string msg = Properties.Resources.Msg_QbDisconnection_Title + " " + Properties.Resources.Msg_QbDisconnection_Msg;
|
||||
|
||||
Notifications.notifier.ShowSuccess(msg);
|
||||
|
||||
//Growler.AddNotification(new Notification()
|
||||
//{
|
||||
// Id = new Random().Next(),
|
||||
// Title = Properties.Resources.Msg_QbDisconnection_Title,
|
||||
// Message = Properties.Resources.Msg_QbDisconnection_Msg
|
||||
//});
|
||||
});
|
||||
logger.Debug("Disconnected from QuickBooks successfully.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user