Exemplo n.º 1
0
 protected override void PageLoad()
 {
     if (UserAgentHelper.IsMobile(HttpContext.Current.Request.UserAgent))
     {
         ResponseHelper.Redirect("http://m.mostool.com");
     }
     base.CheckUserLogin();
     User = UserBLL.ReadUser(base.UserID);
 }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!UserAgentHelper.IsMobile(HttpContext.Current.Request.UserAgent))
            {
                ResponseHelper.Redirect("http://ems.mostool.com");
            }

            if (Cookies.User.GetUserID(true) > 0)
            {
                Response.Redirect("Default.aspx");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns string to identify a cache.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="custom">like "$IsMobile;foo;bar"</param>
        /// <returns>like "true_"</returns>
        public override string GetVaryByCustomString(HttpContext context, string custom)
        {
            var tokens = custom.Split(';');
            var strs   = new List <string>();

            foreach (var token in tokens)
            {
                switch (token)
                {
                case "$IsMobile":
                    strs.Add(UserAgentHelper.IsMobile(context.Request.UserAgent).ToString());
                    break;

                default:
                    break;
                }
            }
            var str = string.Join("_", strs);

            return(str);
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            PayConfig payConfig     = new PayConfig();
            string    out_trade_no  = string.Empty; //订单号
            string    subject       = "";           //商品名称
            string    body          = "";           //商品描述
            string    price         = "";           //单价
            string    total_fee     = "";           //总价
            string    quantity      = "";           //数量
            string    show_url      = "";           //展示地址
            string    logistics_fee = "";           //邮费
            string    action        = RequestHelper.GetQueryString <string>("Action");
            int       userID        = Cookies.User.GetUserID(true);

            switch (action)
            {
            //case "Apply":
            //    int applyID = RequestHelper.GetQueryString<int>("ApplyID");
            //    UserRechargeInfo userRecharge = UserRechargeBLL.ReadUserRecharge(applyID, userID);
            //    out_trade_no = userRecharge.Number;
            //    subject = "在线冲值:" + userRecharge.Number;
            //    body = "在线冲值";
            //    price = userRecharge.Money.ToString();
            //    quantity = "1";
            //    show_url = "http://" + Request.ServerVariables["Http_Host"];
            //    logistics_fee = "0";
            //    break;
            case "PayOrder":
                int       orderID = RequestHelper.GetQueryString <int>("OrderID");
                OrderInfo order   = OrderBLL.ReadOrder(orderID, userID);
                out_trade_no  = order.OrderNumber;
                subject       = "订单号:" + order.OrderNumber;
                body          = "在线支付";
                total_fee     = order.ProductMoney.ToString(); //(order.ProductMoney - order.FavorableMoney + order.ShippingMoney + order.OtherMoney - order.Balance - order.CouponMoney).ToString();
                quantity      = "1";                           //如果使用total_fee,quantity值为1
                show_url      = "http://" + Request.ServerVariables["Http_Host"];
                logistics_fee = "0";
                break;

            default:
                break;
            }
            string payment_type      = "1";                                                                                  //支付类型
            string return_url        = "http://" + Request.ServerVariables["Http_Host"] + "/Plugins/Pay/AliPay/Return.aspx"; //服务器返回接口
            string notify_url        = "http://" + Request.ServerVariables["Http_Host"] + "/Plugins/Pay/AliPay/Notify.aspx"; //服务器通知接口
            string logistics_type    = "POST";
            string logistics_payment = "BUYER_PAY";

            AliPay ap = new AliPay();
            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("partner", payConfig.Partner);
            sParaTemp.Add("_input_charset", payConfig.InputCharset);
            sParaTemp.Add("payment_type", payment_type);
            sParaTemp.Add("notify_url", notify_url);
            sParaTemp.Add("return_url", return_url);
            sParaTemp.Add("out_trade_no", out_trade_no);
            sParaTemp.Add("subject", subject);
            sParaTemp.Add("total_fee", total_fee);
            sParaTemp.Add("body", body);
            sParaTemp.Add("show_url", show_url);
            sParaTemp.Add("quantity", quantity);
            //PC
            if (!UserAgentHelper.IsMobile(Request.UserAgent))
            {
                sParaTemp.Add("seller_email", payConfig.SellerEmail);
                sParaTemp.Add("service", "create_direct_pay_by_user");
                sParaTemp.Add("anti_phishing_key", "");
                sParaTemp.Add("exter_invoke_ip", "");
            }
            else//移动
            {
                sParaTemp.Add("seller_id", payConfig.SellerId);
                sParaTemp.Add("service", "alipay.wap.create.direct.pay.by.user");
                sParaTemp.Add("it_b_pay", "");
                sParaTemp.Add("extern_token", "");
            }

            string aliay_url = ap.CreatUrl(sParaTemp);

            Response.Redirect(aliay_url);
        }