from my research it looks like there are basically 3 options.
1: Using COM
2: Using A Webservice and the web connector
3: Using a 3rd party component (and there appears to be quite a few)
Each of these options present a problem for me:
1: I was told I cant use COM
2: This solution seems very hokey to me since I am needing to integrate from a windows service
3: Some of these solutions are rather expensive.
I looks like I am going to have to go the 3rd party route and there are two front runners in my mind:
1: QODBC (http://www.qodbc.com/usa.html)
2: AccessBooks (http://www.synergration.com/AccessBooksUpdater/default.aspx)
My questions, dear reader, are as follows:
1: Which solution (com, web service, which 3rd party) would you use?
2: Why would you choose it over the other options?
3: Is there some other option that I have missed?
I used the Quickbooks SDK because I was developing a import tool for a friend and we didn't have the luxury of buying a 3rd party library.
I started developing it as a web service, but I had to fall back after realizing that, not only does we need to deploy the redistribuable of the Quickbooks SDK on the server, but we also needed Quickbooks itself to be installed. And more often than never, Quickbooks displayed a dialog, which on a server is bad.
As long as that dialog was open, Quickbooks SDK would refuse any connection to it.
I ended up doing it as a pure C# Winform application. From there, its rather strait-forward.
At the heart of the program was a quickbook session class that handled the session and the message
public static class Quickbooks
{
public static QuickbookSession CreateSession()
{
return new QuickbookSession();
}
}
public class QuickbookSession : IDisposable
{
/// <summary>
/// Initializes a new instance of the <see cref="QuickbookSession"/> class.
/// </summary>
internal QuickbookSession()
{
this.SessionManager = new QBSessionManager();
this.SessionManager.OpenConnection2(
ConfigurationManager.AppSettings["QuickbooksApplicationId"],
ConfigurationManager.AppSettings["QuickbooksApplicationName"],
Utils.GetEnumValue<ENConnectionType>(ConfigurationManager.AppSettings["QuickbooksConnectionType"]));
var file = Quickbook.QuickbookDatabaseFilePath;
if (string.IsNullOrEmpty(file))
{
file = ConfigurationManager.AppSettings["QuickbooksDatabaseLocalPath"];
}
this.SessionManager.BeginSession(file, Utils.GetEnumValue<ENOpenMode>(ConfigurationManager.AppSettings["QuickbooksSessionOpenMode"]));
}
/// <summary>
/// Gets the Quickbook session manager that is owning this message.
/// </summary>
public QBSessionManager SessionManager { get; private set; }
public QuickbookMessage CreateMessage()
{
return new QuickbookMessage(this.SessionManager);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
// get rid of managed resources
}
this.SessionManager.EndSession();
this.SessionManager.CloseConnection();
System.Runtime.InteropServices.Marshal.ReleaseComObject(this.SessionManager);
}
}
After that, it was simple a matter of creating a session, creating a message and appending the different query.
using(var session = Quickbooks.CreateSession())
{
// Check if the job already exist
using (var message = session.CreateMessage())
{
var jobQuery = message.AppendCustomerQueryRq();
jobQuery.ORCustomerListQuery.CustomerListFilter.ORNameFilter.NameFilter.Name.SetValue("something");
jobQuery.ORCustomerListQuery.CustomerListFilter.ORNameFilter.NameFilter.MatchCriterion.SetValue(ENMatchCriterion.mcContains);
var result = message.Send();
// do stuff here with the result
}
}
This code is far from being bullet proof from the many pitfall of Quickbooks. The Quickbooks SDK is also rather slow. For example, retrieving the list of supplier takes about 2 minutes for about 1000 suppliers.