Exemplo n.º 1
0
        internal static bool FindProductByCode(string productCode, ref string ProductDescription, ref decimal ProductPrice)
        {
            bool result = false;

            MSXML2.ServerXMLHTTP60 xmlhttp = new MSXML2.ServerXMLHTTP60();
            xmlhttp.open("GET", URL_PRODUCT_API + productCode, false, Type.Missing, Type.Missing);
            xmlhttp.send(Type.Missing);
            string response = "";

            // was the response ok
            if (xmlhttp.status == 200)
            {
                response           = xmlhttp.responseText;
                ProductDescription = ExtractData("name", xmlhttp.responseText, false);
                ProductPrice       = Decimal.Parse(ExtractData("price", xmlhttp.responseText, true), NumberStyles.Currency | NumberStyles.AllowExponent);
                result             = true;
            }
            else
            {
                result = false;
                MessageBox.Show("Product not found", Application.ProductName);
            }

            return(result);
        }
Exemplo n.º 2
0
        internal static bool FindProductByCode(string productCode, ref string ProductDescription, ref decimal ProductPrice)
        {
            bool result = false;

            MSXML2.ServerXMLHTTP60 xmlhttp = new MSXML2.ServerXMLHTTP60();
            xmlhttp.open("GET", URL_PRODUCT_API + productCode, false, Type.Missing, Type.Missing);
            xmlhttp.send(Type.Missing);
            string response = "";

            // was the response ok
            if (xmlhttp.status == 200)
            {
                response           = xmlhttp.responseText;
                ProductDescription = ExtractData("name", xmlhttp.responseText, false);
                ProductPrice       = Decimal.Parse(ExtractData("price", xmlhttp.responseText, true), NumberStyles.Currency | NumberStyles.AllowExponent);
                result             = true;
            }
            else
            {
                result = false;
                Mobilize.Web.MessageBox.Show("Product not found", System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).ProductName);
            }

            return(result);
        }
Exemplo n.º 3
0
        public bool DoOpen(string method, string url, bool async, string user, string password)
        {
            bool result = false;

            if (url == "")
            {
                url = requestURL;
            }

            try
            {
                xmlhttp.open(method, url, async, user, password);
                result = true;
            }
            catch (Exception)
            {
                result = false;
            }

            return(result);
        }