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);
        }
Example #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);
        }
 public void ShowXMLHTTPResponseText(MSXML2.ServerXMLHTTP60 xml)
 {
     MessageBox.Show(xml.responseText);
 }
 public void SetXMLHTTP(MSXML2.ServerXMLHTTP60 xml)
 {
     xmlhttp = xml;
 }