Example #1
0
        /// <summary>
        /// Runs a specified command using the object's credentials
        /// baseURL and parameters
        /// </summary>
        /// <returns>True if successful, else false</returns>
        public bool Execute()
        {
            try
            {
                VerifyParameters();

                CompleteQueryURL = BuildQueryURL();

                switch (ResponseType.ToLower())
                {
                case "xml":
                {
                    XmlDocument XmlResponse = new XmlDocument();
                    XmlResponse.Load(CompleteQueryURL);
                    RawResponse = XmlResponse.OuterXml;
                    break;
                }

                case "text":
                {
                    RawResponse = GetQueryResult(CompleteQueryURL);
                    break;
                }

                case "html":
                {
                    RawResponse = GetQueryResult(CompleteQueryURL);
                    break;
                }
                }

                if (string.IsNullOrEmpty(RawResponse))
                {
                    // Nothing returned
                    Errors.Add("No response from server");
                    return(false);
                }
                else
                {
                    // Check for errors
                    if (GetErrorCount() > 0)
                    {
                        AddErrors(GetErrors());
                    }

                    return(true);
                }
            }
            catch (Exception ex)
            {
                Errors.Add(ex.Message);
                return(false);
            }
        }
Example #2
0
        public List <string> GetErrors()
        {
            if (!string.IsNullOrEmpty(RawResponse))
            {
                switch (ResponseType.ToLower())
                {
                case "html":
                    return(GetHtmlErrors());

                case "xml":
                    return(GetXMLErrors());

                case "text":
                    return(GetTextErrors());

                default:
                    return(new List <string>());
                }
            }
            else
            {
                return(new List <string>());
            }
        }
Example #3
0
        public int GetErrorCount()
        {
            if (!string.IsNullOrEmpty(RawResponse))
            {
                switch (ResponseType.ToLower())
                {
                case "html":
                    return(GetHtmlErrorCount());

                case "xml":
                    return(GetXMLErrorCount());

                case "text":
                    return(GetTextErrorCount());

                default:
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }