コード例 #1
0
        private String SendEvent()
        {
            if (_loginResponse == null || _loginResponse.StatusCode != 201)
            {
                _loginResponse = _client.Login(txtUsername.Text, txtPassword.Text);
            }

            var products = txtProducts.Text.Split(',');
            var index = new Random().Next(0, products.Length);
            var product = products[index];
            var count = new Random().Next(100);
            var price = new Random().NextDouble();
            var delivered = new Random().Next(100) > 50;
            var value = new Product(product, count, price, delivered);

            var @event = new Event(txtChannel.Text, value);

            var response = _client.SendEvent(@event, _loginResponse.Cookies);

            var responseText = String.Format("Status: {0} {1}\n Event:\n{2}",
                                                response.StatusCode, response.StatusDescription, @event);

            return responseText;
        }
コード例 #2
0
ファイル: Client.cs プロジェクト: EventFabric/dotnet-api
 public Response SendEvent(Event @event, CookieCollection cookie)
 {
     var req = CreateWebRequest(EventPath, cookie);
     var eventJson = Utils.SerializeFromTToJson(@event);
     return QueryWebRequest(req, eventJson);
 }