// Executes when the user navigates to this page. protected override void OnNavigatedTo(NavigationEventArgs e) { var employeeId = ""; if (NavigationContext.QueryString.TryGetValue("id", out employeeId)) { var client = new CompanyServiceClient(); client.GetEmployeeCompleted += (s, ea) => DataContext = ea.Result; client.GetEmployeeAsync(Guid.Parse(employeeId)); } }
private void Button1Click(object sender, RoutedEventArgs e) { var dept = DataContext as DepartmentDetailsDto; if (dept == null) return; var client = new CompanyServiceClient(); client.CutDeptCompleted += (s, ea) => txtTotal.Text = (dept.Total / 2).ToString(); client.CutDeptAsync(dept); }
// Executes when the user navigates to this page. protected override void OnNavigatedTo(NavigationEventArgs e) { var departmentId = ""; if (NavigationContext.QueryString.TryGetValue("id", out departmentId)) { var client = new CompanyServiceClient(); client.GetDepartmentDetailsCompleted += (s, ea) => DataContext = ea.Result; client.GetDepartmentDetailsAsync(Guid.Parse(departmentId)); } }
/// <summary>Snippet for GetCompany</summary> public void GetCompany() { // Snippet: GetCompany(string,CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) string formattedName = new CompanyName("[PROJECT]", "[COMPANY]").ToString(); // Make the request Company response = companyServiceClient.GetCompany(formattedName); // End snippet }
/// <summary>Snippet for GetCompany</summary> public void GetCompanyResourceNames() { // Snippet: GetCompany(CompanyName, CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) CompanyName name = CompanyName.FromProjectTenantCompany("[PROJECT]", "[TENANT]", "[COMPANY]"); // Make the request Company response = companyServiceClient.GetCompany(name); // End snippet }
/// <summary>Snippet for UpdateCompany</summary> public void UpdateCompany() { // Snippet: UpdateCompany(Company, CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) Company company = new Company(); // Make the request Company response = companyServiceClient.UpdateCompany(company); // End snippet }
/// <summary>Snippet for GetCompany</summary> public void GetCompany() { // Snippet: GetCompany(string, CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) string name = "projects/[PROJECT]/tenants/[TENANT]/companies/[COMPANY]"; // Make the request Company response = companyServiceClient.GetCompany(name); // End snippet }
/// <summary>Snippet for GetCompany</summary> public void GetCompany() { // Snippet: GetCompany(CompanyNameOneof,CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) CompanyNameOneof name = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")); // Make the request Company response = companyServiceClient.GetCompany(name); // End snippet }
/// <summary>Snippet for CreateCompany</summary> public void CreateCompany() { // Snippet: CreateCompany(string,Company,CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) string formattedParent = new ProjectName("[PROJECT]").ToString(); Company company = new Company(); // Make the request Company response = companyServiceClient.CreateCompany(formattedParent, company); // End snippet }
/// <summary>Snippet for CreateCompany</summary> public void CreateCompanyResourceNames2() { // Snippet: CreateCompany(ProjectName, Company, CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) ProjectName parent = ProjectName.FromProject("[PROJECT]"); Company company = new Company(); // Make the request Company response = companyServiceClient.CreateCompany(parent, company); // End snippet }
/// <summary>Snippet for DeleteCompany</summary> public void DeleteCompany() { // Snippet: DeleteCompany(CompanyName,CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) CompanyName name = new CompanyName("[PROJECT]", "[COMPANY]"); // Make the request companyServiceClient.DeleteCompany(name); // End snippet }
/// <summary>Snippet for CreateCompany</summary> public void CreateCompany() { // Snippet: CreateCompany(TenantOrProjectNameOneof,Company,CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); Company company = new Company(); // Make the request Company response = companyServiceClient.CreateCompany(parent, company); // End snippet }
/// <summary>Snippet for CreateCompany</summary> public void CreateCompany() { // Snippet: CreateCompany(string, Company, CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) string parent = "projects/[PROJECT]/tenants/[TENANT]"; Company company = new Company(); // Make the request Company response = companyServiceClient.CreateCompany(parent, company); // End snippet }
/// <summary>Snippet for DeleteCompany</summary> public void DeleteCompany() { // Snippet: DeleteCompany(string, CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) string name = "projects/[PROJECT]/companies/[COMPANY]"; // Make the request companyServiceClient.DeleteCompany(name); // End snippet }
public static void GetAllEmployees() { using (var context = new CompanyServiceClient()) { var employees = context.GetEmployees(); foreach (var employee in employees) { Console.WriteLine($"{employee.Id}, {employee.Name}, {employee.Salary}"); } } Console.ReadKey(); Menu(); }
private CompanyName CreateSampleCompany() { CompanyServiceClient client = CompanyServiceClient.Create(); Company company = new Company { DisplayName = "Sample company created by fixture", ExternalId = GenerateCompanyExternalId(), Size = CompanySize.Giant }; Company created = client.CreateCompany(ProjectName.FromProject(ProjectId), company); return(created.CompanyName); }
/// <summary>Snippet for DeleteCompanyAsync</summary> public async Task DeleteCompanyAsync() { // Snippet: DeleteCompanyAsync(string,CallSettings) // Additional: DeleteCompanyAsync(string,CancellationToken) // Create client CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync(); // Initialize request argument(s) string formattedName = new CompanyName("[PROJECT]", "[COMPANY]").ToString(); // Make the request await companyServiceClient.DeleteCompanyAsync(formattedName); // End snippet }
/// <summary>Snippet for DeleteCompanyAsync</summary> public async Task DeleteCompanyAsync() { // Snippet: DeleteCompanyAsync(CompanyNameOneof,CallSettings) // Additional: DeleteCompanyAsync(CompanyNameOneof,CancellationToken) // Create client CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync(); // Initialize request argument(s) CompanyNameOneof name = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")); // Make the request await companyServiceClient.DeleteCompanyAsync(name); // End snippet }
// [START job_search_delete_company_beta] public static object DeleteCompany(string projectId, string tenantId, string companyId) { CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); CompanyName companyName = CompanyName.FromProjectTenantCompany(projectId, tenantId, companyId); DeleteCompanyRequest request = new DeleteCompanyRequest { CompanyName = companyName }; companyServiceClient.DeleteCompany(request); Console.WriteLine("Deleted Company."); return(0); }
/// <summary>Snippet for GetCompany</summary> public void GetCompany_RequestObject() { // Snippet: GetCompany(GetCompanyRequest,CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) GetCompanyRequest request = new GetCompanyRequest { CompanyNameOneof = CompanyNameOneof.From(new CompanyName("[PROJECT]", "[TENANT]", "[COMPANY]")), }; // Make the request Company response = companyServiceClient.GetCompany(request); // End snippet }
/// <summary>Snippet for UpdateCompany</summary> public void UpdateCompany_RequestObject() { // Snippet: UpdateCompany(UpdateCompanyRequest,CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) UpdateCompanyRequest request = new UpdateCompanyRequest { Company = new Company(), }; // Make the request Company response = companyServiceClient.UpdateCompany(request); // End snippet }
/// <summary>Snippet for UpdateCompanyAsync</summary> public async Task UpdateCompanyAsync() { // Snippet: UpdateCompanyAsync(Company,CallSettings) // Additional: UpdateCompanyAsync(Company,CancellationToken) // Create client CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync(); // Initialize request argument(s) Company company = new Company(); // Make the request Company response = await companyServiceClient.UpdateCompanyAsync(company); // End snippet }
/// <summary>Snippet for DeleteCompanyAsync</summary> public async Task DeleteCompanyAsync() { // Snippet: DeleteCompanyAsync(string, CallSettings) // Additional: DeleteCompanyAsync(string, CancellationToken) // Create client CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync(); // Initialize request argument(s) string name = "projects/[PROJECT]/tenants/[TENANT]/companies/[COMPANY]"; // Make the request await companyServiceClient.DeleteCompanyAsync(name); // End snippet }
/// <summary>Snippet for GetCompanyAsync</summary> public async Task GetCompanyResourceNamesAsync() { // Snippet: GetCompanyAsync(CompanyName, CallSettings) // Additional: GetCompanyAsync(CompanyName, CancellationToken) // Create client CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync(); // Initialize request argument(s) CompanyName name = CompanyName.FromProjectTenantCompany("[PROJECT]", "[TENANT]", "[COMPANY]"); // Make the request Company response = await companyServiceClient.GetCompanyAsync(name); // End snippet }
/// <summary>Snippet for ListCompaniesAsync</summary> public async Task ListCompaniesRequestObjectAsync() { // Snippet: ListCompaniesAsync(ListCompaniesRequest, CallSettings) // Create client CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync(); // Initialize request argument(s) ListCompaniesRequest request = new ListCompaniesRequest { ParentAsTenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"), RequireOpenJobs = false, }; // Make the request PagedAsyncEnumerable <ListCompaniesResponse, Company> response = companyServiceClient.ListCompaniesAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Company 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((ListCompaniesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Company 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 <Company> 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 (Company 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 CreateCompanyAsync</summary> public async Task CreateCompanyAsync() { // Snippet: CreateCompanyAsync(string, Company, CallSettings) // Additional: CreateCompanyAsync(string, Company, CancellationToken) // Create client CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]/tenants/[TENANT]"; Company company = new Company(); // Make the request Company response = await companyServiceClient.CreateCompanyAsync(parent, company); // End snippet }
// [START job_search_get_company_beta] public static object GetCompany(string projectId, string tenantId, string companyId) { CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); CompanyName companyName = CompanyName.FromProjectTenantCompany(projectId, tenantId, companyId); GetCompanyRequest request = new GetCompanyRequest { CompanyName = companyName }; var response = companyServiceClient.GetCompany(request); Console.WriteLine($"Company name: {response.Name}"); Console.WriteLine($"Display name: {response.DisplayName}"); return(0); }
/// <summary>Snippet for DeleteCompany</summary> public void DeleteCompanyRequestObject() { // Snippet: DeleteCompany(DeleteCompanyRequest, CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) DeleteCompanyRequest request = new DeleteCompanyRequest { CompanyName = CompanyName.FromProjectTenantCompany("[PROJECT]", "[TENANT]", "[COMPANY]"), }; // Make the request companyServiceClient.DeleteCompany(request); // End snippet }
/// <summary>Snippet for CreateCompanyAsync</summary> public async Task CreateCompanyResourceNames2Async() { // Snippet: CreateCompanyAsync(ProjectName, Company, CallSettings) // Additional: CreateCompanyAsync(ProjectName, Company, CancellationToken) // Create client CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync(); // Initialize request argument(s) ProjectName parent = ProjectName.FromProject("[PROJECT]"); Company company = new Company(); // Make the request Company response = await companyServiceClient.CreateCompanyAsync(parent, company); // End snippet }
private void Button1Click(object sender, RoutedEventArgs e) { var dept = DataContext as DepartmentDetailsDto; if (dept == null) { return; } var client = new CompanyServiceClient(); client.CutDeptCompleted += (s, ea) => txtTotal.Text = (dept.Total / 2).ToString(); client.CutDeptAsync(dept); }
/// <summary>Snippet for DeleteCompany</summary> public void DeleteCompany_RequestObject() { // Snippet: DeleteCompany(DeleteCompanyRequest,CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) DeleteCompanyRequest request = new DeleteCompanyRequest { CompanyNameOneof = CompanyNameOneof.From(new CompanyOldName("[PROJECT]", "[COMPANY]")), }; // Make the request companyServiceClient.DeleteCompany(request); // End snippet }
/// <summary>Snippet for CreateCompany</summary> public void CreateCompany_RequestObject() { // Snippet: CreateCompany(CreateCompanyRequest,CallSettings) // Create client CompanyServiceClient companyServiceClient = CompanyServiceClient.Create(); // Initialize request argument(s) CreateCompanyRequest request = new CreateCompanyRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Company = new Company(), }; // Make the request Company response = companyServiceClient.CreateCompany(request); // End snippet }
/// <summary>Snippet for CreateCompanyAsync</summary> public async Task CreateCompanyAsync() { // Snippet: CreateCompanyAsync(TenantOrProjectNameOneof,Company,CallSettings) // Additional: CreateCompanyAsync(TenantOrProjectNameOneof,Company,CancellationToken) // Create client CompanyServiceClient companyServiceClient = await CompanyServiceClient.CreateAsync(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); Company company = new Company(); // Make the request Company response = await companyServiceClient.CreateCompanyAsync(parent, company); // End snippet }
private void MainPageLoaded(object sender, RoutedEventArgs e) { var client = new CompanyServiceClient(); client.GetCompanyCompleted += ClientGetCompanyCompleted; client.GetCompanyAsync(); }
// Executes when the user navigates to this page. protected override void OnNavigatedTo(NavigationEventArgs e) { var client = new CompanyServiceClient(); client.GetCompanyCompleted += client_GetCompanyCompleted; client.GetCompanyAsync(); }
private void btnCut_Click(object sender, RoutedEventArgs e) { var client = new CompanyServiceClient(); client.CutCompleted += (x, y) => txtTotal.Content = y.Result; client.CutAsync((CompanyDto)DataContext); }