示例#1
0
        public static RestServiceClientBase GetRestClient(string type)
        {
            RestServiceClientBase restClient = null;

            switch (type)
            {
            case "OrganizationRestClient":
                restClient = new OrganizationRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            case "PaymentReportsRestClient":
                restClient = new PaymentReportsRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            case "OrdersRestClient":
                restClient = new OrdersRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            case "ReportsRestClient":
                restClient = new ReportsRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            case "ContractsRestClient":
                restClient = new ContractsRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            case "PaymentsRestClient":
                restClient = new PaymentsRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            case "UserRestClient":
                restClient = new UserRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            case "ReferencesRestClient":
                restClient = new ReferencesRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            case "SiteRestClient":
                restClient = new SiteRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            case "OrdersDocumentsRestClient":
                restClient = new OrdersDocumentsRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            case "FlightsRestClient":
                restClient = new FlightsRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            case "SystemRestClient":
                restClient = new SystemRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);
                break;

            default:
                throw new Exception("RestClient type was set incorrectly.");
            }
            restClient.ImpersonationToken = new ImpersonationToken(Config.UserLogin, Config.UserPassword);
            return(restClient);
        }
示例#2
0
        private ReferencesRestClient CreateRestClient()
        {
            var restClient = new ReferencesRestClient(Config.Url, Config.SiteSlug, Config.ApiKey);

            restClient.ImpersonationToken = new ImpersonationToken(Config.UserLogin, Config.UserPassword);

            return(restClient);
        }
示例#3
0
        public void CreateOutInvoice()
        {
            ReferencesRestClient restClient = CreateRestClient();

            List <ServiceType> serviceTypes = restClient.GetServiceTypes();

            Assert.NotNull(serviceTypes);

            foreach (var serviceType in serviceTypes)
            {
                Trace.WriteLine(String.Format("На сервере действует услуга '{1}' с кодом '{0}'.", serviceType.Code, serviceType.Name));
            }
        }
示例#4
0
        public static List <TicketMan.Platform.Api.Shared.Protocol.ObjectModel.ServiceType> GetServiceTypes()
        {
            ReferencesRestClient restClient = (ReferencesRestClient)GetRestClient("ReferencesRestClient");

            return(restClient.GetServiceTypes());
        }