Exemplo n.º 1
0
        /// <summary>
        /// 获取房卡配置
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public RoomCardConfig GetRoomCardConfig(int id)
        {
            string         sql  = string.Format("SELECT * FROM RoomCardConfig WHERE ConfigID = {0}", id);
            RoomCardConfig card = Database.ExecuteObject <RoomCardConfig>(sql);

            return(card);
        }
Exemplo n.º 2
0
        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            RoomCardConfig config;

            if (IntParam <= 0)
            {
                config = new RoomCardConfig();
            }
            else
            {
                config = FacadeManage.aideTreasureFacade.GetRoomCardConfig(IntParam);
            }

            config.Amount   = Convert.ToDecimal(CtrlHelper.GetText(txtAmount));
            config.Currency = Convert.ToDecimal(CtrlHelper.GetText(txtCurrency));
            config.RoomCard = CtrlHelper.GetInt(txtRoomCard, 0);
            config.SortID   = CtrlHelper.GetInt(txtSortID, 0);

            if (IntParam <= 0)
            {
                FacadeManage.aideTreasureFacade.InsertRoomCardConfig(config);
                ShowInfo("新增成功", "RoomCardBuyList.aspx", 1200);
            }
            else
            {
                FacadeManage.aideTreasureFacade.UpdateRoomCardConfig(config);
                ShowInfo("更新成功", "RoomCardBuyList.aspx", 1200);
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SiteMaster.Menu = 1;
            if (!IsPostBack)
            {
                //获取登录信息
                UserTicketInfo user = userTicket;

                //获取游戏豆信息
                UserCurrencyInfo currency = FacadeManage.aideTreasureFacade.GetUserCurrencyInfo(user.UserID);
                lbCurrency.Text = currency != null?Convert.ToInt32(currency.Currency).ToString() : "0";

                //获取房卡信息
                UserRoomCard card = FacadeManage.aideTreasureFacade.GetUserRoomCard(user.UserID);
                lbRoomCard.Text = card != null?card.RoomCard.ToString() : "0";

                //获取购买产品
                int            id     = GameRequest.GetQueryInt("id", 0);
                RoomCardConfig config = FacadeManage.aideTreasureFacade.GetRoomCardConfig(id);
                if (config == null)
                {
                    return;
                }

                lbExchCard.Text    = config.RoomCard.ToString();
                lbPayCurrency.Text = Convert.ToInt32(config.Currency).ToString();
            }
        }
Exemplo n.º 4
0
        private void BindData()
        {
            RoomCardConfig config = FacadeManage.aideTreasureFacade.GetRoomCardConfig(IntParam);

            if (config == null)
            {
                return;
            }

            CtrlHelper.SetText(txtAmount, config.Amount.ToString());
            CtrlHelper.SetText(txtCurrency, config.Currency.ToString());
            CtrlHelper.SetText(txtRoomCard, config.RoomCard.ToString());
            CtrlHelper.SetText(txtSortID, config.SortID.ToString());
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //充值配置验证
                int payId = GameRequest.GetInt("id", 0);
                if (payId <= 0)
                {
                    Response.Redirect("/Menu/Buy.aspx");
                }
                RoomCardConfig config = FacadeManage.aideTreasureFacade.GetRoomCardConfig(payId);
                if (config == null)
                {
                    Response.Redirect("/Menu/Buy.aspx");
                }

                // 支付方法
                string      orderID     = PayHelper.GetOrderIDByPrefix("WapWX");
                OnLineOrder onlineOrder = new OnLineOrder();
                onlineOrder.ShareID = 81;
                onlineOrder.OrderID = orderID;

                UserTicketInfo info = userTicket;

                onlineOrder.OperUserID  = info.UserID;
                onlineOrder.GameID      = info.GameID;
                onlineOrder.OrderAmount = config.Amount;
                onlineOrder.IPAddress   = GameRequest.GetUserIP();

                //生成订单
                Message umsg = FacadeManage.aideTreasureFacade.RequestOrderFK(onlineOrder, payId);
                if (!umsg.Success)
                {
                    ShowInfo(umsg.Content);
                    return;
                }

                //随机字符串
                string nonce_str = WeiXinHelper.GetNonce_str();
                //商品描述
                string body = "充值房卡";
                //商户订单号
                string out_trade_no = orderID;
                //交易金额(分为单位)
                int total_fee = Convert.ToInt32(config.Amount * 100);
                //终端IP
                string spbill_create_ip = Utility.UserIP;
                //回调地址
                string notify_url = "http://" + Request.Url.Authority + "/Pay/WX/WxpayNotify.aspx";
                //商品ID
                string product_id = orderID.Substring(5, orderID.Length - 5);

                SortedDictionary <string, object> dic = new SortedDictionary <string, object>();
                dic.Add("nonce_str", nonce_str);
                dic.Add("body", body);
                dic.Add("trade_type", "NATIVE");
                dic.Add("out_trade_no", out_trade_no);
                dic.Add("total_fee", total_fee);
                dic.Add("spbill_create_ip", spbill_create_ip);
                dic.Add("notify_url", notify_url);
                dic.Add("product_id", product_id);

                SortedDictionary <string, object> result = WeiXinHelper.UnifiedOrder(dic, 10);
                string        code    = result["return_code"].ToString();
                StringBuilder builder = new StringBuilder();
                builder.AppendLine(CreateInputHidden("return_code", code));
                builder.AppendLine(CreateInputHidden("return_msg", result["return_msg"].ToString()));
                if (code == "SUCCESS")
                {
                    builder.AppendLine(CreateInputHidden("code_url", result["code_url"].ToString()));
                    builder.AppendLine(CreateInputHidden("orderID", out_trade_no));
                    builder.AppendLine(CreateInputHidden("amount", config.Amount.ToString()));
                }

                formData = builder.ToString();

                js = "<script>window.onload = function() { document.forms[0].submit(); }</script>";
            }



            //NativePay nativePay = new NativePay();

            //string url2 = nativePay.GetPayUrl("123456789");
            //Image2.ImageUrl = "MakeQRCode.aspx?data=" + HttpUtility.UrlEncode(url2);

            ////初始化二维码生成工具
            //QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
            //qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;
            //qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
            //qrCodeEncoder.QRCodeVersion = 0;
            //qrCodeEncoder.QRCodeScale = 4;

            ////将字符串生成二维码图片
            //Bitmap image = qrCodeEncoder.Encode(str, Encoding.Default);

            ////保存为PNG到内存流
            //MemoryStream ms = new MemoryStream();
            //image.Save(ms, ImageFormat.Png);

            ////输出二维码图片
            //Response.BinaryWrite(ms.GetBuffer());
            //Response.End();
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //充值配置验证
            int payId = GameRequest.GetInt("id", 0);

            if (payId <= 0)
            {
                Response.Redirect("/Menu/Buy.aspx");
            }
            RoomCardConfig config = FacadeManage.aideTreasureFacade.GetRoomCardConfig(payId);

            if (config == null)
            {
                Response.Redirect("/Menu/Buy.aspx");
            }

            //充值下单
            string      orderID     = PayHelper.GetOrderIDByPrefix("WapZFB");
            OnLineOrder onlineOrder = new OnLineOrder();

            onlineOrder.ShareID = 81;
            onlineOrder.OrderID = orderID;

            UserTicketInfo info = userTicket;

            onlineOrder.OperUserID  = info.UserID;
            onlineOrder.GameID      = info.GameID;
            onlineOrder.OrderAmount = config.Amount;
            onlineOrder.IPAddress   = GameRequest.GetUserIP();

            //生成订单
            Message umsg = FacadeManage.aideTreasureFacade.RequestOrderFK(onlineOrder, payId);

            if (!umsg.Success)
            {
                ShowInfo(umsg.Content);
                return;
            }

            #region 支付宝提交

            //接口名称
            string service = AlipayConfig.service;
            //合作者身份ID
            string partner = AlipayConfig.partner;
            //参数编码字符集
            string _input_charset = AlipayConfig.input_charset;
            //签名方式
            string sign_type = AlipayConfig.sign_type;
            //签名
            string sign = "";
            //服务器异步通知页面路径
            string notify_url = AlipayConfig.notify_url;
            //页面跳转同步通知页面路径
            string return_url = AlipayConfig.return_url;
            //商户网站唯一订单号
            string out_trade_no = orderID;
            //商品名称
            string subject = "充值房卡";
            //交易金额
            string total_fee = config.Amount.ToString();
            //卖家支付宝用户号
            string seller_id = AlipayConfig.seller_id;
            //支付类型
            string payment_type = AlipayConfig.payment_type;
            //商品展示网址
            string show_url = AlipayConfig.show_url;

            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();
            sParaTemp.Add("partner", partner);
            sParaTemp.Add("seller_id", seller_id);
            sParaTemp.Add("_input_charset", _input_charset);
            sParaTemp.Add("service", service);
            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("show_url", show_url);

            //建立请求
            string sHtmlText = AlipaySubmit.BuildRequest(sParaTemp, "get", "确认");
            Response.Write(sHtmlText);

            #endregion
        }
Exemplo n.º 7
0
 /// <summary>
 /// 修改房卡配置
 /// </summary>
 /// <param name="config"></param>
 /// <returns></returns>
 public int UpdateRoomCardConfig(RoomCardConfig config)
 {
     return(aideTreasureData.UpdateRoomCardConfig(config));
 }
Exemplo n.º 8
0
 /// <summary>
 /// 插入房卡配置
 /// </summary>
 /// <param name="config"></param>
 /// <returns></returns>
 public int InsertRoomCardConfig(RoomCardConfig config)
 {
     return(aideTreasureData.InsertRoomCardConfig(config));
 }