Added QB dependencies + simple http server.
This commit is contained in:
@@ -80,6 +80,16 @@
|
||||
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.QBFC13, Version=13.0.0.23, Culture=neutral, PublicKeyToken=31d8aec643e18259">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
<HintPath>..\..\..\Program Files (x86)\Common Files\Intuit\QuickBooks\Interop.QBFC13.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.QBXMLRP2, Version=13.0.0.23, Culture=neutral, PublicKeyToken=31d8aec643e18259">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
<HintPath>..\..\..\Program Files (x86)\Common Files\Intuit\QuickBooks\Interop.QBXMLRP2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MaterialDesignColors, Version=1.2.2.920, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MaterialDesignColors.1.2.2\lib\net45\MaterialDesignColors.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -91,6 +101,9 @@
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MimeTypesMap, Version=1.0.2.0, Culture=neutral, PublicKeyToken=1b320cc08ad5aa89, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MimeTypesMap.1.0.2\lib\net45\MimeTypesMap.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Cecil, Version=0.9.6.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Mono.Cecil.0.9.6.1\lib\net45\Mono.Cecil.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -118,6 +131,9 @@
|
||||
<Reference Include="SharpCompress, Version=0.17.1.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpCompress.0.17.1\lib\net45\SharpCompress.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SimpleHTTP, Version=1.0.6.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Simple-HTTP.1.0.6\lib\net47\SimpleHTTP.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Splat, Version=1.6.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Splat.1.6.2\lib\Net45\Splat.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -313,12 +329,14 @@
|
||||
<DependentUpon>GrowlNotification.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utils\Growls\Notification.cs" />
|
||||
<Compile Include="Utils\HTTPServer.cs" />
|
||||
<Compile Include="Utils\JobProcessingQueue.cs" />
|
||||
<Compile Include="Utils\JsonConverter.cs" />
|
||||
<Compile Include="Utils\JsonExtensions.cs" />
|
||||
<Compile Include="Utils\LoginHelpers.cs" />
|
||||
<Compile Include="Utils\Queries\JobsQueries.cs" />
|
||||
<Compile Include="Utils\Queries\VehicleQueries.cs" />
|
||||
<Compile Include="Utils\QuickBooksInterop.cs" />
|
||||
<Compile Include="Utils\RelayCommand.cs" />
|
||||
<Compile Include="Utils\TrayIcon.cs" />
|
||||
<Compile Include="Utils\UiConverters.cs" />
|
||||
@@ -395,7 +413,17 @@
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<COMReference Include="QBFC13Lib">
|
||||
<Guid>{0CB030A6-7B72-42CE-B92A-849B4A4A2CFB}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
|
||||
<Visible>False</Visible>
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace BodyshopPartner.Utils
|
||||
var graphQLResponse = await g.PostAsync(r);
|
||||
if (graphQLResponse.Errors == null)
|
||||
{
|
||||
logger.Trace("GQL Response: {0}", graphQLResponse.Data);
|
||||
//logger.Trace("GQL Response: {0}", graphQLResponse.Data);
|
||||
return graphQLResponse.Data;
|
||||
}
|
||||
else
|
||||
|
||||
38
BodyshopUploader/Utils/HTTPServer.cs
Normal file
38
BodyshopUploader/Utils/HTTPServer.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SimpleHttp;
|
||||
|
||||
namespace BodyshopPartner.Utils
|
||||
{
|
||||
public static class HTTPServer
|
||||
{
|
||||
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
public static void InitHttpServer()
|
||||
{
|
||||
Route.Add("/qb/receivables", (req, res, props) =>
|
||||
{
|
||||
res.WithCORS();
|
||||
//res.AddHeader("Access-Control-Allow-Origin", "http://localhost:3000 https://localhost:3000 http://localhost:5000 https://localhost:5000 https://*.imex.online,imex.online");
|
||||
res.Close() ;
|
||||
}, "OPTIONS");
|
||||
|
||||
Route.Add("/qb/receivables", (req, res, props) =>
|
||||
{
|
||||
Console.WriteLine("Got a hit.");
|
||||
//res.WithCORS();
|
||||
Utils.QuickBooksInterop.connectToQuickBooks();
|
||||
|
||||
res.WithCORS().AsText("Hello.");
|
||||
}, "POST");
|
||||
|
||||
logger.Trace("Starting HTTP server...");
|
||||
|
||||
//TODO As a part of the installer, add netsh http add urlacl url=http://+:1337/ user="Everyone
|
||||
HttpServer.ListenAsync(1337, System.Threading.CancellationToken.None, Route.OnHttpRequestAsync).Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
31
BodyshopUploader/Utils/QuickBooksInterop.cs
Normal file
31
BodyshopUploader/Utils/QuickBooksInterop.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Interop.QBFC13;
|
||||
using Interop.QBXMLRP2;
|
||||
|
||||
namespace BodyshopPartner.Utils
|
||||
{
|
||||
public static class QuickBooksInterop
|
||||
{
|
||||
private static string ticket;
|
||||
private static RequestProcessor2 rp;
|
||||
private static string maxVersion;
|
||||
private static string companyFile = "";
|
||||
private static QBFileMode mode = QBFileMode.qbFileOpenDoNotCare;
|
||||
private static string appID = "IDN123";
|
||||
private static string appName = "BodyshopPartner";
|
||||
|
||||
public static void connectToQuickBooks()
|
||||
{
|
||||
|
||||
rp = new RequestProcessor2Class();
|
||||
rp.OpenConnection(appID, appName);
|
||||
ticket = rp.BeginSession(companyFile, mode);
|
||||
string[] versions = rp.get_QBXMLVersionsForSession(ticket);
|
||||
maxVersion = versions[versions.Length - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,8 @@ namespace BodyshopPartner.ViewModels
|
||||
|
||||
_callingThread.ReportProgress(80);
|
||||
|
||||
Utils.HTTPServer.InitHttpServer();
|
||||
|
||||
logger.Debug("VM Init Complete");
|
||||
_callingThread.ReportProgress(100);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net472" />
|
||||
<package id="Microsoft.NETCore.Platforms" version="3.1.0" targetFramework="net472" />
|
||||
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net472" />
|
||||
<package id="MimeTypesMap" version="1.0.2" targetFramework="net472" />
|
||||
<package id="Mono.Cecil" version="0.9.6.1" targetFramework="net472" />
|
||||
<package id="NETStandard.Library" version="2.0.3" targetFramework="net472" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
|
||||
@@ -19,6 +20,7 @@
|
||||
<package id="NLog.Schema" version="4.6.8" targetFramework="net472" />
|
||||
<package id="Ookii.Dialogs" version="1.0" targetFramework="net472" />
|
||||
<package id="SharpCompress" version="0.17.1" targetFramework="net472" />
|
||||
<package id="Simple-HTTP" version="1.0.6" targetFramework="net472" />
|
||||
<package id="Splat" version="1.6.2" targetFramework="net472" />
|
||||
<package id="squirrel.windows" version="1.9.1" targetFramework="net472" />
|
||||
<package id="System.AppContext" version="4.3.0" targetFramework="net472" />
|
||||
|
||||
Reference in New Issue
Block a user