private static ExigoContext GetNewODataContext(ExigoApiContextSource source)
        {
            var sourceUrl = "";

            switch (source)
            {
            case ExigoApiContextSource.Live:
                sourceUrl = GlobalSettings.ExigoApiSettings.OData.LiveUrl;
                break;

            case ExigoApiContextSource.Sandbox1:
                sourceUrl = GlobalSettings.ExigoApiSettings.OData.Sandbox1Url;
                break;

            case ExigoApiContextSource.Sandbox2:
                sourceUrl = GlobalSettings.ExigoApiSettings.OData.Sandbox2Url;
                break;

            case ExigoApiContextSource.Sandbox3:
                sourceUrl = GlobalSettings.ExigoApiSettings.OData.Sandbox3Url;
                break;
            }

            var context = new ExigoContext(new Uri(sourceUrl + "/model"));

            context.IgnoreMissingProperties         = true;
            context.IgnoreResourceNotFoundException = true;
            var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(LoginName + ":" + Password));

            context.SendingRequest +=
                (object s, SendingRequestEventArgs e) =>
                e.RequestHeaders.Add("Authorization", "Basic " + credentials);
            return(context);
        }
 public static ExigoContext CreateODataContext()
 {
     var context = new ExigoContext(new Uri("http://api.exigo.com/4.0/" + Company + "/model"));
     context.IgnoreMissingProperties = true;
     context.IgnoreResourceNotFoundException = true;
     var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(LoginName + ":" + Password));
     context.SendingRequest +=
         (object s, SendingRequestEventArgs e) =>
             e.RequestHeaders.Add("Authorization", "Basic " + credentials);
     return context;
 }
Пример #3
0
        public ExigoContext GetContext()
        {
            var context = new ExigoContext(new Uri(ApiSettings.ODataUrl));

            context.IgnoreMissingProperties         = true;
            context.IgnoreResourceNotFoundException = true;
            var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(ApiSettings.LoginName + ":" + ApiSettings.Password));

            context.SendingRequest +=
                (object s, SendingRequestEventArgs e) =>
                e.RequestHeaders.Add("Authorization", "Basic " + credentials);
            return(context);
        }
 public void client()
 {
     var request = new ExigoContext(new Uri("http://api.exigo.com/4.0/" + "strongbrook" + "/report"));
     request.IgnoreMissingProperties = true;
     request.IgnoreResourceNotFoundException = true;
     var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(LoginName + ":" + Password));
     request.SendingRequest +=
         (object s, SendingRequestEventArgs e) =>
             e.RequestHeaders.Add("Authorization", "Basic " + credentials);
     var response = request;
 }