예제 #1
0
        private static void WalkCustomerTypeAddRs(string response)
        {
            //Parse the response XML string into an XmlDocument
            XmlDocument responseXmlDoc = new XmlDocument();

            responseXmlDoc.LoadXml(response);

            //Get the response for our request
            XmlNodeList CustomerTypeAddRsList = responseXmlDoc.GetElementsByTagName("CustomerTypeAddRs");

            if (CustomerTypeAddRsList.Count == 1) //Should always be true since we only did one request in this sample
            {
                XmlNode responseNode = CustomerTypeAddRsList.Item(0);
                //Check the status code, info, and severity
                XmlAttributeCollection rsAttributes = responseNode.Attributes;
                string statusCode     = rsAttributes.GetNamedItem("statusCode").Value;
                string statusSeverity = rsAttributes.GetNamedItem("statusSeverity").Value;
                string statusMessage  = rsAttributes.GetNamedItem("statusMessage").Value;

                // Check status and log any errors
                QBUtils.CheckStatus(statusCode, statusSeverity, statusMessage);

                //status code = 0 all OK, > 0 is warning
                if (Convert.ToInt32(statusCode) >= 0)
                {
                    XmlNodeList CustomerTypeRetList = responseNode.SelectNodes("//CustomerTypeRet");//XPath Query
                    for (int i = 0; i < CustomerTypeRetList.Count; i++)
                    {
                        XmlNode CustomerTypeRet = CustomerTypeRetList.Item(i);
                        WalkCustomerTypeRetForAdd(CustomerTypeRet);
                    }
                }
            }
        }
        private static bool WalkDataExtModRs(string response)
        {
            //Parse the response XML string into an XmlDocument
            XmlDocument responseXmlDoc = new XmlDocument();

            responseXmlDoc.LoadXml(response);

            //Get the response for our request
            XmlNodeList DataExtModRsList = responseXmlDoc.GetElementsByTagName("DataExtModRs");

            if (DataExtModRsList.Count >= 5) //Should always be true since we update at least 5 elements in this request
            {
                XmlNode responseNode = DataExtModRsList.Item(0);
                //Check the status code, info, and severity
                XmlAttributeCollection rsAttributes = responseNode.Attributes;
                string statusCode     = rsAttributes.GetNamedItem("statusCode").Value;
                string statusSeverity = rsAttributes.GetNamedItem("statusSeverity").Value;
                string statusMessage  = rsAttributes.GetNamedItem("statusMessage").Value;

                // Check status and log any errors
                QBUtils.CheckStatus(statusCode, statusSeverity, statusMessage);

                //status code = 0 all OK, > 0 is warning
                if (Convert.ToInt32(statusCode) == 0)
                {
                    XmlNodeList DataExtRetList = responseNode.SelectNodes("//DataExtRet");//XPath Query
                    for (int i = 0; i < DataExtRetList.Count; i++)
                    {
                        XmlNode DataExtRet = DataExtRetList.Item(i);
                        WalkDataExtRet(DataExtRet);
                    }

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }