public void Send()
    {
        State state = new State();

        using (IBus bus = StartBus(state))
        {
            Dictionary <string, object> headers = new Dictionary <string, object>
            {
                { "NServiceBus.EnclosedMessageTypes", "Operations.RabbitMQ.NativeSendTests+MessageToSend" }
            };
            NativeSend.SendMessage(Environment.MachineName, endpointName, "admin", "password", @"{""Property"": ""Value"",}", headers);
            state.ResetEvent.WaitOne();
        }
    }
    public async Task Send()
    {
        var endpointInstance = await StartBus()
                               .ConfigureAwait(false);

        Dictionary <string, object> headers = new Dictionary <string, object>
        {
            { "NServiceBus.EnclosedMessageTypes", "NativeSendTests+MessageToSend" }
        };

        NativeSend.SendMessage("localhost", endpointName, "guest", "guest", @"{""Property"": ""Value"",}", headers);
        await tcs.Task.ConfigureAwait(false);

        await endpointInstance.Stop()
        .ConfigureAwait(false);
    }
Exemplo n.º 3
0
    public void Send()
    {
        State state = new State();

        using (IBus bus = StartBus(state))
        {
            string message = @"{ Property: 'Value' }";

            Dictionary <string, string> headers = new Dictionary <string, string>
            {
                { "NServiceBus.EnclosedMessageTypes", "Operations.SqlServer.NativeSendTests+MessageToSend" }
            };

            NativeSend.SendMessage(connectionString, endpointName, message, headers);
            state.ResetEvent.WaitOne();
        }
    }
    public async Task Send()
    {
        var state = new State();

        using (var bus = StartBus(state))
        {
            var message = @"{ Property: 'Value' }";

            var headers = new Dictionary <string, string>
            {
                { "NServiceBus.EnclosedMessageTypes", "Operations.SqlServer.NativeSendTests+MessageToSend" }
            };

            await NativeSend.SendMessage(connectionString, endpointName, message, headers)
            .ConfigureAwait(false);

            state.ResetEvent.WaitOne();
        }
    }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                TravelAgent.Model.WebInfo webinfo = new TravelAgent.BLL.WebInfo().loadConfig(Server.MapPath(ConfigurationManager.AppSettings["WebInfoConfig"].ToString()));
                if (webinfo != null)
                {
                    appid      = webinfo.AppID;
                    mch_id     = webinfo.Mchid;
                    key        = webinfo.Key;
                    notify_url = webinfo.WebDomain + "/wxpay/notify_url.aspx";
                }
                //Utils.WriteTxt(appid+"-"+mch_id+"-"+key+"-"+notify_url);
                var  nr    = new NativeReceive();
                var  ns    = new NativeSend();
                bool valid = nr.ValidSign(nr, key);
                //Utils.WriteTxt("验证"+valid.ToString());
                if (valid)
                {
                    TravelAgent.Model.Order order = orderBll.GetModelByCode(nr.product_id);
                    if (order == null)
                    {
                        return;
                    }

                    //object r = TravelAgent.WxPay.AccessDbHelper.GetOScalar("select [order_price] from   [wx_order]   where [order_no]='" + nr.product_id + "'");

                    //if (r == null)
                    //{
                    //   // Response.Write("用户名或密码错误");
                    //  //  Response.End();
                    //    return;
                    //}
                    float order_price;
                    order_price = wxpay.Utils.StrToFloat(((order.orderPrice + order.attachPrice + order.subPrice - order.usePoints)).ToString(), 0) * 100;//积分1分兑换1元

                    UnifyEntities ue = new UnifyEntities
                    {
                        appid            = appid,
                        body             = getOrderName(order.lineId, order.orderType),
                        mch_id           = mch_id,
                        nonce_str        = TravelAgent.WxPay.Utils.GetRandom(),
                        notify_url       = notify_url,
                        out_trade_no     = nr.product_id,
                        product_id       = nr.product_id,
                        spbill_create_ip = JKRequest.GetIP(),
                        trade_type       = "NATIVE",
                        total_fee        = order_price.ToString()
                    };
                    string url, sign;
                    string xml = TravelAgent.WxPay.Utils.GetUnifyUrlXml <UnifyEntities>(ue, key, out url, out sign);

                    //Utils.WriteTxt(xml);

                    string       data         = Utils.HttpPost("https://api.mch.weixin.qq.com/pay/unifiedorder", xml);
                    UnifyReceive unifyReceive = new UnifyReceive(data);


                    NativeSend nc = new NativeSend()
                    {
                        appid       = appid,
                        mch_id      = mch_id,
                        nonce_str   = TravelAgent.WxPay.Utils.GetRandom(),
                        prepay_id   = unifyReceive.prepay_id,
                        result_code = "SUCCESS",
                        return_code = "SUCCESS",
                    };
                    string url1, sign1;
                    string xml1 = TravelAgent.WxPay.Utils.GetUnifyUrlXml <NativeSend>(nc, key, out url1, out sign1);
                    Utils.WriteTxt(xml1);
                    Response.Write(xml1);
                }
                else
                {
                    Utils.WriteTxt("签名验证失败");
                    NativeSend nc = new NativeSend()
                    {
                        return_code = "FAIL",
                        return_msg  = "签名验证失败"
                    };
                }
            }
            catch (Exception ee)
            {
                Utils.WriteTxt(ee.ToString());
            }
        }