What is the best way to integrate with quickbooks from C# code? [closed]

女生的网名这么多〃 提交于 2019-12-18 13:20:15

问题


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?


回答1:


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.




回答2:


I have decided to go with another product not mentioned above called "QuickBooks ADO.NET Data Provider" it is apparently made by the same folks who make the QuickBooks integrator product

The reasons I chose it...

1) It has a remote access component
You install the remote server, and you can access your QuickBooks data from anywhere on your network

2) The remote access component can run as a service
Nuff said

3) Provides a SQL style interface to the QuickBooks data
4) Does some auto magic caching to speed up the data access




回答3:


I used the QuickBooks integrator from nSoftware on a project that I was on. It is way easier than using the QuickBooks SDK and the support is great. That product has been around for around 8 years.

http://www.nsoftware.com/ibiz/quickbooks/




回答4:


While I am sure there are some cases in which it will not work, my first direction of attack would be the Quickbooks SDK found at the Intuit developer center.



来源:https://stackoverflow.com/questions/7083744/what-is-the-best-way-to-integrate-with-quickbooks-from-c-sharp-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!