- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我想插入多个客户对象我点击了这个链接https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0100_ipp_.net_devkit/0300_asynchronous_calls/2_batch_process但出现以下错误 - “您一次只能添加或编辑一个名称。请重试。”
发布我的代码:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.Web;
using Intuit.Ipp.Core;
using Intuit.Ipp.Security;
using Intuit.Ipp.Services;
using HelloIntuitAnywhere.Utilities;
using Intuit.Ipp.Data.Qbo;
using Intuit.Ipp.Data.Extensions;
using System.Linq;
using System.IO;
using Intuit.Ipp.Data;
namespace HelloIntuitAnywhere
{
public partial class BatchRequest : System.Web.UI.Page
{
public delegate IntuitBatchResponse DelegateBatchCompleted(IntuitBatchRequest batchRequest);
protected void Page_Load(object sender, EventArgs e)
{
if (HttpContext.Current.Session.Keys.Count > 0)
{
String realmId = HttpContext.Current.Session["realm"].ToString();
String accessToken = HttpContext.Current.Session["accessToken"].ToString();
String accessTokenSecret = HttpContext.Current.Session["accessTokenSecret"].ToString();
String consumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(CultureInfo.InvariantCulture);
String consumerSecret = ConfigurationManager.AppSettings["consumerSecret"].ToString(CultureInfo.InvariantCulture);
IntuitServicesType intuitServiceType = (IntuitServicesType)HttpContext.Current.Session["intuitServiceType"];
OAuthRequestValidator oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey, consumerSecret);
ServiceContext context = new ServiceContext(oauthValidator, realmId, intuitServiceType);
DataServices commonService = new DataServices(context);
try
{
switch (intuitServiceType)
{
case IntuitServicesType.QBO:
IntuitBatchRequest batchRequest = new IntuitBatchRequest();
batchRequest.BatchItem = new BatchItemRequest[10];
for (int i = 0; i < 10; i++)
{
Item itm1 = CreateItem("it8" + i.ToString());
string guid = Guid.NewGuid().ToString("N");
guid = guid.Substring(0, 30);
guid = i.ToString();
BatchItemRequest itm1BatchItem = new BatchItemRequest();
itm1BatchItem.bId = guid;
itm1BatchItem.Item = itm1;
itm1BatchItem.operation = OperationEnum.create;
itm1BatchItem.operationSpecified = true;
batchRequest.BatchItem[i] = itm1BatchItem;
}
//IntuitBatchResponse batchResponse = commonService.ExecuteBatch<IntuitBatchRequest>(batchRequest);
try
{
DelegateBatchCompleted delegateBatch = new DelegateBatchCompleted(commonService.ExecuteBatch<IntuitBatchRequest>);
IAsyncResult result = delegateBatch.BeginInvoke(batchRequest, new AsyncCallback(CallbackMethod), delegateBatch);
}
catch (Exception ex)
{
throw ex;
}
break;
default:
throw new Exception("Data Source not defined.");
}
}
catch
{
throw;
}
}
}
private Intuit.Ipp.Data.Qbo.Item CreateItem(string str)
{
Intuit.Ipp.Data.Qbo.Item item = new Intuit.Ipp.Data.Qbo.Item();
item.Desc = str + "Test Desc";
item.Name = str + "Test Name";
item.Taxable = true;
item.TaxableSpecified = true;
item.ExternalKey = new Intuit.Ipp.Data.Qbo.IdType() { idDomain = Intuit.Ipp.Data.Qbo.idDomainEnum.QBO, Value = str + "123" };
item.UnitPrice = new Intuit.Ipp.Data.Qbo.Money() { Amount = 6, AmountSpecified = true, CurrencyCode = Intuit.Ipp.Data.Qbo.currencyCode.AED, CurrencyCodeSpecified = false };
item.IncomeAccountRef = new Intuit.Ipp.Data.Qbo.AccountRef() { AccountId = new Intuit.Ipp.Data.Qbo.IdType() { idDomain = Intuit.Ipp.Data.Qbo.idDomainEnum.QBO, Value = "1" }, AccountType = Intuit.Ipp.Data.Qbo.AccountTypeEnum.Asset, AccountTypeSpecified = true };
item.Type = Intuit.Ipp.Data.Qbo.ItemTypeEnum.Assembly;
return item;
}
static void CallbackMethod(IAsyncResult result)
{
DelegateBatchCompleted delegateBatch = (DelegateBatchCompleted)result.AsyncState;
IntuitBatchResponse batchResponse = delegateBatch.EndInvoke(result);
}
}
}
最佳答案
错误信息很清楚:Quickbooks API 一次只允许编辑一个客户。
他们可能会锁定 Customer 表,因为业务层或底层数据模型都不支持并发编辑。
鉴于此限制,我看不到解决此问题的方法。
它们允许您异步调用同步方法,因此您不必阻塞直到方法完成,但这并不意味着您可以同时进行两个客户编辑。但是,您可以在编辑完成时做其他工作。
关于c# - QBO SDK C# - 异步批处理创建多个客户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17229636/
我想插入多个客户对象我点击了这个链接https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits/0100_ipp_.net_de
我正在使用 ASP.NET Web 应用程序将发票在线导出到 QuickBooks。 它在美国 QBO 上运行良好。然后,如果它在加拿大,则必须将 TaxCodeRef 添加到行项目中,否则它将引发业
我正在使用 C# SDK 在 QBO 中创建估算。我收到有关未包含 LineDetail 类型的错误。这是我们发布的 JSON: {"CustomerRef":{"value":"137"}, "Cu
我在 .NET SDK 的限制方面遇到了一些问题,因此我想发出我自己的 API 调用并解析 JSON 结果。我坚持按照概述创建授权 header 参数 oauth_signature here . 对
我有一个关于 quickbooks 发票的新问题。创建发票后,我在发票中获得了我添加的所有项目以及一个额外的项目。 如何过滤、删除、阻止此行出现? 这是我尝试过的。 //Find Item var i
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 6 个月前
如何使用 C# 中的 QuickBooks Online API v3 对现有发票应用付款? 我试过下面的代码: private void UpdateInvoice(Payment paym
本题涉及Intuit的QBO v3 API . 我有一个可以访问多家公司的用户 ID。附属公司等。当我尝试连接到我查询的第一个公司以外的公司时,我遇到了身份验证错误。这是因为每个 OAuth 连接只能
我正在尝试为要导入到 QuickBooks Online (QBO) 公司文件的发票的发票行项目指定产品/服务列表项,但出现错误。 我收到的错误是: Intuit.Ipp.Exception.IdsE
我正在尝试编写一个应用程序,该应用程序将通过 java spring 引擎连接到 Quickbooks Online API,提取一些数据并进行转换,然后通过电子邮件将其发送到某个地方。 我已经完成了
我想将 QBO 和 QBD 集成到我正在开发的 Rails 3.2 应用程序中。请帮助我如何在我的网络应用程序中集成 QBO 和 QBD API。我试过http://developer.intuit.
我正在尝试使用 IPP 查询所有具有未清余额的发票,但我一直返回 0 个结果。我在代码中做错了什么吗? 这是我尝试使用应用的过滤进行的 C# 代码片段 InvoiceQuery qbo
我正在使用 Intuit QBO SDK v3 Intuit.Ipp.QueryFilter.QueryService(Of Bill) 来获取由 Bill.Id 过滤的账单集合。集合已成功填充。我只
我有一个 .aspx 页面来显示 BlueDot 或 ConnectToQuickBooks 按钮。 从 IE 页面收集的结果 HTML 如下所示: TrueCommerce
我是一名优秀的程序员,十分优秀!