Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ScTool.RecordUserAgent(Request);    // 记录客户端信息

                isAndroidDevice = ScTool.isAndroidDevice(Request);

                if (isAndroidDevice && !ScTool.isAlipayClient(Request)) // 若为安卓设备,且非安卓客户端,则跳转支付宝打开网页
                {
                    //String url = "http://" + Request.Params.Get("HTTP_HOST") + "/" + this.GetType().Name.Replace("_", "/").Replace("/aspx", ".aspx");
                    //url = "alipayqr://platformapi/startapp?saId=10000007&qrcode=" + url;

                    String url = "alipayqr://platformapi/startapp?saId=10000007&qrcode=" + Request.Url.ToString();
                    Response.Redirect(url);
                    return;
                }

                if (isAndroidDevice)
                {
                    qqDiv.InnerHtml = "<a target=\"_blank\" href=\"tencent://message/?uin=536400495\"><img border=\"0\" src=\"../tools/HB_pic/qq_button.gif\" alt=\"点击这里给我发消息\" title=\"联系作者\" /></a>";
                }
            }

            FileUpload_HB.Style.Add("display", "none");   // 隐藏控件
            FileUpload_SK.Style.Add("display", "none");   // 隐藏控件

            //FileUpload_HB.Attributes.Add("onchange", "document.getElementById('ImageButton_Create').click();"); // FileUload选择文件后触发控件ImageButton的Click()事件

            Button_HB.Style.Add("display", "none");   // 隐藏控件
            Button_SK.Style.Add("display", "none");   // 隐藏控件

            tableUpload.Style.Add("display", "none"); // 隐藏控件

            //Button_HB.Visible = false;
            //Button_SK.Visible = false;


            // 根据红包码参数,跳转红包码、或 收款码

            //serverUrl = "http://" + Request.Params.Get("HTTP_HOST") + "/" + this.GetType().Name.Replace("_", "/").Replace("/aspx", ".aspx");
            InfoUrl = "http://" + Request.Params.Get("HTTP_HOST") + "/PageHB/HbInfo.aspx";
            //HbPayUrl = "http://" + Request.Params.Get("HTTP_HOST") + "/PageHB/HbPay.aspx";
            HbPayUrl = "~/PageHB/HbPay.aspx";

            string ID = Request["p"];

            if (ID != null && !ID.Equals(""))
            {
                //string QrUrl = getHbInfo(ID, "QrUrl");
                //string Tittle = getHbInfo(ID, "Tittle");
                //string HbUrl = getHbInfo(ID, "HbUrl");

                string jsonData = getHbInfo(ID);    // 查询对应的数据

                string QrUrl  = ScTool.getJsonValue(jsonData, "QrUrl");
                string Tittle = ScTool.getJsonValue(jsonData, "Tittle");
                string HbUrl  = ScTool.getJsonValue(jsonData, "HbUrl");
                string ext    = ScTool.getJsonValue(jsonData, "ext");

                //if (ext.Contains("mode(") && ext.Contains(")"))
                //{
                //    int start = ext.IndexOf("mode(") + "mode(".Length;
                //    int end = ext.IndexOf(")", start);
                //    String mode = ext.Substring(start, end - start);
                //    HbPayUrl = "~/PageHB/HbPay" + mode + ".aspx";
                //}

                string url = HbPayUrl + "?" + "QrUrl=" + QrUrl + "&HbUrl=" + HbUrl + "&Tittle=" + Tittle + "&ID=" + ID + "&ext=" + ext;

                Server.Transfer(url);
            }
        }