public void request_generation()
        {
            const string expected = @"
                <CRMMessage language=""en_US"" currency=""DKK"">
                  <RequestSource name=""acme.com"" version=""1"" />
                  <RequestCode>GetCustomer</RequestCode>
                  <QueryCriteria conditions=""primaryposref = ?"">
                    <Condition name=""primaryposref"" value=""123"" />
                  </QueryCriteria>
                  <ResultSetDefinition>
                    <Column>firstname</Column>
                    <Column>lastname</Column>
                  </ResultSetDefinition>
                </CRMMessage>";

            var request = new GetCustomerRequest(
                "acme.com",
                "primaryposref = ?",
                new[] { new ColumnValue("primaryposref", "123") },
                new[]
            {
                new Column("firstname"),
                new Column("lastname")
            });

            var requestXml = request.BuildRequestDocument();

            Assert.Equal(XE.Parse(expected).ToString(), requestXml.ToString());
        }
Esempio n. 2
0
        public async Task <GetCustomerResponse> GetCustomerAsync(string condition, ColumnValue[] columnValues, Column[] columns, CancellationToken cancellationToken = default)
        {
            try
            {
                var request     = new GetCustomerRequest(_options.CustomerRelationshipManagementOperations.RequestSourceName, condition, columnValues, columns);
                var requestXml  = request.BuildRequestDocument();
                var responseXml = await _executor.ExecuteAsync(requestXml, cancellationToken);

                return(new GetCustomerResponse(requestXml, responseXml));
            }
            catch (OracleHospitalityClientException)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new OracleHospitalityClientException($"{RequestCode.Kind.GetCustomer} operation failed", e);
            }
        }