protected void btcheckoder_Click(object sender, EventArgs e)
    {
        NL_Checkout nlcheckout = new NL_Checkout();

        nlcheckout.merchant_site_code = this.merchant_site_code;
        nlcheckout.secure_pass        = this.merchant_pass;
        string resultcheckorder = nlcheckout.Nl_checkoder(1, "1849", "1117603");


        XmlDocument dom = new XmlDocument();

        dom.LoadXml(resultcheckorder);
        XmlNodeList root = dom.DocumentElement.ChildNodes;

        if (root.Item(1).InnerText == "00")
        {
            string result = root.Item(0).InnerText + "|" + root.Item(1).InnerText + "|"
                            + root.Item(2).ChildNodes.Item(0).InnerText
                            + "|"
                            + root.Item(2).ChildNodes.Item(14).InnerText;

            texbox_result_checkoder.Text = result;
        }


        txtserverkt.Text = resultcheckorder;
    }
Ejemplo n.º 2
0
    public Boolean UpdateOrder(String transaction_info, String order_code, String payment_id, String payment_type, String secure_code)
    {
        String path           = Server.MapPath("Contend");
        String secure_code_ws = this.GetMD5Hash(transaction_info + " " + order_code + " " + payment_id + " " + payment_type + " " + this.secure_pass);
        String nd             = transaction_info + " " + order_code + " " + payment_id + " " + payment_type + " " + this.secure_pass;

        System.IO.StreamWriter str = new System.IO.StreamWriter(path + "/nganluong.txt");
        str.Write(nd);
        str.Flush();
        str.Close();

        if (secure_code == secure_code_ws)
        {
            try
            {
                SqlConnection cnn = new SqlConnection();
                cnn.ConnectionString = "data source=(local);Database=Online.Topcare;uid=tc;pwd=quynhnet0153;";
                cnn.Open();

                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "UPDATE Gio_hang_ngan_luong set payment_type=" + payment_type + ", payment_id='" + payment_id + "' where transaction_info=" + transaction_info;
                cmd.Connection  = cnn;
                int result = cmd.ExecuteNonQuery();


                NL_Checkout nlcheckout = new NL_Checkout();
                nlcheckout.merchant_site_code = this.merchant_site_code;
                nlcheckout.secure_pass        = this.secure_pass;

                string resultcheckorder = nlcheckout.Nl_checkoder(1, order_code, payment_id);


                XmlDocument dom = new XmlDocument();
                dom.LoadXml(resultcheckorder);
                XmlNodeList root = dom.DocumentElement.ChildNodes;
                if (root.Item(1).InnerText == "00")
                {
                    // cập nhật đơn hàng với oder_code
                    //Phương thức thanh toán khách đã lựa chọn : == root.Item(2).ChildNodes.Item(14).InnerText;
                }



                if (result != 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex) {
                return(false);
            }
        }
        else
        {
            return(false);
        }
    }