/// <summary>Snippet for ListCatalogItems</summary>
        public void ListCatalogItemsRequestObject()
        {
            // Snippet: ListCatalogItems(ListCatalogItemsRequest, CallSettings)
            // Create client
            CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
            // Initialize request argument(s)
            ListCatalogItemsRequest request = new ListCatalogItemsRequest
            {
                ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
                Filter = "",
            };
            // Make the request
            PagedEnumerable <ListCatalogItemsResponse, CatalogItem> response = catalogServiceClient.ListCatalogItems(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (CatalogItem item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListCatalogItemsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (CatalogItem item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <CatalogItem> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (CatalogItem item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        public void SetDefaultBranchResourceNames()
        {
            moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict);
            SetDefaultBranchRequest request = new SetDefaultBranchRequest
            {
                CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.SetDefaultBranch(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CatalogServiceClient client = new CatalogServiceClientImpl(mockGrpcClient.Object, null);

            client.SetDefaultBranch(request.CatalogAsCatalogName);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for SetDefaultBranch</summary>
        public void SetDefaultBranchRequestObject()
        {
            // Snippet: SetDefaultBranch(SetDefaultBranchRequest, CallSettings)
            // Create client
            CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
            // Initialize request argument(s)
            SetDefaultBranchRequest request = new SetDefaultBranchRequest
            {
                CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
                BranchIdAsBranchName = BranchName.FromProjectLocationCatalogBranch("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"),
                Note = "",
            };

            // Make the request
            catalogServiceClient.SetDefaultBranch(request);
            // End snippet
        }
        /// <summary>Snippet for GetDefaultBranchAsync</summary>
        public async Task GetDefaultBranchRequestObjectAsync()
        {
            // Snippet: GetDefaultBranchAsync(GetDefaultBranchRequest, CallSettings)
            // Additional: GetDefaultBranchAsync(GetDefaultBranchRequest, CancellationToken)
            // Create client
            CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetDefaultBranchRequest request = new GetDefaultBranchRequest
            {
                CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
            };
            // Make the request
            GetDefaultBranchResponse response = await catalogServiceClient.GetDefaultBranchAsync(request);

            // End snippet
        }
Ejemplo n.º 5
0
        public Product Product()
        {
            var catalogName = new CatalogName("Тестовое наименование");
            var catalogForm = new CatalogForm("Тестовая форма выпуска");
            var catalog     = new Catalog {
                Name = "Тестовый продукт"
            };
            var product = new Product(catalog);

            session.Save(catalogForm);
            session.Save(catalogName);
            catalog.NameId = catalogName.Id;
            catalog.FormId = catalogForm.Id;
            session.Save(catalog);
            session.Save(product);
            return(product);
        }
Ejemplo n.º 6
0
        public RelationalDatabaseDataSet FindTablesBy(CatalogName catalog, TableName[] tableNameCollection)
        {
            RelationalDatabaseDataSet ds = new RelationalDatabaseDataSet();

            ds.EnforceConstraints = false;

            Dsl.ConnectToMsSqlServer()
            .UsingThisConnectionString(_connection.ConnectionString)
            .ForThisCatalog(catalog.Name)
            .SelectAllColumns()
            .From(TableStatements.From)
            .Where("TABLE_NAME").In(TableName.ToArray(tableNameCollection))
            .Adapt().UsingThisMapping(BuildTableMapping(ds))
            .FillDataset(ds);

            return(ds);
        }
Ejemplo n.º 7
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                hashcode = (hashcode * 397) + SessionHandle.GetHashCode();
                if (__isset.catalogName)
                {
                    hashcode = (hashcode * 397) + CatalogName.GetHashCode();
                }
                if (__isset.schemaName)
                {
                    hashcode = (hashcode * 397) + SchemaName.GetHashCode();
                }
            }
            return(hashcode);
        }
        /// <summary>Snippet for ListCatalogItems</summary>
        public async Task ListCatalogItemsResourceNamesAsync()
        {
            // Snippet: ListCatalogItemsAsync(CatalogName, string, string, int?, CallSettings)
            // Create client
            CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();

            // Initialize request argument(s)
            CatalogName parent = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]");
            string      filter = "";
            // Make the request
            PagedAsyncEnumerable <ListCatalogItemsResponse, CatalogItem> response = catalogServiceClient.ListCatalogItemsAsync(parent, filter);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((CatalogItem item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListCatalogItemsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (CatalogItem item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <CatalogItem> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (CatalogItem item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        /// <summary>Snippet for CreateCatalogItemAsync</summary>
        public async Task CreateCatalogItemRequestObjectAsync()
        {
            // Snippet: CreateCatalogItemAsync(CreateCatalogItemRequest, CallSettings)
            // Additional: CreateCatalogItemAsync(CreateCatalogItemRequest, CancellationToken)
            // Create client
            CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateCatalogItemRequest request = new CreateCatalogItemRequest
            {
                ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
                CatalogItem         = new CatalogItem(),
            };
            // Make the request
            CatalogItem response = await catalogServiceClient.CreateCatalogItemAsync(request);

            // End snippet
        }
        public async stt::Task SetDefaultBranchResourceNamesAsync()
        {
            moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict);
            SetDefaultBranchRequest request = new SetDefaultBranchRequest
            {
                CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.SetDefaultBranchAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CatalogServiceClient client = new CatalogServiceClientImpl(mockGrpcClient.Object, null);
            await client.SetDefaultBranchAsync(request.CatalogAsCatalogName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.SetDefaultBranchAsync(request.CatalogAsCatalogName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for SetDefaultBranchAsync</summary>
        public async Task SetDefaultBranchRequestObjectAsync()
        {
            // Snippet: SetDefaultBranchAsync(SetDefaultBranchRequest, CallSettings)
            // Additional: SetDefaultBranchAsync(SetDefaultBranchRequest, CancellationToken)
            // Create client
            CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();

            // Initialize request argument(s)
            SetDefaultBranchRequest request = new SetDefaultBranchRequest
            {
                CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
                BranchIdAsBranchName = BranchName.FromProjectLocationCatalogBranch("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"),
                Note = "",
            };
            // Make the request
            await catalogServiceClient.SetDefaultBranchAsync(request);

            // End snippet
        }
 /// <summary>Snippet for CompleteQuery</summary>
 public void CompleteQueryRequestObject()
 {
     // Snippet: CompleteQuery(CompleteQueryRequest, CallSettings)
     // Create client
     CompletionServiceClient completionServiceClient = CompletionServiceClient.Create();
     // Initialize request argument(s)
     CompleteQueryRequest request = new CompleteQueryRequest
     {
         CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
         Query          = "",
         LanguageCodes  = { "", },
         DeviceType     = "",
         MaxSuggestions = 0,
         Dataset        = "",
         VisitorId      = "",
     };
     // Make the request
     CompleteQueryResponse response = completionServiceClient.CompleteQuery(request);
     // End snippet
 }
Ejemplo n.º 13
0
        public async stt::Task CompleteQueryRequestObjectAsync()
        {
            moq::Mock <CompletionService.CompletionServiceClient> mockGrpcClient = new moq::Mock <CompletionService.CompletionServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            CompleteQueryRequest request = new CompleteQueryRequest
            {
                CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
                Query         = "queryf0c71c1b",
                LanguageCodes =
                {
                    "language_codes1de1a181",
                },
                DeviceType     = "device_typef69395c0",
                MaxSuggestions = -1310933316,
                Dataset        = "datasete4094d3c",
                VisitorId      = "visitor_id25f1c2bf",
            };
            CompleteQueryResponse expectedResponse = new CompleteQueryResponse
            {
                CompletionResults =
                {
                    new CompleteQueryResponse.Types.CompletionResult(),
                },
                AttributionToken    = "attribution_token14371a88",
                RecentSearchResults =
                {
                    new CompleteQueryResponse.Types.RecentSearchResult(),
                },
            };

            mockGrpcClient.Setup(x => x.CompleteQueryAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <CompleteQueryResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CompletionServiceClient client = new CompletionServiceClientImpl(mockGrpcClient.Object, null);
            CompleteQueryResponse   responseCallSettings = await client.CompleteQueryAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            CompleteQueryResponse responseCancellationToken = await client.CompleteQueryAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void GetDefaultBranchResourceNames()
        {
            moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict);
            GetDefaultBranchRequest request = new GetDefaultBranchRequest
            {
                CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
            };
            GetDefaultBranchResponse expectedResponse = new GetDefaultBranchResponse
            {
                BranchAsBranchName = BranchName.FromProjectLocationCatalogBranch("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"),
                SetTime            = new wkt::Timestamp(),
                Note = "noteca53d6aa",
            };

            mockGrpcClient.Setup(x => x.GetDefaultBranch(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CatalogServiceClient     client   = new CatalogServiceClientImpl(mockGrpcClient.Object, null);
            GetDefaultBranchResponse response = client.GetDefaultBranch(request.CatalogAsCatalogName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateCatalog()
        {
            moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict);
            UpdateCatalogRequest request = new UpdateCatalogRequest
            {
                Catalog    = new Catalog(),
                UpdateMask = new wkt::FieldMask(),
            };
            Catalog expectedResponse = new Catalog
            {
                CatalogName        = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
                DisplayName        = "display_name137f65c2",
                ProductLevelConfig = new ProductLevelConfig(),
            };

            mockGrpcClient.Setup(x => x.UpdateCatalog(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CatalogServiceClient client = new CatalogServiceClientImpl(mockGrpcClient.Object, null);
            Catalog response            = client.UpdateCatalog(request.Catalog, request.UpdateMask);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        /// <summary>Snippet for ImportCatalogItemsAsync</summary>
        public async Task ImportCatalogItemsRequestObjectAsync()
        {
            // Snippet: ImportCatalogItemsAsync(ImportCatalogItemsRequest, CallSettings)
            // Additional: ImportCatalogItemsAsync(ImportCatalogItemsRequest, CancellationToken)
            // Create client
            CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();

            // Initialize request argument(s)
            ImportCatalogItemsRequest request = new ImportCatalogItemsRequest
            {
                ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
                RequestId           = "",
                InputConfig         = new InputConfig(),
                ErrorsConfig        = new ImportErrorsConfig(),
            };
            // Make the request
            Operation <ImportCatalogItemsResponse, ImportMetadata> response = await catalogServiceClient.ImportCatalogItemsAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <ImportCatalogItemsResponse, ImportMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            ImportCatalogItemsResponse result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <ImportCatalogItemsResponse, ImportMetadata> retrievedResponse = await catalogServiceClient.PollOnceImportCatalogItemsAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ImportCatalogItemsResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        public async stt::Task CreateCatalogItemRequestObjectAsync()
        {
            moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            CreateCatalogItemRequest request = new CreateCatalogItemRequest
            {
                ParentAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
                CatalogItem         = new CatalogItem(),
            };
            CatalogItem expectedResponse = new CatalogItem
            {
                Id = "id74b70bb8",
                CategoryHierarchies =
                {
                    new CatalogItem.Types.CategoryHierarchy(),
                },
                Title           = "title17dbd3d5",
                Description     = "description2cf9da67",
                ItemAttributes  = new FeatureMap(),
                LanguageCode    = "language_code2f6c7160",
                Tags            = { "tags52c47ad5", },
                ItemGroupId     = "item_group_id08a4c0f5",
                ProductMetadata = new ProductCatalogItem(),
            };

            mockGrpcClient.Setup(x => x.CreateCatalogItemAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <CatalogItem>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CatalogServiceClient client = new CatalogServiceClientImpl(mockGrpcClient.Object, null);
            CatalogItem          responseCallSettings = await client.CreateCatalogItemAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            CatalogItem responseCancellationToken = await client.CreateCatalogItemAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task GetDefaultBranchResourceNamesAsync()
        {
            moq::Mock <CatalogService.CatalogServiceClient> mockGrpcClient = new moq::Mock <CatalogService.CatalogServiceClient>(moq::MockBehavior.Strict);
            GetDefaultBranchRequest request = new GetDefaultBranchRequest
            {
                CatalogAsCatalogName = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]"),
            };
            GetDefaultBranchResponse expectedResponse = new GetDefaultBranchResponse
            {
                BranchAsBranchName = BranchName.FromProjectLocationCatalogBranch("[PROJECT]", "[LOCATION]", "[CATALOG]", "[BRANCH]"),
                SetTime            = new wkt::Timestamp(),
                Note = "noteca53d6aa",
            };

            mockGrpcClient.Setup(x => x.GetDefaultBranchAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <GetDefaultBranchResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CatalogServiceClient     client = new CatalogServiceClientImpl(mockGrpcClient.Object, null);
            GetDefaultBranchResponse responseCallSettings = await client.GetDefaultBranchAsync(request.CatalogAsCatalogName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            GetDefaultBranchResponse responseCancellationToken = await client.GetDefaultBranchAsync(request.CatalogAsCatalogName, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 19
0
 public RelationalDatabaseDataSet FindTablesBy(CatalogName catalog, TableName[] tableNameCollection)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 20
0
 RelationalDatabaseDataSet ITableGateway.FindTablesBy(CatalogName catalog, TableName[] tableNameCollection)
 {
     _logger.Trace(Strings.TableGatewayCall);
     return(_tableGateway.FindTablesBy(catalog, tableNameCollection));
 }
        public static List <ListItem> GetCatalogs(CatalogName catalog)
        {
            List <ListItem> listCatalogs = new List <ListItem>();

            try
            {
                CatalogsDAL objCatalogs = new CatalogsDAL();

                switch (catalog)
                {
                case CatalogName.AirPortCityCountryMin:
                    listCatalogs = objCatalogs.GetAirPortCityCountryMin();
                    break;

                case CatalogName.AirPortCityCountryMaj:
                    listCatalogs = objCatalogs.GetAirPortCityCountryMaj();
                    break;

                case CatalogName.AirLines:
                    listCatalogs = objCatalogs.GetAirLines();
                    break;

                case CatalogName.Countries:
                    listCatalogs = objCatalogs.GetCountries();
                    break;

                case CatalogName.BusCodes:
                    listCatalogs = objCatalogs.GetBusCodes();
                    break;

                case CatalogName.Hotels:
                    listCatalogs = objCatalogs.GetHotels();
                    break;

                case CatalogName.CreditCardsCodes:
                    listCatalogs = objCatalogs.GetCreditCardsCodes();
                    break;

                case CatalogName.SeaVendorsCodes:
                    listCatalogs = objCatalogs.GetSeaVendorsCodes();
                    break;

                case CatalogName.CurrenciesCountries:
                    listCatalogs = objCatalogs.GetCurrenciesCountries();
                    break;

                case CatalogName.StatusCodes:
                    listCatalogs = objCatalogs.GetStatusCodes();
                    break;

                case CatalogName.Cities:
                    listCatalogs = objCatalogs.GetCities();
                    break;

                case CatalogName.StatesUSA:
                    listCatalogs = objCatalogs.GetStatesUSA();
                    break;

                case CatalogName.AirLinesClasses:
                    listCatalogs = objCatalogs.GetAirLinesClasses();
                    break;

                case CatalogName.CarType:
                    listCatalogs = objCatalogs.GetCarType();
                    break;

                case CatalogName.EquipmentCodes:
                    listCatalogs = objCatalogs.GetEquipmentCodes();
                    break;

                case CatalogName.VendorCodes:
                    listCatalogs = objCatalogs.GetVendorCodes();
                    break;

                case CatalogName.ChargePerService:
                    listCatalogs = objCatalogs.GetChargePerService();
                    break;

                case CatalogName.PCCs:
                    listCatalogs = objCatalogs.GetPCCs();
                    break;

                case CatalogName.ConfirmDK:
                    listCatalogs = objCatalogs.GetConfirmDK();
                    break;

                case CatalogName.PAirlinesFare:
                    listCatalogs = objCatalogs.GetPAirlinesFare();
                    break;

                case CatalogName.CostCenter:
                    listCatalogs = objCatalogs.GetCostCenter();
                    break;

                case CatalogName.MealCodes:
                    listCatalogs = objCatalogs.GetMealCodes();
                    break;

                case CatalogName.ClientsNextel:
                    listCatalogs = objCatalogs.GetClientsNextel();
                    break;
                }
            }
            catch
            { }
            return(listCatalogs);
        }
Ejemplo n.º 22
0
 public override int GetHashCode()
 {
     return(CatalogName.GetHashCode());
 }
 public CatalogOfferViewModel(CatalogName catalogName)
     : this()
 {
     filterCatalogName = catalogName;
     ViewHeader        = filterCatalogName.Name;
 }
Ejemplo n.º 24
0
 private void ClearTextBoxes()
 {
     PersonName.Clear();
     ProviderName.Clear();
     CatalogName.Clear();
 }
Ejemplo n.º 25
0
        public void SqlSchema(
            [Argument(Help = "Identificação da fonte de dados")]
            string dataSource,
            [Argument(Help = "String de ligação ao servidor de SQL, e.g. 'Server=SqlServerTestMachine;Trusted_Connection=True;'")]
            string connectionString,
            [Argument(Help = "Nome da base de dados")]
            string[] catalogNameCollection,
            [Argument(Help = "Formato do ficheiro (Xml ou Json)'", IsRequired = false)]
            DataSetStreamFormat fileFormat = DataSetStreamFormat.Xml
            )
        {
            // Cria animação de espera em back-ground, obtendo um token para cancelar a animação logo que os dados cheguem.
            CancellationTokenSource animation = Animation.Spinner(ConsoleColor.Yellow);

            try
            {
                App.Console.WriteWithColor("A enviar solicitação ao servidor...", false, ConsoleColor.Yellow);

                var producerFacade = ServiceProvider.GetService <IRelationalDatabasesProducerServiceAsync>();

                var task = producerFacade.GetSchemaAsync(dataSource, connectionString,
                                                         CatalogName.FromArray(catalogNameCollection));

                task.Wait();

                // Os dados já chegaram, pára a animação e mostra os resultados.
                animation.Cancel();

                App.Console.WriteWithColor("A receber resposta do servidor.", false, ConsoleColor.Yellow);

                RelationalDatabaseDataSet dataSet = task.Result;

                // Cria nome do ficheiro
                IDataSetStreamWriter dataSetWriter =
                    ServiceProvider.GetRequiredService <DataSetStreamFormatWriterFunc>()(fileFormat);

                var sqlSchemaFileTemplate =
                    ServiceProvider.GetRequiredService <IOptions <ProducerOptions> >().Value.SqlSchemaFileTemplate;

                var fileNameBuilder = new SchemaFileNameBuilder(sqlSchemaFileTemplate,
                                                                BridgeElement.Category, fileFormat.ToString().ToLower());

                string filePath = fileNameBuilder.Build();

                using (FileStream fs = File.Create(filePath))
                {
                    dataSetWriter.Write(dataSet, fs);
                    fs.Close();
                }

                string output =
                    $"O ficheiro '{filePath}' foi criado com {dataSet.Catalog.Count} catálogo(s) e {dataSet.Table.Count} tabela(s).";

                Logger.LogInformation(output);
            }
            catch (Exception e)
            {
                if (!animation.IsCancellationRequested)
                {
                    animation.Cancel();
                }
                Logger.LogError(e.Message);
            }
        }