// [START job_search_create_company_beta]
        public static object CreateCompany(string projectId, string tenantId, string displayName, string externalId)
        {
            CompanyServiceClient     companyServiceClient = CompanyServiceClient.Create();
            TenantName               tenantName           = new TenantName(projectId, tenantId);
            TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(tenantName);
            Company company = new Company
            {
                DisplayName = displayName,
                ExternalId  = externalId
            };

            CreateCompanyRequest request = new CreateCompanyRequest
            {
                ParentAsTenantOrProjectNameOneof = parent,
                Company = company
            };

            Company response = companyServiceClient.CreateCompany(request);

            Console.WriteLine("Created Company");
            Console.WriteLine($"Name: {response.Name}");
            Console.WriteLine($"Display Name: {response.DisplayName}");
            Console.WriteLine($"External ID: {response.ExternalId}");
            return(0);
        }
Пример #2
0
        public async static Task Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Environment.SetEnvironmentVariable(
                "GOOGLE_APPLICATION_CREDENTIALS",
                Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "My First Project-065d320bab2e.json"));
            CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();

            // GoogleCredential credential = GoogleCredential.GetApplicationDefault();
            Google.Cloud.Talent.V4Beta1.Company c = new Google.Cloud.Talent.V4Beta1.Company
            {
                Name        = "ADI",
                DisplayName = "ADI",

                ExternalId = "123"
            };
            Google.Cloud.Talent.V4Beta1.CreateCompanyRequest request = new Google.Cloud.Talent.V4Beta1.CreateCompanyRequest
            {
                Company = c
            };

            Google.Cloud.Talent.V4Beta1.Company response = companyServiceClient.CreateCompany(request);
            Console.WriteLine("Created Company");
            Console.WriteLine($"Name: {response.Name}");
            Console.WriteLine($"Display Name: {response.DisplayName}");
            Console.WriteLine($"External ID: {response.ExternalId}");

            //JobServiceClient jobServiceClient = JobServiceClient.Create();
            // TenantName tenantName = TenantName.FromProjectTenant(projectId, tenantId);
            PublisherClient publisher = await PublisherClient.CreateAsync(topicName, null, null);

            var pubsubMessage = new PubsubMessage()
            {
                Data = ByteString.CopyFromUtf8("this is new  sample message")
            };
            string messageId = await publisher.PublishAsync(pubsubMessage);

            var subscriptionName = new SubscriptionName(ProjectId, SubscriptionId);
            var subscription     = await SubscriberClient.CreateAsync(subscriptionName);

            try
            {
                // PullResponse response = subscription.(subscriptionName, true, 10);
                await subscription.StartAsync((pubsubMessage, cancellationToken) =>
                {
                    // Process the message here.
                    var all = Task.FromResult(SubscriberClient.Reply.Ack);
                    return(all);
                });
            }
            catch (Exception e)
            {
                Console.WriteLine("Something went wrong: {0}", e.Message);
            }
        }
 /// <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 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
 }
Пример #6
0
 /// <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
 }
Пример #7
0
        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 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
 }
Пример #9
0
 /// <summary>Snippet for CreateCompany</summary>
 public void CreateCompanyRequestObject()
 {
     // Snippet: CreateCompany(CreateCompanyRequest, CallSettings)
     // Create client
     CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
     // Initialize request argument(s)
     CreateCompanyRequest request = new CreateCompanyRequest
     {
         ParentAsProjectName = ProjectName.FromProject("[PROJECT]"),
         Company             = new Company(),
     };
     // Make the request
     Company response = companyServiceClient.CreateCompany(request);
     // End snippet
 }
 // [START job_search_create_company_core]
 /// <summary>
 /// Create Company
 /// </summary>
 /// <param name="projectId">Your Google Cloud Project ID</param>
 public static void SampleCreateCompany(string projectId, string displayName, string externalId)
 {
     CompanyServiceClient companyServiceClient = CompanyServiceClient.Create();
     // string projectId = "Your Google Cloud Project ID"
     // string displayName = "My Company Name"
     // string externalId = "Identifier of this company in my system"
     CreateCompanyRequest request = new CreateCompanyRequest
     {
         ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new ProjectName(projectId)),
         Company = new Company
         {
             DisplayName = "My Company Name",
             ExternalId  = "Identifier of this company in my system",
         },
     };
     Company response = companyServiceClient.CreateCompany(request);
     // FIXME: inspect the results
 }
Пример #11
0
        public ActionResult _CreateCompany(string Email, string Password, string PasswordControl)
        {
            Company company = new Company();

            company.Email    = Email;
            company.Password = Password;

            if (Password == PasswordControl)
            {
                client.CreateCompany(company);
                // Creates session on creation of user
                Session["company"] = company;
                return(RedirectToAction("Index"));
            }
            else
            {
                //Giv fejl omkring at password ikke stemmer overens
            }

            return(null);
        }
Пример #12
0
 internal void CreateCompany(Company company)
 {
     _service.CreateCompany(company);
 }