【发布时间】:2013-02-07 22:26:38
【问题描述】:
我有一个 asp.net 应用程序,我想将它连接到 quickbooks 桌面版,在 Web 应用程序中我想执行以下操作: 1- 从快速手册中获取客户列表。 2- 创建新发票并保存发送到 quickbooks。
这是我找到的示例代码,但我想知道我必须在 (sessionManager.BeginSession("", ENOpenMode.omDontCare);) 中的 AppId 参数中设置的值是什么。
private void getCustomers()
{
bool sessionBegun = false;
bool connectionOpen = false;
QBSessionManager sessionManager = null;
try
{
//Create the session Manager object
sessionManager = new QBSessionManager();
//Create the message set request object to hold our request
IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US", 8, 0);
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
//Connect to QuickBooks and begin a session
sessionManager.OpenConnection(@"D:\A to Z Wholesale Inc.QBW", "QuickBooks Integration Demo");
connectionOpen = true;
sessionManager.BeginSession("", ENOpenMode.omDontCare);
sessionBegun = true;
ICustomerAdd customerAddRq = requestMsgSet.AppendCustomerAddRq();
customerAddRq.Name.SetValue("Amer");
ICustomerQuery customer = requestMsgSet.AppendCustomerQueryRq();
//Send the request and get the response from QuickBooks
IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
IResponse response = responseMsgSet.ResponseList.GetAt(0);
ICustomerRet customerRet = (ICustomerRet)response.Detail;
}
catch (Exception ex)
{
}
finally
{
//End the session and close the connection to QuickBooks
if (sessionBegun)
{
sessionManager.EndSession();
}
if (connectionOpen)
{
sessionManager.CloseConnection();
}
}
}
【问题讨论】:
标签: c# desktop quickbooks