Returns information about the QBPOS company currently being used by the application. For example, the company name and address, whether the company data is the sample company provided by QBPOS for testing and learning, and certain company preference settings, especially preference settings and/or values needed by other QBPOS SDK requests.
Request
Response
XMLOPS
VB.NET
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | <?xml version="1.0" encoding="utf-8"?> <?qbposxml version="4.0"?> <QBPOSXML> <QBPOSXMLMsgsRq onError="stopOnError"> <CompanyQueryRq> <OwnerID >GUIDTYPE</OwnerID> <!-- optional, may repeat --> </CompanyQueryRq> <CompanyQueryRs statusCode="INTTYPE" statusSeverity="STRTYPE" statusMessage="STRTYPE"> <CompanyRet> <!-- optional --> <IsSampleCompany >BOOLTYPE</IsSampleCompany> <!-- required --> <CompanyName >STRTYPE</CompanyName> <!-- required --> <Address> <!-- required --> <Street >STRTYPE</Street> <!-- required --> <CityStateZIP >STRTYPE</CityStateZIP> <!-- required --> <Misc1 >STRTYPE</Misc1> <!-- required --> <Misc2 >STRTYPE</Misc2> <!-- required --> <Misc3 >STRTYPE</Misc3> <!-- required --> </Address> <QuickBooksCompanyFile >STRTYPE</QuickBooksCompanyFile> <!-- optional --> <StoreNumber >INTTYPE</StoreNumber> <!-- required --> <StoreCode >INTTYPE</StoreCode> <!-- required --> <Store> <!-- must occur 0 - 10 times --> <StoreNumber >INTTYPE</StoreNumber> <!-- required --> <StoreCode >INTTYPE</StoreCode> <!-- required --> <StoreName >STRTYPE</StoreName> <!-- required --> <Address> <!-- required --> <Street >STRTYPE</Street> <!-- required --> <CityStateZIP >STRTYPE</CityStateZIP> <!-- required --> <Misc1 >STRTYPE</Misc1> <!-- required --> <Misc2 >STRTYPE</Misc2> <!-- required --> <Misc3 >STRTYPE</Misc3> <!-- required --> </Address> </Store> <PriceLevel1> <!-- required --> <Name >STRTYPE</Name> <!-- required --> <Markdown >PERCENTTYPE</Markdown> <!-- required --> </PriceLevel1> <PriceLevel2> <!-- required --> <Name >STRTYPE</Name> <!-- required --> <Markdown >PERCENTTYPE</Markdown> <!-- required --> </PriceLevel2> <PriceLevel3> <!-- required --> <Name >STRTYPE</Name> <!-- required --> <Markdown >PERCENTTYPE</Markdown> <!-- required --> </PriceLevel3> <PriceLevel4> <!-- required --> <Name >STRTYPE</Name> <!-- required --> <Markdown >PERCENTTYPE</Markdown> <!-- required --> </PriceLevel4> <PriceLevel5> <!-- required --> <Name >STRTYPE</Name> <!-- required --> <Markdown >PERCENTTYPE</Markdown> <!-- required --> </PriceLevel5> <PurchaseOrderStatusInfo> <!-- required --> <OrderStatusData> <!-- required, may repeat --> <!-- StatusType may have one of the following values: Open, Closed, Custom --> <StatusType >ENUMTYPE</StatusType> <!-- required --> <StatusDescription >STRTYPE</StatusDescription> <!-- required --> </OrderStatusData> </PurchaseOrderStatusInfo> <LayawayStatusInfo> <!-- required --> <OrderStatusData> <!-- required, may repeat --> <!-- StatusType may have one of the following values: Open, Closed, Custom --> <StatusType >ENUMTYPE</StatusType> <!-- required --> <StatusDescription >STRTYPE</StatusDescription> <!-- required --> </OrderStatusData> </LayawayStatusInfo> <SalesOrderStatusInfo> <!-- required --> <OrderStatusData> <!-- required, may repeat --> <!-- StatusType may have one of the following values: Open, Closed, Custom --> <StatusType >ENUMTYPE</StatusType> <!-- required --> <StatusDescription >STRTYPE</StatusDescription> <!-- required --> </OrderStatusData> </SalesOrderStatusInfo> <WorkOrderStatusInfo> <!-- required --> <OrderStatusData> <!-- required, may repeat --> <!-- StatusType may have one of the following values: Open, Closed, Custom --> <StatusType >ENUMTYPE</StatusType> <!-- required --> <StatusDescription >STRTYPE</StatusDescription> <!-- required --> </OrderStatusData> </WorkOrderStatusInfo> <IsUsingUnitsOfMeasure >BOOLTYPE</IsUsingUnitsOfMeasure> <!-- required --> <IsUsingIntegratedShipping >BOOLTYPE</IsUsingIntegratedShipping> <!-- required --> <ShippingProvider >STRTYPE</ShippingProvider> <!-- optional, may repeat --> <TaxRecord> <!-- required, may repeat --> <TaxCategoryListID >IDTYPE</TaxCategoryListID> <!-- required --> <TaxCategory >STRTYPE</TaxCategory> <!-- optional --> <POSTaxCodeListID >IDTYPE</POSTaxCodeListID> <!-- required --> <POSTaxCode >STRTYPE</POSTaxCode> <!-- optional --> <TaxPercent >PERCENTTYPE</TaxPercent> <!-- optional --> <TaxRate> <!-- must occur 0 - 3 times --> <TaxPercent >PERCENTTYPE</TaxPercent> <!-- optional --> <TaxRateName >STRTYPE</TaxRateName> <!-- optional --> <TaxAgency >STRTYPE</TaxAgency> <!-- optional --> <TaxLowRange >AMTTYPE</TaxLowRange> <!-- optional --> <TaxHighRange >AMTTYPE</TaxHighRange> <!-- optional --> <IsTaxAppliedOnlyWithinRange >BOOLTYPE</IsTaxAppliedOnlyWithinRange> <!-- optional --> <QBTaxGroup >STRTYPE</QBTaxGroup> <!-- optional --> </TaxRate> <QBTaxGroup >STRTYPE</QBTaxGroup> <!-- optional --> <QBTaxCode >STRTYPE</QBTaxCode> <!-- optional --> </TaxRecord> <DataExtRet> <!-- optional, may repeat --> <OwnerID >GUIDTYPE</OwnerID> <!-- required --> <DataExtName >STRTYPE</DataExtName> <!-- required --> <!-- DataExtType may have one of the following values: INTTYPE, AMTTYPE, PRICETYPE, QUANTYPE, PERCENTTYPE, DATETIMETYPE, STR255TYPE, STR1024TYPE --> <DataExtType >ENUMTYPE</DataExtType> <!-- required --> <DataExtValue >STRTYPE</DataExtValue> <!-- required --> </DataExtRet> </CompanyRet> </CompanyQueryRs> </QBPOSXMLMsgsRq> </QBPOSXML> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | 'The following sample code is generated as an illustration of
'Creating requests and parsing responses ONLY
'This code is NOT intended to show best practices or ideal code
'Use at your most careful discretion
imports System
imports System.Net
imports System.Drawing
imports System.Collections
imports System.ComponentModel
imports System.Windows.Forms
imports System.Data
imports System.IO
imports Interop.qbposfc4
Public Class SampleCompanyQuery
Public Sub DoCompanyQuery()
Dim sessionBegun as Boolean
sessionBegun = False
Dim connectionOpen as Boolean
connectionOpen = False
Dim sessionManager as QBPOSSessionManager
sessionManager = nothing
Try
'Create the session Manager object
sessionManager = new QBPOSSessionManager
'Create the message set request object to hold our request
Dim requestMsgSet as IMsgSetRequest
requestMsgSet = sessionManager.CreateMsgSetRequest(4,0)
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue
BuildCompanyQueryRq(requestMsgSet)
'Connect to QuickBooks and begin a session
sessionManager.OpenConnection("","Sample Code from OSR")
connectionOpen = True
sessionManager.BeginSession("")
sessionBegun = True
'Send the request and get the response from QuickBooks
Dim responseMsgSet as IMsgSetResponse
responseMsgSet = sessionManager.DoRequests(requestMsgSet)
'End the session and close the connection to QuickBooks
sessionManager.EndSession()
sessionBegun = False
sessionManager.CloseConnection()
connectionOpen = False
WalkCompanyQueryRs(responseMsgSet)
Catch e as Exception
MessageBox.Show(e.Message, "Error")
if (sessionBegun) then
sessionManager.EndSession()
End If
if (connectionOpen) then
sessionManager.CloseConnection()
End If
End Try
End Sub
Public Sub BuildCompanyQueryRq(requestMsgSet as IMsgSetRequest)
Dim CompanyQueryRq as ICompanyQuery
CompanyQueryRq= requestMsgSet.AppendCompanyQueryRq()
'Set field value for OwnerIDList
'May create more than one of these if needed
CompanyQueryRq.OwnerIDList.Add(System.Guid.NewGuid().ToString())
End Sub
Public Sub WalkCompanyQueryRs( responseMsgSet as IMsgSetResponse)
if (responseMsgSet is nothing) then
Exit Sub
End If
Dim responseList as IResponseList
responseList = responseMsgSet.ResponseList
if (responseList is nothing) then
Exit Sub
End If
'if we sent only one request, there is only one response, we'll walk the list for this sample
for j=0 to responseList.Count-1
Dim response as IResponse
response = responseList.GetAt(j)
'check the status code of the response, 0=ok, >0 is warning
if (response.StatusCode >= 0) then
'the request-specific response is in the details, make sure we have some
if (not response.Detail is nothing) then
'make sure the response is the type we're expecting
Dim responseType as ENResponseType
responseType = CType(response.Type.GetValue(),ENResponseType)
if (responseType = ENResponseType.rtCompanyQueryRs) then
'upcast to more specific type here, this is safe because we checked with response.Type check above
Dim CompanyRet as ICompanyRet
CompanyRet = CType(response.Detail,ICompanyRet)
WalkCompanyRet(CompanyRet)
End If
End If
End If
Next j
End Sub
Public Sub WalkCompanyRet(CompanyRet as ICompanyRet)
if (CompanyRet is nothing) then
Exit Sub
End If
'Go through all the elements of ICompanyRet
'Get value of IsSampleCompany
Dim IsSampleCompany1 as Boolean
IsSampleCompany1 = CompanyRet.IsSampleCompany.GetValue()
'Get value of CompanyName
Dim CompanyName2 as String
CompanyName2 = CompanyRet.CompanyName.GetValue()
'Get value of Street
Dim Street3 as String
Street3 = CompanyRet.Address.Street.GetValue()
'Get value of CityStateZIP
Dim CityStateZIP4 as String
CityStateZIP4 = CompanyRet.Address.CityStateZIP.GetValue()
'Get value of Misc1
Dim Misc15 as String
Misc15 = CompanyRet.Address.Misc1.GetValue()
'Get value of Misc2
Dim Misc26 as String
Misc26 = CompanyRet.Address.Misc2.GetValue()
'Get value of Misc3
Dim Misc37 as String
Misc37 = CompanyRet.Address.Misc3.GetValue()
'Get value of QuickBooksCompanyFile
if ( not CompanyRet.QuickBooksCompanyFile is nothing) then
Dim QuickBooksCompanyFile8 as String
QuickBooksCompanyFile8 = CompanyRet.QuickBooksCompanyFile.GetValue()
End If
'Get value of StoreNumber
Dim StoreNumber9 as Integer
StoreNumber9 = CompanyRet.StoreNumber.GetValue()
'Get value of StoreCode
Dim StoreCode10 as Integer
StoreCode10 = CompanyRet.StoreCode.GetValue()
if (not CompanyRet.StoreList is nothing)
Dim i11 as Integer
for i11 = 0 to CompanyRet.StoreList.Count - 1
Dim Store as IStore
Store = CompanyRet.StoreList.GetAt(i11)
'Get value of StoreNumber
Dim StoreNumber12 as Integer
StoreNumber12 = Store.StoreNumber.GetValue()
'Get value of StoreCode
Dim StoreCode13 as Integer
StoreCode13 = Store.StoreCode.GetValue()
'Get value of StoreName
Dim StoreName14 as String
StoreName14 = Store.StoreName.GetValue()
'Get value of Street
Dim Street15 as String
Street15 = Store.Address.Street.GetValue()
'Get value of CityStateZIP
Dim CityStateZIP16 as String
CityStateZIP16 = Store.Address.CityStateZIP.GetValue()
'Get value of Misc1
Dim Misc117 as String
Misc117 = Store.Address.Misc1.GetValue()
'Get value of Misc2
Dim Misc218 as String
Misc218 = Store.Address.Misc2.GetValue()
'Get value of Misc3
Dim Misc319 as String
Misc319 = Store.Address.Misc3.GetValue()
Next i11
End If
'Get value of Name
Dim Name20 as String
Name20 = CompanyRet.PriceLevel1.Name.GetValue()
'Get value of Markdown
Dim Markdown21 as Double
Markdown21 = CompanyRet.PriceLevel1.Markdown.GetValue()
'Get value of Name
Dim Name22 as String
Name22 = CompanyRet.PriceLevel2.Name.GetValue()
'Get value of Markdown
Dim Markdown23 as Double
Markdown23 = CompanyRet.PriceLevel2.Markdown.GetValue()
'Get value of Name
Dim Name24 as String
Name24 = CompanyRet.PriceLevel3.Name.GetValue()
'Get value of Markdown
Dim Markdown25 as Double
Markdown25 = CompanyRet.PriceLevel3.Markdown.GetValue()
'Get value of Name
Dim Name26 as String
Name26 = CompanyRet.PriceLevel4.Name.GetValue()
'Get value of Markdown
Dim Markdown27 as Double
Markdown27 = CompanyRet.PriceLevel4.Markdown.GetValue()
'Get value of Name
Dim Name28 as String
Name28 = CompanyRet.PriceLevel5.Name.GetValue()
'Get value of Markdown
Dim Markdown29 as Double
Markdown29 = CompanyRet.PriceLevel5.Markdown.GetValue()
if (not CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList is nothing)
Dim i30 as Integer
for i30 = 0 to CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList.Count - 1
Dim OrderStatusData as IOrderStatusData
OrderStatusData = CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList.GetAt(i30)
'Get value of StatusType
Dim StatusType31 as ENStatusType
StatusType31 = OrderStatusData.StatusType.GetValue()
'Get value of StatusDescription
Dim StatusDescription32 as String
StatusDescription32 = OrderStatusData.StatusDescription.GetValue()
Next i30
End If
if (not CompanyRet.LayawayStatusInfo.OrderStatusDataList is nothing)
Dim i33 as Integer
for i33 = 0 to CompanyRet.LayawayStatusInfo.OrderStatusDataList.Count - 1
Dim OrderStatusData as IOrderStatusData
OrderStatusData = CompanyRet.LayawayStatusInfo.OrderStatusDataList.GetAt(i33)
'Get value of StatusType
Dim StatusType34 as ENStatusType
StatusType34 = OrderStatusData.StatusType.GetValue()
'Get value of StatusDescription
Dim StatusDescription35 as String
StatusDescription35 = OrderStatusData.StatusDescription.GetValue()
Next i33
End If
if (not CompanyRet.SalesOrderStatusInfo.OrderStatusDataList is nothing)
Dim i36 as Integer
for i36 = 0 to CompanyRet.SalesOrderStatusInfo.OrderStatusDataList.Count - 1
Dim OrderStatusData as IOrderStatusData
OrderStatusData = CompanyRet.SalesOrderStatusInfo.OrderStatusDataList.GetAt(i36)
'Get value of StatusType
Dim StatusType37 as ENStatusType
StatusType37 = OrderStatusData.StatusType.GetValue()
'Get value of StatusDescription
Dim StatusDescription38 as String
StatusDescription38 = OrderStatusData.StatusDescription.GetValue()
Next i36
End If
if (not CompanyRet.WorkOrderStatusInfo.OrderStatusDataList is nothing)
Dim i39 as Integer
for i39 = 0 to CompanyRet.WorkOrderStatusInfo.OrderStatusDataList.Count - 1
Dim OrderStatusData as IOrderStatusData
OrderStatusData = CompanyRet.WorkOrderStatusInfo.OrderStatusDataList.GetAt(i39)
'Get value of StatusType
Dim StatusType40 as ENStatusType
StatusType40 = OrderStatusData.StatusType.GetValue()
'Get value of StatusDescription
Dim StatusDescription41 as String
StatusDescription41 = OrderStatusData.StatusDescription.GetValue()
Next i39
End If
'Get value of IsUsingUnitsOfMeasure
Dim IsUsingUnitsOfMeasure42 as Boolean
IsUsingUnitsOfMeasure42 = CompanyRet.IsUsingUnitsOfMeasure.GetValue()
'Get value of IsUsingIntegratedShipping
Dim IsUsingIntegratedShipping43 as Boolean
IsUsingIntegratedShipping43 = CompanyRet.IsUsingIntegratedShipping.GetValue()
'Get value of ShippingProviderList
if ( not CompanyRet.ShippingProviderList is nothing) then
Dim ShippingProvider44 as String
ShippingProvider44 = CompanyRet.ShippingProviderList.GetAt(0)
End If
if (not CompanyRet.TaxRecordList is nothing)
Dim i45 as Integer
for i45 = 0 to CompanyRet.TaxRecordList.Count - 1
Dim TaxRecord as ITaxRecord
TaxRecord = CompanyRet.TaxRecordList.GetAt(i45)
'Get value of TaxCategoryListID
Dim TaxCategoryListID46 as String
TaxCategoryListID46 = TaxRecord.TaxCategoryListID.GetValue()
'Get value of TaxCategory
if ( not TaxRecord.TaxCategory is nothing) then
Dim TaxCategory47 as String
TaxCategory47 = TaxRecord.TaxCategory.GetValue()
End If
'Get value of POSTaxCodeListID
Dim POSTaxCodeListID48 as String
POSTaxCodeListID48 = TaxRecord.POSTaxCodeListID.GetValue()
'Get value of POSTaxCode
if ( not TaxRecord.POSTaxCode is nothing) then
Dim POSTaxCode49 as String
POSTaxCode49 = TaxRecord.POSTaxCode.GetValue()
End If
'Get value of TaxPercent
if ( not TaxRecord.TaxPercent is nothing) then
Dim TaxPercent50 as Double
TaxPercent50 = TaxRecord.TaxPercent.GetValue()
End If
if (not TaxRecord.TaxRateList is nothing)
Dim i51 as Integer
for i51 = 0 to TaxRecord.TaxRateList.Count - 1
Dim TaxRate as ITaxRate
TaxRate = TaxRecord.TaxRateList.GetAt(i51)
'Get value of TaxPercent
if ( not TaxRate.TaxPercent is nothing) then
Dim TaxPercent52 as Double
TaxPercent52 = TaxRate.TaxPercent.GetValue()
End If
'Get value of TaxRateName
if ( not TaxRate.TaxRateName is nothing) then
Dim TaxRateName53 as String
TaxRateName53 = TaxRate.TaxRateName.GetValue()
End If
'Get value of TaxAgency
if ( not TaxRate.TaxAgency is nothing) then
Dim TaxAgency54 as String
TaxAgency54 = TaxRate.TaxAgency.GetValue()
End If
'Get value of TaxLowRange
if ( not TaxRate.TaxLowRange is nothing) then
Dim TaxLowRange55 as Double
TaxLowRange55 = TaxRate.TaxLowRange.GetValue()
End If
'Get value of TaxHighRange
if ( not TaxRate.TaxHighRange is nothing) then
Dim TaxHighRange56 as Double
TaxHighRange56 = TaxRate.TaxHighRange.GetValue()
End If
'Get value of IsTaxAppliedOnlyWithinRange
if ( not TaxRate.IsTaxAppliedOnlyWithinRange is nothing) then
Dim IsTaxAppliedOnlyWithinRange57 as Boolean
IsTaxAppliedOnlyWithinRange57 = TaxRate.IsTaxAppliedOnlyWithinRange.GetValue()
End If
'Get value of QBTaxGroup
if ( not TaxRate.QBTaxGroup is nothing) then
Dim QBTaxGroup58 as String
QBTaxGroup58 = TaxRate.QBTaxGroup.GetValue()
End If
Next i51
End If
'Get value of QBTaxGroup
if ( not TaxRecord.QBTaxGroup is nothing) then
Dim QBTaxGroup59 as String
QBTaxGroup59 = TaxRecord.QBTaxGroup.GetValue()
End If
'Get value of QBTaxCode
if ( not TaxRecord.QBTaxCode is nothing) then
Dim QBTaxCode60 as String
QBTaxCode60 = TaxRecord.QBTaxCode.GetValue()
End If
Next i45
End If
if (not CompanyRet.DataExtRetList is nothing)
Dim i61 as Integer
for i61 = 0 to CompanyRet.DataExtRetList.Count - 1
Dim DataExtRet as IDataExtRet
DataExtRet = CompanyRet.DataExtRetList.GetAt(i61)
'Get value of OwnerID
Dim OwnerID62 as String
OwnerID62 = DataExtRet.OwnerID.GetValue()
'Get value of DataExtName
Dim DataExtName63 as String
DataExtName63 = DataExtRet.DataExtName.GetValue()
'Get value of DataExtType
Dim DataExtType64 as ENDataExtType
DataExtType64 = DataExtRet.DataExtType.GetValue()
'Get value of DataExtValue
Dim DataExtValue65 as String
DataExtValue65 = DataExtRet.DataExtValue.GetValue()
Next i61
End If
End Sub
End Class
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | //The following sample code is generated as an illustration of //Creating requests and parsing responses ONLY //This code is NOT intended to show best practices or ideal code //Use at your most careful discretion using System; using System.Net; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.IO; using Interop.qbposfc4; namespace com.intuit.idn.samples { public class SampleCompanyQuery { public void DoCompanyQuery() { bool sessionBegun = false; bool connectionOpen = false; QBPOSSessionManager sessionManager = null; try { //Create the session Manager object sessionManager = new QBPOSSessionManager(); //Create the message set request object to hold our request IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest(4,0); requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue; BuildCompanyQueryRq(requestMsgSet); //Connect to QuickBooks and begin a session sessionManager.OpenConnection("","Sample Code from OSR"); connectionOpen = true; sessionManager.BeginSession(""); sessionBegun = true; //Send the request and get the response from QuickBooks IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet); //End the session and close the connection to QuickBooks sessionManager.EndSession(); sessionBegun = false; sessionManager.CloseConnection(); connectionOpen = false; WalkCompanyQueryRs(responseMsgSet); } catch (Exception e) { MessageBox.Show(e.Message, "Error"); if (sessionBegun) { sessionManager.EndSession(); } if (connectionOpen) { sessionManager.CloseConnection(); } } } void BuildCompanyQueryRq(IMsgSetRequest requestMsgSet) { ICompanyQuery CompanyQueryRq= requestMsgSet.AppendCompanyQueryRq(); //Set field value for OwnerIDList //May create more than one of these if needed CompanyQueryRq.OwnerIDList.Add(Guid.NewGuid().ToString()); } void WalkCompanyQueryRs(IMsgSetResponse responseMsgSet) { if (responseMsgSet == null) return; IResponseList responseList = responseMsgSet.ResponseList; if (responseList == null) return; //if we sent only one request, there is only one response, we'll walk the list for this sample for(int i=0; i < responseList.Count; i++) { IResponse response = responseList.GetAt(i); //check the status code of the response, 0=ok, >0 is warning if (response.StatusCode >= 0) { //the request-specific response is in the details, make sure we have some if (response.Detail != null) { //make sure the response is the type we're expecting ENResponseType responseType = (ENResponseType)response.Type.GetValue(); if (responseType == ENResponseType.rtCompanyQueryRs) { //upcast to more specific type here, this is safe because we checked with response.Type check above ICompanyRet CompanyRet = (ICompanyRet)response.Detail; WalkCompanyRet(CompanyRet); } } } } } void WalkCompanyRet(ICompanyRet CompanyRet) { if (CompanyRet == null) return; //Go through all the elements of ICompanyRet //Get value of IsSampleCompany bool IsSampleCompany66 = (bool)CompanyRet.IsSampleCompany.GetValue(); //Get value of CompanyName string CompanyName67 = (string)CompanyRet.CompanyName.GetValue(); //Get value of Street string Street68 = (string)CompanyRet.Address.Street.GetValue(); //Get value of CityStateZIP string CityStateZIP69 = (string)CompanyRet.Address.CityStateZIP.GetValue(); //Get value of Misc1 string Misc170 = (string)CompanyRet.Address.Misc1.GetValue(); //Get value of Misc2 string Misc271 = (string)CompanyRet.Address.Misc2.GetValue(); //Get value of Misc3 string Misc372 = (string)CompanyRet.Address.Misc3.GetValue(); //Get value of QuickBooksCompanyFile if (CompanyRet.QuickBooksCompanyFile != null) { string QuickBooksCompanyFile73 = (string)CompanyRet.QuickBooksCompanyFile.GetValue(); } //Get value of StoreNumber int StoreNumber74 = (int)CompanyRet.StoreNumber.GetValue(); //Get value of StoreCode int StoreCode75 = (int)CompanyRet.StoreCode.GetValue(); if (CompanyRet.StoreList != null) { for (int i76 = 0; i76 < CompanyRet.StoreList.Count; i76++) { IStore Store = CompanyRet.StoreList.GetAt(i76); //Get value of StoreNumber int StoreNumber77 = (int)Store.StoreNumber.GetValue(); //Get value of StoreCode int StoreCode78 = (int)Store.StoreCode.GetValue(); //Get value of StoreName string StoreName79 = (string)Store.StoreName.GetValue(); //Get value of Street string Street80 = (string)Store.Address.Street.GetValue(); //Get value of CityStateZIP string CityStateZIP81 = (string)Store.Address.CityStateZIP.GetValue(); //Get value of Misc1 string Misc182 = (string)Store.Address.Misc1.GetValue(); //Get value of Misc2 string Misc283 = (string)Store.Address.Misc2.GetValue(); //Get value of Misc3 string Misc384 = (string)Store.Address.Misc3.GetValue(); } } //Get value of Name string Name85 = (string)CompanyRet.PriceLevel1.Name.GetValue(); //Get value of Markdown double Markdown86 = (double)CompanyRet.PriceLevel1.Markdown.GetValue(); //Get value of Name string Name87 = (string)CompanyRet.PriceLevel2.Name.GetValue(); //Get value of Markdown double Markdown88 = (double)CompanyRet.PriceLevel2.Markdown.GetValue(); //Get value of Name string Name89 = (string)CompanyRet.PriceLevel3.Name.GetValue(); //Get value of Markdown double Markdown90 = (double)CompanyRet.PriceLevel3.Markdown.GetValue(); //Get value of Name string Name91 = (string)CompanyRet.PriceLevel4.Name.GetValue(); //Get value of Markdown double Markdown92 = (double)CompanyRet.PriceLevel4.Markdown.GetValue(); //Get value of Name string Name93 = (string)CompanyRet.PriceLevel5.Name.GetValue(); //Get value of Markdown double Markdown94 = (double)CompanyRet.PriceLevel5.Markdown.GetValue(); if (CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList != null) { for (int i95 = 0; i95 < CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList.Count; i95++) { IOrderStatusData OrderStatusData = CompanyRet.PurchaseOrderStatusInfo.OrderStatusDataList.GetAt(i95); //Get value of StatusType ENStatusType StatusType96 = (ENStatusType)OrderStatusData.StatusType.GetValue(); //Get value of StatusDescription string StatusDescription97 = (string)OrderStatusData.StatusDescription.GetValue(); } } if (CompanyRet.LayawayStatusInfo.OrderStatusDataList != null) { for (int i98 = 0; i98 < CompanyRet.LayawayStatusInfo.OrderStatusDataList.Count; i98++) { IOrderStatusData OrderStatusData = CompanyRet.LayawayStatusInfo.OrderStatusDataList.GetAt(i98); //Get value of StatusType ENStatusType StatusType99 = (ENStatusType)OrderStatusData.StatusType.GetValue(); //Get value of StatusDescription string StatusDescription100 = (string)OrderStatusData.StatusDescription.GetValue(); } } if (CompanyRet.SalesOrderStatusInfo.OrderStatusDataList != null) { for (int i101 = 0; i101 < CompanyRet.SalesOrderStatusInfo.OrderStatusDataList.Count; i101++) { IOrderStatusData OrderStatusData = CompanyRet.SalesOrderStatusInfo.OrderStatusDataList.GetAt(i101); //Get value of StatusType ENStatusType StatusType102 = (ENStatusType)OrderStatusData.StatusType.GetValue(); //Get value of StatusDescription string StatusDescription103 = (string)OrderStatusData.StatusDescription.GetValue(); } } if (CompanyRet.WorkOrderStatusInfo.OrderStatusDataList != null) { for (int i104 = 0; i104 < CompanyRet.WorkOrderStatusInfo.OrderStatusDataList.Count; i104++) { IOrderStatusData OrderStatusData = CompanyRet.WorkOrderStatusInfo.OrderStatusDataList.GetAt(i104); //Get value of StatusType ENStatusType StatusType105 = (ENStatusType)OrderStatusData.StatusType.GetValue(); //Get value of StatusDescription string StatusDescription106 = (string)OrderStatusData.StatusDescription.GetValue(); } } //Get value of IsUsingUnitsOfMeasure bool IsUsingUnitsOfMeasure107 = (bool)CompanyRet.IsUsingUnitsOfMeasure.GetValue(); //Get value of IsUsingIntegratedShipping bool IsUsingIntegratedShipping108 = (bool)CompanyRet.IsUsingIntegratedShipping.GetValue(); //Get value of ShippingProviderList if (CompanyRet.ShippingProviderList != null) { string ShippingProvider109 = (string)CompanyRet.ShippingProviderList.GetAt(0); } if (CompanyRet.TaxRecordList != null) { for (int i110 = 0; i110 < CompanyRet.TaxRecordList.Count; i110++) { ITaxRecord TaxRecord = CompanyRet.TaxRecordList.GetAt(i110); //Get value of TaxCategoryListID string TaxCategoryListID111 = (string)TaxRecord.TaxCategoryListID.GetValue(); //Get value of TaxCategory if (TaxRecord.TaxCategory != null) { string TaxCategory112 = (string)TaxRecord.TaxCategory.GetValue(); } //Get value of POSTaxCodeListID string POSTaxCodeListID113 = (string)TaxRecord.POSTaxCodeListID.GetValue(); //Get value of POSTaxCode if (TaxRecord.POSTaxCode != null) { string POSTaxCode114 = (string)TaxRecord.POSTaxCode.GetValue(); } //Get value of TaxPercent if (TaxRecord.TaxPercent != null) { double TaxPercent115 = (double)TaxRecord.TaxPercent.GetValue(); } if (TaxRecord.TaxRateList != null) { for (int i116 = 0; i116 < TaxRecord.TaxRateList.Count; i116++) { ITaxRate TaxRate = TaxRecord.TaxRateList.GetAt(i116); //Get value of TaxPercent if (TaxRate.TaxPercent != null) { double TaxPercent117 = (double)TaxRate.TaxPercent.GetValue(); } //Get value of TaxRateName if (TaxRate.TaxRateName != null) { string TaxRateName118 = (string)TaxRate.TaxRateName.GetValue(); } //Get value of TaxAgency if (TaxRate.TaxAgency != null) { string TaxAgency119 = (string)TaxRate.TaxAgency.GetValue(); } //Get value of TaxLowRange if (TaxRate.TaxLowRange != null) { double TaxLowRange120 = (double)TaxRate.TaxLowRange.GetValue(); } //Get value of TaxHighRange if (TaxRate.TaxHighRange != null) { double TaxHighRange121 = (double)TaxRate.TaxHighRange.GetValue(); } //Get value of IsTaxAppliedOnlyWithinRange if (TaxRate.IsTaxAppliedOnlyWithinRange != null) { bool IsTaxAppliedOnlyWithinRange122 = (bool)TaxRate.IsTaxAppliedOnlyWithinRange.GetValue(); } //Get value of QBTaxGroup if (TaxRate.QBTaxGroup != null) { string QBTaxGroup123 = (string)TaxRate.QBTaxGroup.GetValue(); } } } //Get value of QBTaxGroup if (TaxRecord.QBTaxGroup != null) { string QBTaxGroup124 = (string)TaxRecord.QBTaxGroup.GetValue(); } //Get value of QBTaxCode if (TaxRecord.QBTaxCode != null) { string QBTaxCode125 = (string)TaxRecord.QBTaxCode.GetValue(); } } } if (CompanyRet.DataExtRetList != null) { for (int i126 = 0; i126 < CompanyRet.DataExtRetList.Count; i126++) { IDataExtRet DataExtRet = CompanyRet.DataExtRetList.GetAt(i126); //Get value of OwnerID string OwnerID127 = (string)DataExtRet.OwnerID.GetValue(); //Get value of DataExtName string DataExtName128 = (string)DataExtRet.DataExtName.GetValue(); //Get value of DataExtType ENDataExtType DataExtType129 = (ENDataExtType)DataExtRet.DataExtType.GetValue(); //Get value of DataExtValue string DataExtValue130 = (string)DataExtRet.DataExtValue.GetValue(); } } } } } |