当前位置: 首页>>代码示例>>C#>>正文


C# Invoice.CloseQBConnection方法代码示例

本文整理汇总了C#中Invoice.CloseQBConnection方法的典型用法代码示例。如果您正苦于以下问题:C# Invoice.CloseQBConnection方法的具体用法?C# Invoice.CloseQBConnection怎么用?C# Invoice.CloseQBConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Invoice的用法示例。


在下文中一共展示了Invoice.CloseQBConnection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Task_ImportPayments


//.........这里部分代码省略.........
                     oQuery.QBXMLVersion = "5.0";
                     oQuery.QueryType = ObjsearchQueryTypes.qtInvoiceSearch;
                     oQuery.SearchCriteria = new SearchCriteria();
                     oQuery.SearchCriteria.RefNumber = oPaymentLineItem.InvoiceID;
                     oQuery.IterateResults = true;
                     oQuery.MaxResults = 0;
                     oQuery.Search();

                     if (oQuery.Results.Count > 0)
                     {
                        oInvoice.Get(oQuery.Results[0].ResultId);

                        AppliedTo oAppliedTo = new AppliedTo();
                        oAppliedTo.RefId = oQuery.Results[0].ResultId;
                        oAppliedTo.PaymentAmount = oPaymentLineItem.Amount.ToString("0.00");

                        oReceivePayment.AppliedTo.Add(oAppliedTo);

                        fTotal += oPaymentLineItem.Amount;
                        sInvoices += string.Format("{0}, ", oPaymentLineItem.InvoiceID);
                     }
                  }
                  try
                  {
                     oReceivePayment.AutoApply = ReceivepaymentAutoApplies.aaCustom;
                     oReceivePayment.CustomerName = oInvoice.CustomerName;
                     oReceivePayment.Amount = fTotal.ToString();
                     oReceivePayment.TransactionDate = oPayment.CreatedDateTime.ToString("d");

                     if (oPayment.CreditCardFirstName != string.Empty)
                     {
                        oReceivePayment.RefNumber = string.Format("{0} {1}", oPayment.CreditCardFirstName, oPayment.CreditCardLastName);
                     }

                     if (oPayment.CreditCardType == "Visa")
                     {
                        oReceivePayment.PaymentMethodName = "Visa";
                     }
                     else if (oPayment.CreditCardType == "MasterCard")
                     {
                        oReceivePayment.PaymentMethodName = "Mastercard";
                     }
                     else if (oPayment.CreditCardType == "American Express")
                     {
                        oReceivePayment.PaymentMethodName = "American Express";
                     }
                     else if (oPayment.CreditCardType == "Discover")
                     {
                        oReceivePayment.PaymentMethodName = "Discover";
                     }

                     // Remove last ', '
                     if (sInvoices.Length > 2)
                     {
                        sInvoices = sInvoices.Substring(0, sInvoices.Length - 2);
                     }

                     oReceivePayment.Memo = string.Format("Payment for invoice {0} - AuthID: {1}", sInvoices, oPayment.AuthorizeNetID);

                     oReceivePayment.Add();
                     successCount++;
                  }
                  catch (Exception e)
                  {
                     errorCount++;
                     MessageBox.Show(e.Message + System.Environment.NewLine + System.Environment.NewLine + e.StackTrace);
                  }

                  this.UpdateProgress();

                  if (m_oWorkerProcess.CancellationPending)
                  {
                     break;
                  }
               }

               if (successCount > 0 || errorCount > 0)
               {
                  MessageBox.Show("Finished Payment Import" + Environment.NewLine + "Success: " + successCount + Environment.NewLine + "Error: " + errorCount);
               }
            }
            else
            {
               MessageBox.Show(oPaymentResult.ErrorMessage, "API/Service Error");
            }

            m_oWorkerProcess.ReportProgress(100);
             }
             catch (Exception e)
             {
            MessageBox.Show(e.Message + System.Environment.NewLine + System.Environment.NewLine + e.StackTrace);
             }
             finally
             {
            oQuery.CloseQBConnection();
            oInvoice.CloseQBConnection();
            oCustomer.CloseQBConnection();
            oReceivePayment.CloseQBConnection();
             }
        }
开发者ID:psychotiic,项目名称:speedyspots,代码行数:101,代码来源:Main.cs


注:本文中的Invoice.CloseQBConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。