Esempio n. 1
0
        public async Task ignore_when_no_handler()
        {
            var serviceProvider = TestConfiguration.GetServiceProvider();

            var manager = serviceProvider.GetService <Manager>();

            var command = new NoHandler();
            await manager.ExecuteAsync(command, "One");
        }
Esempio n. 2
0
        public async Task require_handlers()
        {
            var serviceProvider = TestConfiguration.GetServiceProvider(
                ExecutorOptions.Default.SetRequireHandlers(true)
                );

            var manager = serviceProvider.GetService <Manager>();

            var command = new NoHandler();
            var ex      = await Assert
                          .ThrowsExceptionAsync <HandlerNotFoundException>(
                async() =>
                await manager.ExecuteAsync(command, "One")
                );
        }
Esempio n. 3
0
        public void GetWXJsApiParam()
        {
            string strOpenId = GlobalUtils.OpenId;

            if (strOpenId.IsEmpty())
            {
                PrintJson("-1", "微信未授权,取不到OpenId值");
                return;
            }
            Guid?userId = WebUserAuth.UserId;

            if (userId == null || userId == Guid.Empty)
            {
                PrintJson("-1", "对不起,您还未登录!");
                return;
            }
            TuanDai.PortalSystem.BLL.UserBLL bll = new TuanDai.PortalSystem.BLL.UserBLL();
            UserBasicInfoInfo userModel          = bll.GetUserBasicInfoModelById(userId.Value);

            if (userModel == null)
            {
                PrintJson("-1", "对不起,该用户不存在!");
                return;
            }
            decimal Amount    = Tool.SafeConvert.ToDecimal(WEBRequest.GetFormString("Amount"), 0);
            decimal tmpAmount = Math.Floor(Amount * 100) / 100;

            if (tmpAmount != Amount)
            {
                PrintJson("-1", "充值金额最多只能2位小数,如106.32!");
                return;
            }
            WebSettingInfo rechargeSet       = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA");
            decimal        MinRechargeAmount = decimal.Parse(rechargeSet.Param1Value);

            if (Amount < MinRechargeAmount)
            {
                PrintJson("-1", "最低充值金额为" + MinRechargeAmount.ToString("N2") + "元!");
                return;
            }
            if (Amount > 500000)
            {
                PrintJson("-1", "单次充值不能超过50万!");
                return;
            }

            NoHandler noHandler = new NoHandler();
            string    orderNo   = noHandler.OnLineRechare();

            if (orderNo == "0")
            {
                PrintJson("-1", "您好,您的提交失败请重试!");
                return;
            }

            int    Sel        = 9; //标记是微信支付
            Guid   rechargeId = Guid.NewGuid();
            int    outStatus  = 0;
            string bankcode   = "";
            string userIP     = Tool.WebFormHandler.GetIP();
            //using (SqlConnection connection = TuanDai.PortalSystem.DAL.PubConstant.CrateConnection())
            //{
            var paramData = new Dapper.DynamicParameters();

            paramData.Add("@userid", userId);
            paramData.Add("@type", Sel);
            paramData.Add("@amount", Amount);
            paramData.Add("@orderNo", orderNo);
            paramData.Add("@backcode", bankcode);
            paramData.Add("@clientIp", userIP);
            paramData.Add("@from", "5");
            paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output);
            TuanDai.DB.TuanDaiDB.Execute(TdConfig.DBFundWrite, "AccountRechargeInit", ref paramData, CommandType.StoredProcedure);
            outStatus = paramData.Get <int>("@outStatus");
            //    connection.Execute("AccountRechargeInit", paramData, null, null, System.Data.CommandType.StoredProcedure);
            //    outStatus = paramData.Get<int>("@outStatus");
            //    connection.Close();
            //    connection.Dispose();
            //}


            int result = outStatus;

            if (result > 0)
            {
                TuanDai.Payment.PaymentBLL jsApiPay           = new TuanDai.Payment.PaymentBLL("JSAPI", strOpenId, orderNo, userModel.RealName, userModel.IdentityCard);
                TuanDai.Payment.WxPayData  unifiedOrderResult = null;
                try
                {
                    int PayAmount = int.Parse(double.Parse((Amount * 100).ToString()).ToString());

                    unifiedOrderResult = jsApiPay.WXJsApiUnifiedOrder(PayAmount.ToString());
                }
                catch (Exception ex)
                {
                    PrintJson("-1", ex.Message);
                    return;
                }
                string wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数
                var    jsonData     = new { result = "1", msg = wxJsApiParam };
                PrintJson(jsonData);
            }
            else
            {
                PrintJson("-1", "您好,您的提交失败请重试!");
                return;
            }
        }
Esempio n. 4
0
        void RecognizeNo()
        {
            if (recogInterval[Gesture.No] > 0)
            {
                return;
            }
            try {
                var         nextType   = 0; //0: unknown, 1: pos, 2: neg
                var         diffSum    = 0.0f;
                var         shakeCount = 0;
                const float minShake   = 40.0f;

                var beforeY = hdms.First().eulerAngles.y;
                var index   = 0;
                foreach (var hdm in hdms)
                {
                    if (index < recogIndex[Gesture.No])
                    {
                        continue;
                    }
                    index++;
                    diffSum += GetAngleDiff(beforeY, hdm.eulerAngles.y);
                    beforeY  = hdm.eulerAngles.y;
                    if (nextType == 0)
                    {
                        if (diffSum > minShake || diffSum < -minShake)
                        {
                            if (diffSum > minShake)
                            {
                                nextType = 2;
                            }
                            else if (diffSum < -minShake)
                            {
                                nextType = 1;
                            }
                            shakeCount += 1;
                        }
                    }
                    else if (nextType == 1)
                    {
                        if (diffSum > minShake)
                        {
                            nextType    = 2;
                            shakeCount += 1;
                        }
                    }
                    else if (nextType == 2)
                    {
                        if (diffSum < -minShake)
                        {
                            nextType    = 1;
                            shakeCount += 1;
                        }
                    }
                }
                if (shakeCount >= 2)
                {
                    if (NoHandler != null)
                    {
                        NoHandler.Invoke();
                    }
                    recogInterval[Gesture.No] = gestureInterval;
                    recogIndex[Gesture.No]    = hdms.Count;
                }
            }
            catch (InvalidOperationException)
            {
                // pass
            }
        }
Esempio n. 5
0
        private void GetEBPayCheck()
        {
            Guid userid;

            if (WebUserAuth.UserId != null)
            {
                userid = WebUserAuth.UserId.Value;
            }
            else
            {
                PrintJson("0", "您还未登录!");
                return;
            }

            decimal        Amount            = Tool.SafeConvert.ToDecimal(Request.QueryString["Amount"], 0);
            WebSettingInfo rechargeSet       = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA");
            decimal        MinRechargeAmount = decimal.Parse(rechargeSet.Param1Value);

            if (Amount < MinRechargeAmount)
            {
                PrintJson("0", "您好,充值金额必须大于或者等于" + MinRechargeAmount.ToString("N2") + "!");
                return;
            }

            if (Amount > 5000000)
            {
                PrintJson("0", "单次充值不能超过500万!");
                return;
            }
            NoHandler noHandler = new NoHandler();
            string    orderNo   = noHandler.OnLineRechare();

            if (orderNo == "0")
            {
                PrintJson("0", "您好,您的提交失败请重试!");
                return;
            }

            int    Sel        = 11;
            Guid   rechargeId = Guid.NewGuid();
            string bankcode   = "";

            string            userIP    = Tool.WebFormHandler.GetIP();
            int               outStatus = 0;
            DynamicParameters paras     = new DynamicParameters();

            paras.Add("@userid", userid);
            paras.Add("@type", Sel);
            paras.Add("@amount", Amount);
            paras.Add("@orderNo", orderNo);
            paras.Add("@backcode", bankcode);
            paras.Add("@clientIp", userIP);
            paras.Add("@from", "5");
            paras.Add("@outStatus", 0, DbType.Int32, ParameterDirection.Output);
            PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "AccountRechargeInit", ref paras, CommandType.StoredProcedure);
            outStatus = paras.Get <int>("@outStatus");

            int result = outStatus;

            if (result <= 0)
            {
                PrintJson("0", "您好,您的提交失败请重试!");
            }

            UserBLL           bll      = new UserBLL();
            UserBasicInfoInfo userInfo = bll.GetUserBasicInfoModelById(userid);

            //获取个人信息
            if (null == userInfo)
            {
                PrintJson("0", "获取用户信息错误!");
                return;
            }

            //如果查询没有身份或者真实姓名
            if (string.IsNullOrEmpty(userInfo.IdentityCard) || string.IsNullOrEmpty(userInfo.RealName) || !userInfo.IsValidateIdentity)
            {
                PrintJson("0", "没有获取到用户实名信息(身份证和真实姓名)");
                return;
            }
            GetBankCardNo(userInfo, userid);
            //是否绑定银行卡
            if (string.IsNullOrEmpty(userInfo.BankAccountNo))
            {
                PrintJson("0", "银行卡未绑定");
                return;
            }
            //是否绑定手机
            if (string.IsNullOrEmpty(userInfo.TelNo) || !userInfo.IsValidateMobile)
            {
                PrintJson("0", "未完成手机或实名认证");
                return;
            }

            EBRechargeInfo orderInfo = new EBRechargeInfo();

            orderInfo.IsBindCard = 0;
            orderInfo.OrderId    = orderNo;
            //申请充值
            try
            {
                var bankAccountNo  = userInfo.BankAccountNo.Trim();
                var identityId     = userInfo.Id.ToString().Replace("-", string.Empty).ToUpper();
                var bindCardModel  = BindBankCardList.GetBindCardList(identityId, bankAccountNo);
                var rechargeAmount = (int)(Amount * 100);
                if (bindCardModel == null)
                {
                    var model = new BindCardRequestModel
                    {
                        CardNo        = bankAccountNo,
                        IdCardNo      = userInfo.IdentityCard,
                        IdentityId    = identityId,
                        Phone         = userInfo.TelNo,
                        RegisterPhone = userInfo.TelNo,
                        UserName      = userInfo.RealName,
                    };

                    model.RequestId     = string.Concat("D", identityId);
                    orderInfo.RequestId = model.RequestId;
                    BindBankCard.BindCard(model);
                }
                else
                {
                    orderInfo.RequestId  = string.Concat("D", identityId);
                    orderInfo.IsBindCard = 1;
                    BankCardPay.BindPay(new BankCardPayRequestModel
                    {
                        Amount      = rechargeAmount,
                        CallBackUrl = EBNotifyUrl,
                        CardLast    = bindCardModel.Card_Last,
                        CardTop     = bindCardModel.Card_Top,
                        IdentityId  = identityId,
                        OrderId     = orderNo
                    });
                }
            }
            catch (Exception ex)
            {
                SysLogHelper.WriteErrorLog("易宝充值出错:GetEBPayCheck", Tool.ExceptionHelper.GetExceptionMessage(ex));
                PrintJson("0", "发生错误:" + ex.Message);
                return;
            }
            var ResponseData = new { result = "1", msg = JsonHelper.ToJson(orderInfo) };

            PrintJson(ResponseData);
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Guid userid = WebUserAuth.UserId.Value;

            var bankmodel = new BankInfoBLL().GetBankInfoListByUserId(userid);

            if (bankmodel != null && bankmodel.Count > 0)
            {
                if (bankmodel.Any(p => p.Status == 2))
                {
                    Response.Write("您好,银行卡在审核中不允许充值!");
                    ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,银行卡在审核中不允许充值!','1','确定');</script>");
                    return;
                }
            }

            decimal Amount    = Tool.SafeConvert.ToDecimal(Request.Params["Amount"], 0);
            decimal tmpAmount = Math.Floor(Amount * 100) / 100;

            if (tmpAmount != Amount)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('充值金额最多只能2位小数,如106.32!','1','确定');</script>");
                return;
            }
            TuanDai.PortalSystem.Model.WebSettingInfo rechargeSet = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA");
            decimal minRecharge = decimal.Parse(rechargeSet.Param1Value);

            if (Amount < minRecharge)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('单次充值最少" + minRecharge.ToString("N2") + "元!','1','确定');</script>");
                return;
            }
            if (Amount > 500000)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('单次充值不能超过50万!','1','确定');</script>");
                return;
            }
            NoHandler noHandler = new NoHandler();
            string    orderNo   = noHandler.OnLineRechare();

            if (orderNo == "0")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,您的提交失败请重试!','1','确定');</script>");
                return;
            }

            int    Sel        = Tool.SafeConvert.ToInt32(Request.Params["Sel"], 8);
            Guid   rechargeId = Guid.NewGuid();
            int    outStatus  = 0;
            string bankcode   = "";

            if (Request.Params["bankcode"] != null)
            {
                bankcode = Request.Params["bankcode"];
            }
            string userIP = Tool.WebFormHandler.GetIP();

            var paramData = new Dapper.DynamicParameters();

            paramData.Add("@userid", userid);
            paramData.Add("@type", Sel);
            paramData.Add("@amount", Amount);
            paramData.Add("@orderNo", orderNo);
            paramData.Add("@backcode", bankcode);
            paramData.Add("@clientIp", userIP);
            paramData.Add("@from", "5");
            paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output);
            PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "AccountRechargeInit", ref paramData, CommandType.StoredProcedure);
            outStatus = paramData.Get <int>("@outStatus");

            int result = outStatus;

            if (result > 0)
            {
                lock (lockstatus)
                {
                    if (UpdateAccountRechare(5, orderNo) <= 0)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,您的提交失败请重试!','1','确定');</script>");
                        return;
                    }

                    Response.Redirect("/PaymentPlatform/lianlian/plainPay.aspx?orderno=" + orderNo + "&totalprice=" + Amount + "&bankcode=" + bankcode);
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,您的提交失败请重试!','1','确定');</script>");
            }
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Guid userid = WebUserAuth.UserId.Value;
            //if (GetBankInfo(userid, 2) == 1)
            //{
            //    //if (bankmodel.Status==2)
            //    //{
            //    //Response.Write("您好,银行卡在审核中不允许充值!");
            //    ClientScript.RegisterStartupScript(this.GetType(), "ss",
            //        "<script>ShowMsg('您好,银行卡在审核中不允许充值!','1','确定');</script>");
            //    return;
            //    //}
            //}
            decimal Amount    = Tool.SafeConvert.ToDecimal(Request.Params["Amount"], 0);
            decimal tmpAmount = Math.Floor(Amount * 100) / 100;

            if (tmpAmount != Amount)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('充值金额最多只能2位小数,如106.32!','1','确定');</script>");
                return;
            }
            TuanDai.PortalSystem.Model.WebSettingInfo rechargeSet =
                new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA");
            decimal minRecharge = decimal.Parse(rechargeSet.Param1Value);

            if (Amount < minRecharge)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('单次充值最少" + minRecharge.ToString("N2") + "元!','1','确定');</script>");
                return;
            }
            if (Amount > 500000)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('单次充值不能超过50万!','1','确定');</script>");
                return;
            }

            var cgtMode = new QueryClient().GetUserByPlatformUserNo(userid);

            if (cgtMode == null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('存管通未开通,不能进行充值!','1','确定');</script>");
                return;
            }
            if (!cgtMode.isActivate)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('存管通未激活,不能进行充值!','1','确定');</script>");
                return;
            }

            NoHandler noHandler = new NoHandler();
            string    orderNo   = noHandler.OnLineRechare();

            if (orderNo == "0")
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('您好,您的提交失败请重试!','1','确定');</script>");
                return;
            }

            string err        = string.Empty;
            bool   isRecharge = new CgtCheckBLL().GetUserCgtIsOper(userid, "recharge", ref err);

            if (!isRecharge)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "ss",
                                                   "<script>ShowMsg('" + err + "','1','确定');</script>");
                return;
            }
            //获取银行卡号
            string bankNo  = Request["bankno"];
            string outCode = string.Empty;

            if (!string.IsNullOrEmpty(bankNo))
            {
                try
                {
                    bankNo = Tool.DESC.Decrypt(bankNo);
                }
                catch (Exception)
                {
                    bankNo = null;
                }
            }

            BankFromJavaService bankJavaService = new BankFromJavaService();

            if (GlobalUtils.IsBankService)
            {
                var bankInfoFromJava = bankJavaService.GetBankInfo(userid, ServiceType.NotTuomin);
                if (bankInfoFromJava != null && bankInfoFromJava.respData != null)
                {
                    bankNo  = bankInfoFromJava.respData.bankNo;
                    outCode = bankInfoFromJava.respData.bankCode;
                }
            }
            else
            {
                var userInfo = new PortalSystem.BLL.UserBLL().GetUserBasicInfoModelById(userid);
                if (userInfo == null || string.IsNullOrEmpty(userInfo.BankAccountNo))
                {
                    var bankInfo = GlobalUtils.GetBankInfo(userid);
                    bankNo = bankInfo.BankNo;
                }
                else
                {
                    bankNo = userInfo.BankAccountNo;
                }
            }

            string userIP = Tool.WebFormHandler.GetIP();

            if (!GlobalUtils.IsBankService)
            {
                var sss = TuanDai.Payment.Client.BankInfo.GetPayBankInfo(userid);

                TuanDai.Payment.Models.PayRoute.RouteInfo bank = new TuanDai.Payment.Client.Recharge().GetCgtRechargeInfo(userid, sss.BankNo);
                int Sel = bank.Sel;

                int    outStatus = 0;
                string bankcode  = "";
                if (Request.Params["bankcode"] != null)
                {
                    bankcode = Request.Params["bankcode"];
                }


                var paramData = new Dapper.DynamicParameters();
                paramData.Add("@userid", userid);
                paramData.Add("@type", Sel);
                paramData.Add("@amount", Amount);
                paramData.Add("@orderNo", orderNo);
                paramData.Add("@backcode", bankcode);
                paramData.Add("@clientIp", userIP);
                paramData.Add("@from", "5");
                if (bank.RouteId.IsEmpty())
                {
                    paramData.Add("@RouteId", null);
                }
                else
                {
                    paramData.Add("@RouteId", bank.RouteId);
                }
                paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output);
                paramData.Add("@cmorderNo", "");
                PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "p_cgt_AccountRechargeInit", ref paramData, CommandType.StoredProcedure);
                outStatus = paramData.Get <int>("@outStatus");

                int result = outStatus;
                if (result > 0)
                {
                    lock (lockstatus)
                    {
                        var isCallBackPayment =
                            System.Configuration.ConfigurationManager.AppSettings["IsCallBackPayment"];
                        var    paymentUrl  = System.Configuration.ConfigurationManager.AppSettings["PaymentUrl"];
                        string callBackUrl = paymentUrl + "/PaymentPlatform/H5/commonCallBack.aspx";
                        if (isCallBackPayment == "0")
                        {
                            callBackUrl = CgtCallBackConfig.GetCgtCallBackUrl(CgtCallBackConfig.CgtCallBackType.Recharge);
                        }
                        var recharInfo = new Payment.Client.Recharge().GetCgtRechargeInfo(userid, bankNo);
                        var url        = CunGuanTong.Client.FundClient.RECHARGE_Req(new CunGuanTong.Model.RECHARGE_Request
                        {
                            rechargeWay      = rechargeWay.SWIFT,
                            requestNo        = orderNo,
                            amount           = Amount,
                            bankcode         = recharInfo.OutCode,
                            callbackMode     = "DIRECT_CALLBACK",
                            platformUserNo   = userid.ToString(),
                            expectPayCompany = recharInfo.CgtPayCompany,
                            //callbackUrl = CgtCallBackConfig.GetCgtCallBackUrl(CgtCallBackConfig.CgtCallBackType.Recharge),
                            callbackUrl = callBackUrl,
                            userDevice  = CunGuanTong.Model.userDevice.MOBILE
                        });

                        if (string.IsNullOrEmpty(url))
                        {
                            if (Request.UrlReferrer != null)
                            {
                                url = Request.UrlReferrer.ToString();
                            }
                            else
                            {
                                url = GlobalUtils.WebURL;
                            }
                        }
                        Response.Redirect(url);
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "ss", "<script>ShowMsg('您好,充值提交失败请重试!','1','确定');</script>");
                }
            }
            else
            {  //走Java银行卡服务
                string retUrl = bankJavaService.GetCgtRechargeUrl(userid, bankNo, Amount, userIP, outCode);
                if (!string.IsNullOrEmpty(retUrl))
                {
                    Response.Redirect(retUrl);
                }
            }
        }
Esempio n. 8
0
        public void GetWXJsApiParam()
        {
            string strOpenId = GlobalUtils.OpenId;

            if (strOpenId.IsEmpty())
            {
                PrintJson("-1", "微信未授权,取不到OpenId值");
                return;
            }
            Guid?userId = WebUserAuth.UserId;

            if (userId == null || userId == Guid.Empty)
            {
                PrintJson("-1", "对不起,您还未登录!");
                return;
            }
            decimal Amount = Tool.SafeConvert.ToDecimal(WEBRequest.GetQueryString("Amount"), 0);

            WebSettingInfo rechargeSet       = new TuanDai.PortalSystem.DAL.WebSettingDAL().GetWebSettingInfo("9A89CBAE-6550-4EA1-8224-EB645F38F8FA");
            decimal        MinRechargeAmount = decimal.Parse(rechargeSet.Param1Value);

            if (Amount < MinRechargeAmount)
            {
                PrintJson("-1", "最低充值金额为" + MinRechargeAmount.ToString("N2") + "元!");
                return;
            }
            if (Amount > 500000)
            {
                PrintJson("-1", "单次充值不能超过50万!");
                return;
            }


            NoHandler noHandler = new NoHandler();
            string    orderNo   = noHandler.OnLineRechare();

            if (orderNo == "0")
            {
                PrintJson("-1", "您好,您的提交失败请重试!");
                return;
            }

            int    Sel        = 9; //标记是微信支付
            Guid   rechargeId = Guid.NewGuid();
            int    outStatus  = 0;
            string bankcode   = "";
            string userIP     = Tool.WebFormHandler.GetIP();

            DynamicParameters paramData = new DynamicParameters();

            paramData.Add("@userid", userId);
            paramData.Add("@type", Sel);
            paramData.Add("@amount", Amount);
            paramData.Add("@orderNo", orderNo);
            paramData.Add("@backcode", bankcode);
            paramData.Add("@clientIp", userIP);
            paramData.Add("@from", "5");
            paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output);

            PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "AccountRechargeInit", ref paramData, System.Data.CommandType.StoredProcedure);
            outStatus = paramData.Get <int>("@outStatus");

            int result = outStatus;

            if (result > 0)
            {
                TuanDai.Payment.PaymentBLL jsApiPay           = new TuanDai.Payment.PaymentBLL("JSAPI", strOpenId, orderNo, userModel.RealName, userModel.IdentityCard);
                TuanDai.Payment.WxPayData  unifiedOrderResult = null;
                try
                {
                    int PayAmount = int.Parse(double.Parse((Amount * 100).ToString()).ToString());

                    unifiedOrderResult = jsApiPay.WXJsApiUnifiedOrder(PayAmount.ToString());
                }
                catch (Exception ex)
                {
                    PrintJson("-1", ex.Message);
                    return;
                }
                wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数
                PrintJson("1", "");
            }
            else
            {
                PrintJson("-1", "您好,您的提交失败请重试!");
                return;
            }
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Guid userid = WebUserAuth.UserId.Value;

            decimal Amount = Tool.SafeConvert.ToDecimal(Request.Params["Amount"], 0);

            //if (Amount < 100)
            //{
            //    Response.Write("您好,充值金额必须大于或者等于100!");
            //    return;
            //}

            if (Amount > 5000000)
            {
                Response.Write("单次充值不能超过500万!");
                return;
            }


            NoHandler noHandler = new NoHandler();
            string    orderNo   = noHandler.OnLineRechare();

            if (orderNo == "0")
            {
                Response.Write("您好,您的提交失败请重试!");
                return;
            }

            int  Sel        = Tool.SafeConvert.ToInt32(Request.Params["Sel"], 12);
            Guid rechargeId = Guid.NewGuid();
            int  outStatus  = 0;

            //string bankcode = "";
            //bankcode = Request.Params["bankcode"];
            ////if (Request.Params["bankcode"] != null)
            ////{

            ////}

            //if (string.IsNullOrEmpty(bankcode))
            //{
            //    Response.Write("您好,银行编号获取错误!" + Request.QueryString["bankcode"]);
            //    return;
            //}

            string userIP = Tool.WebFormHandler.GetIP();

            var paramData = new Dapper.DynamicParameters();

            paramData.Add("@userid", userid);
            paramData.Add("@type", Sel);
            paramData.Add("@amount", Amount);
            paramData.Add("@orderNo", orderNo);
            paramData.Add("@backcode", "");
            paramData.Add("@clientIp", userIP);
            paramData.Add("@from", "5");
            paramData.Add("@outStatus", 0, System.Data.DbType.Int32, System.Data.ParameterDirection.Output);
            TuanDai.WXApiWeb.PublicConn.ExecuteTD(PublicConn.DBWriteType.FundWrite, "AccountRechargeInit",
                                                  ref paramData, CommandType.StoredProcedure);
            outStatus = paramData.Get <int>("@outStatus");

            int result = outStatus;

            //NetLog.WriteLoginHandler("宝付5-调用写入充值记录存储过AccountRechargeInit", "UserId:"+userid+",Sel:"+Sel+",Amount:"+Amount+",OrderNo:"+orderNo+",bankcode:"+bankcode+",OutStatus:"+outStatus.Value.ToString());
            if (result > 0)
            {
                //NetLog.WriteLoginHandler("宝付6","进入写入来源" );
                AccountRechareInfo ar = null;
                lock (lockstatus)
                {
                    ar = getAccountRechare(orderNo);
                }
                //1:PC
                if (null == ar)
                {
                    Response.Write("您好,您的提交失败请重试!");
                }

                ar.From = 5;
                //ar.CradNo = db.UserBasicInfo.FirstOrDefault(x => x.Id == userid).BankAccountNo;

                if (UpdateAccountRechare(ar) <= 0)
                {
                    Response.Write("您好,您的提交失败请重试!");
                    return;
                }

                //NetLog.WriteLoginHandler("宝付7", "进入跳转");
                var url = "/PaymentPlatform/Baofu/pay_post.aspx?orderno=" + orderNo + "&totalprice=" + Amount + "&PayID=";
                //NetLog.WriteLoginHandler("宝付8--跳转的URL", url);
                try
                {
                    Response.Redirect(url, false);
                }
                catch (Exception ex)
                {
                    SysLogHelper.WriteErrorLog("宝付9跳转错误", "错误详细信息:" + ex.Message + "|" + ex.StackTrace);
                }
            }
            else
            {
                Response.Write("您好,您的提交失败请重试!");
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 提交发标请求.
        /// </summary>
        public void Submit()
        {
            PrintJson("-1", "触屏版不支持发资产标,请前往PC或APP");
            return;

            //将用户提交的请求信息转换成视图模型.
            var model = WXInvest.ConvertTo <ProjectViewModel>(HttpContext.Current.Request, HttpMethod.POST);

            if (model.Unit > 1000)
            {
                this.PrintJson("-1", "最小单位不能大于1000");
            }
            if (model.InterestRate.HasValue)
            {
                int totalLength = model.InterestRate.ToString().Length;                                                                 //总长度
                int floatLength = totalLength - 1 - Math.Floor(model.InterestRate.Value).ToString().Length;                             //小数位数
                int dataLength  = int.Parse(new WebSettingBLL().GetWebSettingInfo("3F902315-6986-44FF-9F00-9D420C07FCDA").Param1Value); //数据库配置位数
                if (floatLength > dataLength)
                {
                    this.PrintJson("-1", "利率的小数位数不能超过" + dataLength + "位");
                }
            }

            if (model.Repayment != 1 && model.Repayment != 2)
            {
                this.PrintJson("-1", "还款方式不对");
            }
            string  PayPwd = Tool.Encryption.MD5(Context.Request["PayPwd"]);
            decimal rate   = decimal.Parse(Context.Request["rate"]);

            //校验用户信息.
            var userId  = WebUserAuth.UserId.Value;
            var userbll = new UserBLL();
            var user    = userbll.GetUserBasicInfoModelById(userId);

            if (user == null)
            {
                this.PrintJson("-2", "用户不存在");
            }

            if (string.IsNullOrEmpty(user.PayPwd) || user.PayPwd == user.Pwd)
            {
                this.PrintJson("-4", "请先到安全中心设置交易密码");
            }

            //DB.UserSetting usersetting = db.UserSettings.FirstOrDefault(p=>p.UserId==userId);
            //modify by ShellBen 2015-12-26
            UserSettingDAL  usDal       = new UserSettingDAL();
            UserSettingInfo usersetting = usDal.GetUserSettingInfo(userId);

            if (usersetting != null)
            {
                if (usersetting.PayPwdErrorDate.HasValue)
                {
                    DateTime date1 = Convert.ToDateTime(usersetting.PayPwdErrorDate.Value.ToString("yyyy/MM/dd"));
                    DateTime date2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd"));
                    if (date1 == date2 && usersetting.PayPwdErrorCount >= 5)
                    {
                        this.PrintJson("-5", "交易密码已错误5次,请24小时后再进行此操作");
                    }
                    if (date1 != date2 && usersetting.PayPwdErrorCount > 1)
                    {
                        usersetting.PayPwdErrorCount = 0;
                        usersetting.PayPwdErrorDate  = null;
                    }
                }
            }
            else
            {
                //usersetting = new DB.UserSetting();
                usersetting        = new UserSettingInfo();
                usersetting.Id     = Guid.NewGuid();
                usersetting.UserId = userId;
                usersetting.IsTenderNeedPayPassword = false;
                usersetting.IsAllowChangePwd        = true;
                usersetting.PayPwdErrorCount        = 0;
                usersetting.PayPwdErrorDate         = null;
                //db.UserSettings.AddObject(usersetting);
                //db.SaveChanges();
                usDal.AddUserSettingInfo(usersetting);
            }

            if (user.PayPwd != PayPwd)
            {
                //记录登录错误次数
                if (usersetting.PayPwdErrorCount == null)
                {
                    usersetting.PayPwdErrorCount = 0;
                }
                usersetting.PayPwdErrorCount += 1;
                usersetting.PayPwdErrorDate   = DateTime.Now;
                //db.SaveChanges();
                usDal.UpdateUserSettingInfo(usersetting);
                if (usersetting.PayPwdErrorCount >= 5)
                {
                    this.PrintJson("-6", "今日交易密码已错误5次,请24小时后再进行此操作!");
                }
                else
                {
                    this.PrintJson("-7", "交易密码错误,今日还有" + (5 - usersetting.PayPwdErrorCount) + "次机会,错误5次将锁定24小时!");
                }
                return;
            }
            else
            {
                //清除错误记录
                usersetting.PayPwdErrorCount = 0;
                usersetting.PayPwdErrorDate  = null;
                //db.SaveChanges();
                usDal.UpdateUserSettingInfo(usersetting);
            }

            //校验项目信息.
            var result = WXInvest.CheckProjectInfo(model, user);

            if (!result.Success)
            {
                this.PrintJson(result.Code.ToString(), result.Message);
            }

            //生成项目流水号.
            var handler   = new NoHandler();
            var projectNo = handler.ProjectNo();

            if (projectNo == "0")
            {
                this.PrintJson("-3", "项目流水号生成出错");
            }

            //保存项目信息.
            var setting = result.GetParameter <WebSettingInfo>("Setting");

            result = result + WXInvest.SaveProject(model, user, setting, projectNo, rate);
            if (!result.Success)
            {
                this.PrintJson(result.Code.ToString(), result.Message);
            }

            this.PrintJson("1", "提交成功");
        }