using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace com.intuit.idn.samples
public void DoCustomerQuery()
bool sessionBegun = false;
bool connectionOpen = false;
QBSessionManager sessionManager = null;
sessionManager = new QBSessionManager();
IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US",16,0);
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
BuildCustomerQueryRq(requestMsgSet);
sessionManager.OpenConnection("","Sample Code from OSR");
sessionManager.BeginSession("", ENOpenMode.omDontCare);
IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
sessionManager.EndSession();
sessionManager.CloseConnection();
WalkCustomerQueryRs(responseMsgSet);
MessageBox.Show(e.Message, "Error");
sessionManager.EndSession();
sessionManager.CloseConnection();
void BuildCustomerQueryRq(IMsgSetRequest requestMsgSet)
ICustomerQuery CustomerQueryRq= requestMsgSet.AppendCustomerQueryRq();
CustomerQueryRq.metaData.SetValue("IQBENmetaDataType");
CustomerQueryRq.iterator.SetValue("IQBENiteratorType");
CustomerQueryRq.iteratorID.SetValue("IQBUUIDType");
string ORCustomerListQueryElementType7493 = "ListIDList";
if (ORCustomerListQueryElementType7493 == "ListIDList")
CustomerQueryRq.ORCustomerListQuery.ListIDList.Add("200000-1011023419");
if (ORCustomerListQueryElementType7493 == "FullNameList")
CustomerQueryRq.ORCustomerListQuery.FullNameList.Add("ab");
if (ORCustomerListQueryElementType7493 == "CustomerListFilter")
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.MaxReturned.SetValue(6);
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.ActiveStatus.SetValue(ENActiveStatus.asActiveOnly [DEFAULT]);
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.FromModifiedDate.SetValue(DateTime.Parse("12/15/2007 12:15:12"),false);
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.ToModifiedDate.SetValue(DateTime.Parse("12/15/2007 12:15:12"),false);
string ORNameFilterElementType7494 = "NameFilter";
if (ORNameFilterElementType7494 == "NameFilter")
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.ORNameFilter.NameFilter.MatchCriterion.SetValue(ENMatchCriterion.mcStartsWith);
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.ORNameFilter.NameFilter.Name.SetValue("ab");
if (ORNameFilterElementType7494 == "NameRangeFilter")
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.ORNameFilter.NameRangeFilter.FromName.SetValue("ab");
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.ORNameFilter.NameRangeFilter.ToName.SetValue("ab");
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.TotalBalanceFilter.Operator.SetValue(ENOperator.oLessThan);
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.TotalBalanceFilter.Amount.SetValue(10.01);
string ORCurrencyFilterElementType7495 = "ListIDList";
if (ORCurrencyFilterElementType7495 == "ListIDList")
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.CurrencyFilter.ORCurrencyFilter.ListIDList.Add("200000-1011023419");
if (ORCurrencyFilterElementType7495 == "FullNameList")
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.CurrencyFilter.ORCurrencyFilter.FullNameList.Add("ab");
string ORClassFilterElementType7496 = "ListIDList";
if (ORClassFilterElementType7496 == "ListIDList")
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.ClassFilter.ORClassFilter.ListIDList.Add("200000-1011023419");
if (ORClassFilterElementType7496 == "FullNameList")
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.ClassFilter.ORClassFilter.FullNameList.Add("ab");
if (ORClassFilterElementType7496 == "ListIDWithChildren")
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.ClassFilter.ORClassFilter.ListIDWithChildren.SetValue("200000-1011023419");
if (ORClassFilterElementType7496 == "FullNameWithChildren")
CustomerQueryRq.ORCustomerListQuery.CustomerListFilter.ClassFilter.ORClassFilter.FullNameWithChildren.SetValue("ab");
CustomerQueryRq.IncludeRetElementList.Add("ab");
CustomerQueryRq.OwnerIDList.Add(Guid.NewGuid().ToString());
void WalkCustomerQueryRs(IMsgSetResponse responseMsgSet)
if (responseMsgSet == null) return;
IResponseList responseList = responseMsgSet.ResponseList;
if (responseList == null) return;
for(int i=0; i < responseList.Count; i++)
IResponse response = responseList.GetAt(i);
if (response.StatusCode >= 0)
if (response.Detail != null)
ENResponseType responseType = (ENResponseType)response.Type.GetValue();
if (responseType == ENResponseType.rtCustomerQueryRs)
ICustomerRetList CustomerRet = (ICustomerRetList)response.Detail;
WalkCustomerRet(CustomerRet.GetAt(i));
void WalkCustomerRet(ICustomerRet CustomerRet)
if (CustomerRet == null) return;
string ListID7497 = (string)CustomerRet.ListID.GetValue();
DateTime TimeCreated7498 = (DateTime)CustomerRet.TimeCreated.GetValue();
DateTime TimeModified7499 = (DateTime)CustomerRet.TimeModified.GetValue();
string EditSequence7500 = (string)CustomerRet.EditSequence.GetValue();
string Name7501 = (string)CustomerRet.Name.GetValue();
string FullName7502 = (string)CustomerRet.FullName.GetValue();
if (CustomerRet.IsActive != null)
bool IsActive7503 = (bool)CustomerRet.IsActive.GetValue();
if (CustomerRet.ClassRef != null)
if (CustomerRet.ClassRef.ListID != null)
string ListID7504 = (string)CustomerRet.ClassRef.ListID.GetValue();
if (CustomerRet.ClassRef.FullName != null)
string FullName7505 = (string)CustomerRet.ClassRef.FullName.GetValue();
if (CustomerRet.ParentRef != null)
if (CustomerRet.ParentRef.ListID != null)
string ListID7506 = (string)CustomerRet.ParentRef.ListID.GetValue();
if (CustomerRet.ParentRef.FullName != null)
string FullName7507 = (string)CustomerRet.ParentRef.FullName.GetValue();
int Sublevel7508 = (int)CustomerRet.Sublevel.GetValue();
if (CustomerRet.CompanyName != null)
string CompanyName7509 = (string)CustomerRet.CompanyName.GetValue();
if (CustomerRet.Salutation != null)
string Salutation7510 = (string)CustomerRet.Salutation.GetValue();
if (CustomerRet.FirstName != null)
string FirstName7511 = (string)CustomerRet.FirstName.GetValue();
if (CustomerRet.MiddleName != null)
string MiddleName7512 = (string)CustomerRet.MiddleName.GetValue();
if (CustomerRet.LastName != null)
string LastName7513 = (string)CustomerRet.LastName.GetValue();
if (CustomerRet.JobTitle != null)
string JobTitle7514 = (string)CustomerRet.JobTitle.GetValue();
if (CustomerRet.BillAddress != null)
if (CustomerRet.BillAddress.Addr1 != null)
string Addr17515 = (string)CustomerRet.BillAddress.Addr1.GetValue();
if (CustomerRet.BillAddress.Addr2 != null)
string Addr27516 = (string)CustomerRet.BillAddress.Addr2.GetValue();
if (CustomerRet.BillAddress.Addr3 != null)
string Addr37517 = (string)CustomerRet.BillAddress.Addr3.GetValue();
if (CustomerRet.BillAddress.Addr4 != null)
string Addr47518 = (string)CustomerRet.BillAddress.Addr4.GetValue();
if (CustomerRet.BillAddress.Addr5 != null)
string Addr57519 = (string)CustomerRet.BillAddress.Addr5.GetValue();
if (CustomerRet.BillAddress.City != null)
string City7520 = (string)CustomerRet.BillAddress.City.GetValue();
if (CustomerRet.BillAddress.State != null)
string State7521 = (string)CustomerRet.BillAddress.State.GetValue();
if (CustomerRet.BillAddress.PostalCode != null)
string PostalCode7522 = (string)CustomerRet.BillAddress.PostalCode.GetValue();
if (CustomerRet.BillAddress.Country != null)
string Country7523 = (string)CustomerRet.BillAddress.Country.GetValue();
if (CustomerRet.BillAddress.Note != null)
string Note7524 = (string)CustomerRet.BillAddress.Note.GetValue();
if (CustomerRet.BillAddressBlock != null)
if (CustomerRet.BillAddressBlock.Addr1 != null)
string Addr17525 = (string)CustomerRet.BillAddressBlock.Addr1.GetValue();
if (CustomerRet.BillAddressBlock.Addr2 != null)
string Addr27526 = (string)CustomerRet.BillAddressBlock.Addr2.GetValue();
if (CustomerRet.BillAddressBlock.Addr3 != null)
string Addr37527 = (string)CustomerRet.BillAddressBlock.Addr3.GetValue();
if (CustomerRet.BillAddressBlock.Addr4 != null)
string Addr47528 = (string)CustomerRet.BillAddressBlock.Addr4.GetValue();
if (CustomerRet.BillAddressBlock.Addr5 != null)
string Addr57529 = (string)CustomerRet.BillAddressBlock.Addr5.GetValue();
if (CustomerRet.ShipAddress != null)
if (CustomerRet.ShipAddress.Addr1 != null)
string Addr17530 = (string)CustomerRet.ShipAddress.Addr1.GetValue();
if (CustomerRet.ShipAddress.Addr2 != null)
string Addr27531 = (string)CustomerRet.ShipAddress.Addr2.GetValue();
if (CustomerRet.ShipAddress.Addr3 != null)
string Addr37532 = (string)CustomerRet.ShipAddress.Addr3.GetValue();
if (CustomerRet.ShipAddress.Addr4 != null)
string Addr47533 = (string)CustomerRet.ShipAddress.Addr4.GetValue();
if (CustomerRet.ShipAddress.Addr5 != null)
string Addr57534 = (string)CustomerRet.ShipAddress.Addr5.GetValue();
if (CustomerRet.ShipAddress.City != null)
string City7535 = (string)CustomerRet.ShipAddress.City.GetValue();
if (CustomerRet.ShipAddress.State != null)
string State7536 = (string)CustomerRet.ShipAddress.State.GetValue();
if (CustomerRet.ShipAddress.PostalCode != null)
string PostalCode7537 = (string)CustomerRet.ShipAddress.PostalCode.GetValue();
if (CustomerRet.ShipAddress.Country != null)
string Country7538 = (string)CustomerRet.ShipAddress.Country.GetValue();
if (CustomerRet.ShipAddress.Note != null)
string Note7539 = (string)CustomerRet.ShipAddress.Note.GetValue();
if (CustomerRet.ShipAddressBlock != null)
if (CustomerRet.ShipAddressBlock.Addr1 != null)
string Addr17540 = (string)CustomerRet.ShipAddressBlock.Addr1.GetValue();
if (CustomerRet.ShipAddressBlock.Addr2 != null)
string Addr27541 = (string)CustomerRet.ShipAddressBlock.Addr2.GetValue();
if (CustomerRet.ShipAddressBlock.Addr3 != null)
string Addr37542 = (string)CustomerRet.ShipAddressBlock.Addr3.GetValue();
if (CustomerRet.ShipAddressBlock.Addr4 != null)
string Addr47543 = (string)CustomerRet.ShipAddressBlock.Addr4.GetValue();
if (CustomerRet.ShipAddressBlock.Addr5 != null)
string Addr57544 = (string)CustomerRet.ShipAddressBlock.Addr5.GetValue();
if (CustomerRet.ShipToAddressList != null)
for (int i7545 = 0; i7545 < CustomerRet.ShipToAddressList.Count; i7545++)
IShipToAddress ShipToAddress = CustomerRet.ShipToAddressList.GetAt(i7545);
string Name7546 = (string)ShipToAddress.Name.GetValue();
if (ShipToAddress.Addr1 != null)
string Addr17547 = (string)ShipToAddress.Addr1.GetValue();
if (ShipToAddress.Addr2 != null)
string Addr27548 = (string)ShipToAddress.Addr2.GetValue();
if (ShipToAddress.Addr3 != null)
string Addr37549 = (string)ShipToAddress.Addr3.GetValue();
if (ShipToAddress.Addr4 != null)
string Addr47550 = (string)ShipToAddress.Addr4.GetValue();
if (ShipToAddress.Addr5 != null)
string Addr57551 = (string)ShipToAddress.Addr5.GetValue();
if (ShipToAddress.City != null)
string City7552 = (string)ShipToAddress.City.GetValue();
if (ShipToAddress.State != null)
string State7553 = (string)ShipToAddress.State.GetValue();
if (ShipToAddress.PostalCode != null)
string PostalCode7554 = (string)ShipToAddress.PostalCode.GetValue();
if (ShipToAddress.Country != null)
string Country7555 = (string)ShipToAddress.Country.GetValue();
if (ShipToAddress.Note != null)
string Note7556 = (string)ShipToAddress.Note.GetValue();
if (ShipToAddress.DefaultShipTo != null)
bool DefaultShipTo7557 = (bool)ShipToAddress.DefaultShipTo.GetValue();
if (CustomerRet.Phone != null)
string Phone7558 = (string)CustomerRet.Phone.GetValue();
if (CustomerRet.AltPhone != null)
string AltPhone7559 = (string)CustomerRet.AltPhone.GetValue();
if (CustomerRet.Fax != null)
string Fax7560 = (string)CustomerRet.Fax.GetValue();
if (CustomerRet.Email != null)
string Email7561 = (string)CustomerRet.Email.GetValue();
if (CustomerRet.Cc != null)
string Cc7562 = (string)CustomerRet.Cc.GetValue();
if (CustomerRet.Contact != null)
string Contact7563 = (string)CustomerRet.Contact.GetValue();
if (CustomerRet.AltContact != null)
string AltContact7564 = (string)CustomerRet.AltContact.GetValue();
if (CustomerRet.AdditionalContactRefList != null)
for (int i7565 = 0; i7565 < CustomerRet.AdditionalContactRefList.Count; i7565++)
IQBBaseRef QBBaseRef = CustomerRet.AdditionalContactRefList.GetAt(i7565);
string ContactName7566 = (string)QBBaseRef.ContactName.GetValue();
string ContactValue7567 = (string)QBBaseRef.ContactValue.GetValue();
if (CustomerRet.ContactsRetList != null)
for (int i7568 = 0; i7568 < CustomerRet.ContactsRetList.Count; i7568++)
IContactsRet ContactsRet = CustomerRet.ContactsRetList.GetAt(i7568);
string ListID7569 = (string)ContactsRet.ListID.GetValue();
DateTime TimeCreated7570 = (DateTime)ContactsRet.TimeCreated.GetValue();
DateTime TimeModified7571 = (DateTime)ContactsRet.TimeModified.GetValue();
string EditSequence7572 = (string)ContactsRet.EditSequence.GetValue();
if (ContactsRet.Contact != null)
string Contact7573 = (string)ContactsRet.Contact.GetValue();
if (ContactsRet.Salutation != null)
string Salutation7574 = (string)ContactsRet.Salutation.GetValue();
string FirstName7575 = (string)ContactsRet.FirstName.GetValue();
if (ContactsRet.MiddleName != null)
string MiddleName7576 = (string)ContactsRet.MiddleName.GetValue();
if (ContactsRet.LastName != null)
string LastName7577 = (string)ContactsRet.LastName.GetValue();
if (ContactsRet.JobTitle != null)
string JobTitle7578 = (string)ContactsRet.JobTitle.GetValue();
if (ContactsRet.AdditionalContactRefList != null)
for (int i7579 = 0; i7579 < ContactsRet.AdditionalContactRefList.Count; i7579++)
IQBBaseRef QBBaseRef = ContactsRet.AdditionalContactRefList.GetAt(i7579);
string ContactName7580 = (string)QBBaseRef.ContactName.GetValue();
string ContactValue7581 = (string)QBBaseRef.ContactValue.GetValue();
if (CustomerRet.CustomerTypeRef != null)
if (CustomerRet.CustomerTypeRef.ListID != null)
string ListID7582 = (string)CustomerRet.CustomerTypeRef.ListID.GetValue();
if (CustomerRet.CustomerTypeRef.FullName != null)
string FullName7583 = (string)CustomerRet.CustomerTypeRef.FullName.GetValue();
if (CustomerRet.TermsRef != null)
if (CustomerRet.TermsRef.ListID != null)
string ListID7584 = (string)CustomerRet.TermsRef.ListID.GetValue();
if (CustomerRet.TermsRef.FullName != null)
string FullName7585 = (string)CustomerRet.TermsRef.FullName.GetValue();
if (CustomerRet.SalesRepRef != null)
if (CustomerRet.SalesRepRef.ListID != null)
string ListID7586 = (string)CustomerRet.SalesRepRef.ListID.GetValue();
if (CustomerRet.SalesRepRef.FullName != null)
string FullName7587 = (string)CustomerRet.SalesRepRef.FullName.GetValue();
if (CustomerRet.Balance != null)
double Balance7588 = (double)CustomerRet.Balance.GetValue();
if (CustomerRet.TotalBalance != null)
double TotalBalance7589 = (double)CustomerRet.TotalBalance.GetValue();
if (CustomerRet.SalesTaxCodeRef != null)
if (CustomerRet.SalesTaxCodeRef.ListID != null)
string ListID7590 = (string)CustomerRet.SalesTaxCodeRef.ListID.GetValue();
if (CustomerRet.SalesTaxCodeRef.FullName != null)
string FullName7591 = (string)CustomerRet.SalesTaxCodeRef.FullName.GetValue();
if (CustomerRet.ItemSalesTaxRef != null)
if (CustomerRet.ItemSalesTaxRef.ListID != null)
string ListID7592 = (string)CustomerRet.ItemSalesTaxRef.ListID.GetValue();
if (CustomerRet.ItemSalesTaxRef.FullName != null)
string FullName7593 = (string)CustomerRet.ItemSalesTaxRef.FullName.GetValue();
if (CustomerRet.SalesTaxCountry != null)
ENSalesTaxCountry SalesTaxCountry7594 = (ENSalesTaxCountry)CustomerRet.SalesTaxCountry.GetValue();
if (CustomerRet.ResaleNumber != null)
string ResaleNumber7595 = (string)CustomerRet.ResaleNumber.GetValue();
if (CustomerRet.AccountNumber != null)
string AccountNumber7596 = (string)CustomerRet.AccountNumber.GetValue();
if (CustomerRet.CreditLimit != null)
double CreditLimit7597 = (double)CustomerRet.CreditLimit.GetValue();
if (CustomerRet.PreferredPaymentMethodRef != null)
if (CustomerRet.PreferredPaymentMethodRef.ListID != null)
string ListID7598 = (string)CustomerRet.PreferredPaymentMethodRef.ListID.GetValue();
if (CustomerRet.PreferredPaymentMethodRef.FullName != null)
string FullName7599 = (string)CustomerRet.PreferredPaymentMethodRef.FullName.GetValue();
if (CustomerRet.CreditCardInfo != null)
if (CustomerRet.CreditCardInfo.CreditCardNumber != null)
string CreditCardNumber7600 = (string)CustomerRet.CreditCardInfo.CreditCardNumber.GetValue();
if (CustomerRet.CreditCardInfo.ExpirationMonth != null)
int ExpirationMonth7601 = (int)CustomerRet.CreditCardInfo.ExpirationMonth.GetValue();
if (CustomerRet.CreditCardInfo.ExpirationYear != null)
int ExpirationYear7602 = (int)CustomerRet.CreditCardInfo.ExpirationYear.GetValue();
if (CustomerRet.CreditCardInfo.NameOnCard != null)
string NameOnCard7603 = (string)CustomerRet.CreditCardInfo.NameOnCard.GetValue();
if (CustomerRet.CreditCardInfo.CreditCardAddress != null)
string CreditCardAddress7604 = (string)CustomerRet.CreditCardInfo.CreditCardAddress.GetValue();
if (CustomerRet.CreditCardInfo.CreditCardPostalCode != null)
string CreditCardPostalCode7605 = (string)CustomerRet.CreditCardInfo.CreditCardPostalCode.GetValue();
if (CustomerRet.JobStatus != null)
ENJobStatus JobStatus7606 = (ENJobStatus)CustomerRet.JobStatus.GetValue();
if (CustomerRet.JobStartDate != null)
DateTime JobStartDate7607 = (DateTime)CustomerRet.JobStartDate.GetValue();
if (CustomerRet.JobProjectedEndDate != null)
DateTime JobProjectedEndDate7608 = (DateTime)CustomerRet.JobProjectedEndDate.GetValue();
if (CustomerRet.JobEndDate != null)
DateTime JobEndDate7609 = (DateTime)CustomerRet.JobEndDate.GetValue();
if (CustomerRet.JobDesc != null)
string JobDesc7610 = (string)CustomerRet.JobDesc.GetValue();
if (CustomerRet.JobTypeRef != null)
if (CustomerRet.JobTypeRef.ListID != null)
string ListID7611 = (string)CustomerRet.JobTypeRef.ListID.GetValue();
if (CustomerRet.JobTypeRef.FullName != null)
string FullName7612 = (string)CustomerRet.JobTypeRef.FullName.GetValue();
if (CustomerRet.Notes != null)
string Notes7613 = (string)CustomerRet.Notes.GetValue();
if (CustomerRet.AdditionalNotesRetList != null)
for (int i7614 = 0; i7614 < CustomerRet.AdditionalNotesRetList.Count; i7614++)
IAdditionalNotesRet AdditionalNotesRet = CustomerRet.AdditionalNotesRetList.GetAt(i7614);
int NoteID7615 = (int)AdditionalNotesRet.NoteID.GetValue();
DateTime Date7616 = (DateTime)AdditionalNotesRet.Date.GetValue();
string Note7617 = (string)AdditionalNotesRet.Note.GetValue();
if (CustomerRet.PreferredDeliveryMethod != null)
ENPreferredDeliveryMethod PreferredDeliveryMethod7618 = (ENPreferredDeliveryMethod)CustomerRet.PreferredDeliveryMethod.GetValue();
if (CustomerRet.PriceLevelRef != null)
if (CustomerRet.PriceLevelRef.ListID != null)
string ListID7619 = (string)CustomerRet.PriceLevelRef.ListID.GetValue();
if (CustomerRet.PriceLevelRef.FullName != null)
string FullName7620 = (string)CustomerRet.PriceLevelRef.FullName.GetValue();
if (CustomerRet.ExternalGUID != null)
string ExternalGUID7621 = (string)CustomerRet.ExternalGUID.GetValue();
if (CustomerRet.TaxRegistrationNumber != null)
string TaxRegistrationNumber7622 = (string)CustomerRet.TaxRegistrationNumber.GetValue();
if (CustomerRet.CurrencyRef != null)
if (CustomerRet.CurrencyRef.ListID != null)
string ListID7623 = (string)CustomerRet.CurrencyRef.ListID.GetValue();
if (CustomerRet.CurrencyRef.FullName != null)
string FullName7624 = (string)CustomerRet.CurrencyRef.FullName.GetValue();
if (CustomerRet.DataExtRetList != null)
for (int i7625 = 0; i7625 < CustomerRet.DataExtRetList.Count; i7625++)
IDataExtRet DataExtRet = CustomerRet.DataExtRetList.GetAt(i7625);
if (DataExtRet.OwnerID != null)
string OwnerID7626 = (string)DataExtRet.OwnerID.GetValue();
string DataExtName7627 = (string)DataExtRet.DataExtName.GetValue();
ENDataExtType DataExtType7628 = (ENDataExtType)DataExtRet.DataExtType.GetValue();
string DataExtValue7629 = (string)DataExtRet.DataExtValue.GetValue();