Пример #1
0
 private static Response TestUpdate(DataClient client, DataRecord record)
 {
     var payload = client.BuildPayload("TestUser", new List<object> { record.Values[0], "John Doe", "America", "1989-02-28", false, 23, 135.79, DateTime.Now });
     var request = client.BuildRequest(payload, "update", "1234", "user1");
     var response = client.Send(request);
     return response.Result;
 }
Пример #2
0
 private static Response TestAdd(DataClient client)
 {
     var payload = client.BuildPayload("TestUser", new List<object> {Guid.Empty, "Jane Citizen", "Australia", "1985-01-23", true, 12, 345.678, DateTime.Now});
     var request = client.BuildRequest(payload, "add", "1234", "user1");
     var response = client.Send(request);
     return response.Result;
 }
Пример #3
0
        static void Main(string[] args)
        {
            var client = new DataClient(new Uri("http://*****:*****@"{0}\ClientConfig.xml", AppDomain.CurrentDomain.BaseDirectory));
            var pulse = client.Pulse();
            if (pulse.Result != null)
            {
                Console.WriteLine("service status: {0}", pulse.Result.Status);
                var response = TestAdd(client);
                if (response != null)
                {
                    OutputResponse(response);

                    //expecting Id
                    var records = response.Payload.Data.Records;
                    if (records.Any())
                    {
                        Console.WriteLine("record created, press enter to update the record");
                        Console.ReadLine();
                        response = TestUpdate(client, records.First());
                        OutputResponse(response);
                    }
                    Console.WriteLine("record updated");
                }
                else
                    Console.WriteLine("oops");
            }
            else
                Console.WriteLine("service down");
            Console.Read();
        }
Пример #4
0
        static void Main(string[] args)
        {
            var client = new DataClient(new Uri("http://*****:*****@"{0}\ClientConfig.xml", AppDomain.CurrentDomain.BaseDirectory));
            var response = TestAdd(client);
            if (response != null)
            {
                OutputResponse(response);

                //expecting Id
                var records = response.Payload.Data.Records;
                if (records.Any())
                {
                    response = TestUpdate(client, records.First());
                    OutputResponse(response);
                }
                Console.WriteLine("done");
            }
            else
                Console.WriteLine("oops");
            Console.Read();
        }