public void openConnection(String connection) { client = new JobServiceClient(); connect = new SqlConnection(connection); connect.Open(); }
private void _menuItemResetJob_Click(object sender, EventArgs e) { try { using (JobServiceClient jobService = new JobServiceClient()) { string address = string.Format("{0}/JobService.svc", _wcfAddress); jobService.Endpoint.Address = new System.ServiceModel.EndpointAddress(address); //Reset each selected job using the ResetJob WCF Service foreach (DataGridViewRow selectedJob in _dgvJobs.SelectedRows) { ResetJobRequest resetJobRequest = new ResetJobRequest(); resetJobRequest.ID = (string)selectedJob.Cells[JobProcessorConstants.Database.GuidColumn].Value; //"cGuid" is the ID (Guid) column name in the database jobService.ResetJob(resetJobRequest); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } GetClientJobs(); }
/// <summary>Snippet for BatchUpdateJobs</summary> public void BatchUpdateJobs() { // Snippet: BatchUpdateJobs(string,IEnumerable<Job>,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) string formattedParent = new TenantName("[PROJECT]", "[TENANT]").ToString(); IEnumerable <Job> jobs = new List <Job>(); // Make the request Operation <JobOperationResult, BatchOperationMetadata> response = jobServiceClient.BatchUpdateJobs(formattedParent, jobs); // Poll until the returned long-running operation is complete Operation <JobOperationResult, BatchOperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result JobOperationResult 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 <JobOperationResult, BatchOperationMetadata> retrievedResponse = jobServiceClient.PollOnceBatchUpdateJobs(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result JobOperationResult retrievedResult = retrievedResponse.Result; } // End snippet }
// [START job_search_get_job_beta] public static object GetJob(string projectId, string tenantId, string jobId) { JobServiceClient jobServiceClient = JobServiceClient.Create(); JobName jobName = JobName.FromProjectTenantJob(projectId, tenantId, jobId); GetJobRequest request = new GetJobRequest { JobName = jobName }; var response = jobServiceClient.GetJob(request); Console.WriteLine($"Job name: {response.Name}"); Console.WriteLine($"Requisition ID: {response.RequisitionId}"); Console.WriteLine($"Title: {response.Title}"); Console.WriteLine($"Description: {response.Description}"); Console.WriteLine($"Posting language: {response.LanguageCode}"); foreach (string address in response.Addresses) { Console.WriteLine($"Address: {address}"); } foreach (string email in response.ApplicationInfo.Emails) { Console.WriteLine($"Email: {email}"); } foreach (string websiteUri in response.ApplicationInfo.Uris) { Console.WriteLine($"Website: {websiteUri}"); } return(0); }
// [START job_search_create_job_beta] public static object CreateJob(string projectId, string tenantId, string companyId, string requisitionId, string jobApplicationUrl) { JobServiceClient jobServiceClient = JobServiceClient.Create(); TenantName tenantName = TenantName.FromProjectTenant(projectId, tenantId); ApplicationInfo applicationInfo = new ApplicationInfo(); applicationInfo.Uris.Add(jobApplicationUrl); Job job = new Job { Company = companyId, RequisitionId = requisitionId, Title = "Software Developer", Description = "Develop, maintain the software solutions.", ApplicationInfo = applicationInfo, LanguageCode = "en-US" }; string[] addresses = { "1600 Amphitheatre Parkway, Mountain View, CA 94043", "111 8th Avenue, New York, NY 10011" }; job.Addresses.Add(addresses); CreateJobRequest request = new CreateJobRequest { ParentAsTenantName = tenantName, Job = job }; Job response = jobServiceClient.CreateJob(request); Console.WriteLine($"Created Job: {response.Name}"); return(0); }
/// <summary>Snippet for GetJob</summary> public void GetJob() { // Snippet: GetJob(JobNameOneof,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) JobNameOneof name = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")); // Make the request Job response = jobServiceClient.GetJob(name); // End snippet }
// GET: /Job/ public async Task<ViewResult> Index() { IEnumerable<Job> jobs = null; using (var client = new JobServiceClient()) { jobs = await client.GetJobs(); } return View(jobs); }
/// <summary>Snippet for UpdateJob</summary> public void UpdateJob() { // Snippet: UpdateJob(Job,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) Job job = new Job(); // Make the request Job response = jobServiceClient.UpdateJob(job); // End snippet }
/// <summary>Snippet for GetJob</summary> public void GetJob() { // Snippet: GetJob(string,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) string formattedName = new JobName("[PROJECT]", "[JOB]").ToString(); // Make the request Job response = jobServiceClient.GetJob(formattedName); // End snippet }
/// <summary>Snippet for CreateJob</summary> public void CreateJob() { // Snippet: CreateJob(ProjectName,Job,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) ProjectName parent = new ProjectName("[PROJECT]"); Job job = new Job(); // Make the request Job response = jobServiceClient.CreateJob(parent, job); // End snippet }
/// <summary>Snippet for DeleteJob</summary> public void DeleteJob() { // Snippet: DeleteJob(JobName,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) JobName name = new JobName("[PROJECT]", "[JOBS]"); // Make the request jobServiceClient.DeleteJob(name); // End snippet }
/// <summary>Snippet for CreateJob</summary> public void CreateJob() { // Snippet: CreateJob(TenantOrProjectNameOneof,Job,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); Job job = new Job(); // Make the request Job response = jobServiceClient.CreateJob(parent, job); // End snippet }
/// <summary>Snippet for BatchDeleteJobs</summary> public void BatchDeleteJobs() { // Snippet: BatchDeleteJobs(TenantOrProjectNameOneof,string,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); string filter = ""; // Make the request jobServiceClient.BatchDeleteJobs(parent, filter); // End snippet }
/// <summary>Snippet for BatchDeleteJobs</summary> public void BatchDeleteJobs() { // Snippet: BatchDeleteJobs(ProjectName,string,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) ProjectName parent = new ProjectName("[PROJECT]"); string filter = ""; // Make the request jobServiceClient.BatchDeleteJobs(parent, filter); // End snippet }
/// <summary>Snippet for GetJobAsync</summary> public async Task GetJobAsync() { // Snippet: GetJobAsync(JobName,CallSettings) // Additional: GetJobAsync(JobName,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) JobName name = new JobName("[PROJECT]", "[JOBS]"); // Make the request Job response = await jobServiceClient.GetJobAsync(name); // End snippet }
public IEnumerable<JobDAO> GetJobs() { JobServiceClient client = new JobServiceClient(); try { IEnumerable<JobDAO> result = client.GetJobs(); return result; } catch (FaultException<KaskServiceException> e) { throw new HttpException(e.Message); } }
/// <summary>Snippet for GetJob</summary> public void GetJob_RequestObject() { // Snippet: GetJob(GetJobRequest,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) GetJobRequest request = new GetJobRequest { JobNameOneof = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")), }; // Make the request Job response = jobServiceClient.GetJob(request); // End snippet }
/// <summary>Snippet for UpdateJob</summary> public void UpdateJob_RequestObject() { // Snippet: UpdateJob(UpdateJobRequest,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) UpdateJobRequest request = new UpdateJobRequest { Job = new Job(), }; // Make the request Job response = jobServiceClient.UpdateJob(request); // End snippet }
// [START job_search_delete_job_beta] public static object DeleteJob(string projectId, string tenantId, string jobId) { JobServiceClient jobServiceClient = JobServiceClient.Create(); JobName name = new JobName(projectId, tenantId, jobId); DeleteJobRequest request = new DeleteJobRequest { JobNameOneof = JobNameOneof.From(name) }; jobServiceClient.DeleteJob(request); Console.WriteLine("Deleted Job."); return(0); }
bool DeleteJob(string jobID) { using (JobServiceClient jobService = new JobServiceClient()) { string address = string.Format("{0}/JobService.svc", _wcfAddress); jobService.Endpoint.Address = new System.ServiceModel.EndpointAddress(address); //Delete the selected job using the DeleteJob WCF Service DeleteJobRequest deleteJobRequest = new DeleteJobRequest(); deleteJobRequest.ID = jobID; DeleteJobResponse deleteJobResponse = jobService.DeleteJob(deleteJobRequest); return(deleteJobResponse.IsDeleted); } }
/// <summary>Snippet for DeleteJobAsync</summary> public async Task DeleteJobAsync() { // Snippet: DeleteJobAsync(string,CallSettings) // Additional: DeleteJobAsync(string,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) string formattedName = new JobName("[PROJECT]", "[JOB]").ToString(); // Make the request await jobServiceClient.DeleteJobAsync(formattedName); // End snippet }
public bool PostJob(JobDAO job) { JobServiceClient client = new JobServiceClient(); try { bool result = client.CreateJob(job); return result; } catch (FaultException<KaskServiceException> e) { throw new HttpException(e.Message); } }
public JobDAO GetJob(int id) { JobServiceClient client = new JobServiceClient(); try { JobDAO result = client.GetJobByID(id); return result; } catch (FaultException<KaskServiceException> e) { throw new HttpException(e.Message); } }
/// <summary>Snippet for DeleteJobAsync</summary> public async Task DeleteJobAsync() { // Snippet: DeleteJobAsync(JobNameOneof,CallSettings) // Additional: DeleteJobAsync(JobNameOneof,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) JobNameOneof name = JobNameOneof.From(new JobName("[PROJECT]", "[TENANT]", "[JOBS]")); // Make the request await jobServiceClient.DeleteJobAsync(name); // End snippet }
/// <summary>Snippet for UpdateJobAsync</summary> public async Task UpdateJobAsync() { // Snippet: UpdateJobAsync(Job,CallSettings) // Additional: UpdateJobAsync(Job,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) Job job = new Job(); // Make the request Job response = await jobServiceClient.UpdateJobAsync(job); // End snippet }
/// <summary>Snippet for BatchDeleteJobsAsync</summary> public async Task BatchDeleteJobsAsync() { // Snippet: BatchDeleteJobsAsync(ProjectName,string,CallSettings) // Additional: BatchDeleteJobsAsync(ProjectName,string,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) ProjectName parent = new ProjectName("[PROJECT]"); string filter = ""; // Make the request await jobServiceClient.BatchDeleteJobsAsync(parent, filter); // End snippet }
/// <summary>Snippet for CreateJob</summary> public void CreateJob_RequestObject() { // Snippet: CreateJob(CreateJobRequest,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) CreateJobRequest request = new CreateJobRequest { Parent = new ProjectName("[PROJECT]").ToString(), Job = new Job(), }; // Make the request Job response = jobServiceClient.CreateJob(request); // End snippet }
/// <summary>Snippet for CreateJob</summary> public void CreateJob_RequestObject() { // Snippet: CreateJob(CreateJobRequest,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) CreateJobRequest request = new CreateJobRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Job = new Job(), }; // Make the request Job response = jobServiceClient.CreateJob(request); // End snippet }
/// <summary>Snippet for BatchDeleteJobsAsync</summary> public async Task BatchDeleteJobsAsync() { // Snippet: BatchDeleteJobsAsync(TenantOrProjectNameOneof,string,CallSettings) // Additional: BatchDeleteJobsAsync(TenantOrProjectNameOneof,string,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); string filter = ""; // Make the request await jobServiceClient.BatchDeleteJobsAsync(parent, filter); // End snippet }
/// <summary>Snippet for DeleteJob</summary> public void DeleteJob_RequestObject() { // Snippet: DeleteJob(DeleteJobRequest,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) DeleteJobRequest request = new DeleteJobRequest { JobName = new JobName("[PROJECT]", "[JOBS]"), }; // Make the request jobServiceClient.DeleteJob(request); // End snippet }
/// <summary>Snippet for CreateJobAsync</summary> public async Task CreateJobAsync() { // Snippet: CreateJobAsync(ProjectName,Job,CallSettings) // Additional: CreateJobAsync(ProjectName,Job,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) ProjectName parent = new ProjectName("[PROJECT]"); Job job = new Job(); // Make the request Job response = await jobServiceClient.CreateJobAsync(parent, job); // End snippet }
/// <summary>Snippet for CreateJobAsync</summary> public async Task CreateJobAsync() { // Snippet: CreateJobAsync(TenantOrProjectNameOneof,Job,CallSettings) // Additional: CreateJobAsync(TenantOrProjectNameOneof,Job,CancellationToken) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) TenantOrProjectNameOneof parent = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")); Job job = new Job(); // Make the request Job response = await jobServiceClient.CreateJobAsync(parent, job); // End snippet }
public async Task<ActionResult> Create([Bind(Include = "Position,Description,FullPartTime,SalaryRange")] Job job) { if (ModelState.IsValid) { using (var client = new JobServiceClient()) { await client.CreateJob(job); } return RedirectToAction("Details", job.JobId); } return View(job); }
/// <summary>Snippet for ListJobsAsync</summary> public async Task ListJobsAsync_RequestObject() { // Snippet: ListJobsAsync(ListJobsRequest,CallSettings) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) ListJobsRequest request = new ListJobsRequest { ParentAsProjectName = new ProjectName("[PROJECT]"), Filter = "", }; // Make the request PagedAsyncEnumerable <ListJobsResponse, Job> response = jobServiceClient.ListJobsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Job 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((ListJobsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Job item in page) { 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 <Job> 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 (Job item in singlePage) { Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for SearchJobsForAlertAsync</summary> public async Task SearchJobsForAlertAsync_RequestObject() { // Snippet: SearchJobsForAlertAsync(SearchJobsRequest,CallSettings) // Create client JobServiceClient jobServiceClient = await JobServiceClient.CreateAsync(); // Initialize request argument(s) SearchJobsRequest request = new SearchJobsRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), RequestMetadata = new RequestMetadata(), }; // Make the request PagedAsyncEnumerable <SearchJobsResponse, MatchingJob> response = jobServiceClient.SearchJobsForAlertAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((SearchJobsResponse.Types.MatchingJob 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((SearchJobsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (SearchJobsResponse.Types.MatchingJob item in page) { 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 <SearchJobsResponse.Types.MatchingJob> 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 (SearchJobsResponse.Types.MatchingJob item in singlePage) { Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for BatchDeleteJobs</summary> public void BatchDeleteJobs_RequestObject() { // Snippet: BatchDeleteJobs(BatchDeleteJobsRequest,CallSettings) // Create client JobServiceClient jobServiceClient = JobServiceClient.Create(); // Initialize request argument(s) BatchDeleteJobsRequest request = new BatchDeleteJobsRequest { ParentAsTenantOrProjectNameOneof = TenantOrProjectNameOneof.From(new TenantName("[PROJECT]", "[TENANT]")), Filter = "", }; // Make the request jobServiceClient.BatchDeleteJobs(request); // End snippet }
// GET: /Job/Details/5 public async Task<ActionResult> Details(int? id) { Job job = null; if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } using (var client = new JobServiceClient()) { job = await client.GetJobById(id); } if (job == null) { return HttpNotFound(); } return View(job); }
public async Task<ActionResult> Edit([Bind(Include = "Position,Description,FullPartTime,SalaryRange")] Job job) { if (ModelState.IsValid) { using (var client = new JobServiceClient()) { await client.DeleteJob(job.JobId); } using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://aimadminstrativeservice.cloudapp.net/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // HTTP GET string request = "api/Job"; HttpResponseMessage response = await client.PostAsJsonAsync(request, job); if (response.IsSuccessStatusCode) { await response.Content.ReadAsAsync<Job>(); } } TempData["Message"] = "Job " + job.Position + " was successfully updated."; return RedirectToAction("Index"); } return View(job); }
// GET: /OpenJob/Create public async Task<ActionResult> Create() { IEnumerable<Job> jobs = null; using (var client = new JobServiceClient()) { jobs = await client.GetJobs(); } var TitleList = new List<string>(); var TitlesQuery = from j in jobs select j.Position; TitleList.AddRange(TitlesQuery); var sl = new SelectList(TitleList); ViewBag.JobTitles = sl; ViewBag.Jobs = jobs; return View(); }
public JobController() { _client = new JobServiceClient(); }
public async Task<ActionResult> DeleteConfirmed(int id) { using (var client = new JobServiceClient()) { await client.DeleteJob(id); Job deletedJob = await _client.GetJobById(id); if (deletedJob == null) { TempData["Message"] = "Job was successfully deleted."; } else { TempData["Message"] = "Job was not deleted."; } } return RedirectToAction("Index"); }
protected void Page_Load(object sender, EventArgs e) { client = new JobServiceClient(); Label1.Text = (client.GetMediumOld()).ToString() + " лет"; }
public async Task<ActionResult> DeleteConfirmed(int id) { using (var client = new JobServiceClient()) { await client.DeleteJob(id); } return RedirectToAction("Index"); }