void RequestService()
        {
            requestMsgSet.ClearRequests();
            IItemServiceQuery service = requestMsgSet.AppendItemServiceQueryRq();

            responseMsgSet = sessionManager.DoRequests(requestMsgSet);
            IResponse response = responseMsgSet.ResponseList.GetAt(0);

            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.rtItemServiceQueryRs)
                    {
                        //upcast to more specific type here, this is safe because we checked with response.Type check above
                        IItemServiceRetList ItemServiceRetList = (IItemServiceRetList)response.Detail;
                        int count = ItemServiceRetList.Count;
                        if (count > 0)
                        {
                            ItemList = new List <Items>();
                        }
                        for (int a = 0; a < count; a++)
                        {
                            ItemList.Add(WalkServiceItem(ItemServiceRetList.GetAt(a)));
                        }
                    }
                }
            }
            else
            {
                //  throw new QBException(response.StatusCode, response.StatusMessage.ToString(), requestMsgSet.ToXMLString());
            }
        }
Example #2
0
        void WalkItemServiceQueryRs(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.rtItemServiceQueryRs)
                        {
                            //upcast to more specific type here, this is safe because we checked with response.Type check above
                            IItemServiceRetList ItemServiceRet = (IItemServiceRetList)response.Detail;
                            WalkItemServiceRet(ItemServiceRet.GetAt(0));
                        }
                    }
                }
            }
        }