void ReleaseDesignerOutlets() { if (JobCompany != null) { JobCompany.Dispose(); JobCompany = null; } if (JobDesription != null) { JobDesription.Dispose(); JobDesription = null; } if (JobLocation != null) { JobLocation.Dispose(); JobLocation = null; } if (JobTitle != null) { JobTitle.Dispose(); JobTitle = null; } if (JobType != null) { JobType.Dispose(); JobType = null; } }
public async Task <IActionResult> PostJobLocation([FromBody] JobLocation jobLocation) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.JobLocation.Add(jobLocation); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (JobLocationExists(jobLocation.Id)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetJobLocation", new { id = jobLocation.Id }, jobLocation)); }
public async Task <IActionResult> PutJobLocation([FromRoute] int id, [FromBody] JobLocation jobLocation) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != jobLocation.Id) { return(BadRequest()); } _context.Entry(jobLocation).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!JobLocationExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private void Cbx_location_selection_Unchecked(object sender, RoutedEventArgs e) { CheckBox selectedCheckBox = sender as CheckBox; if (handleLocationSelection) { JobLocation selectedJobLocation = (JobLocation)selectedCheckBox.DataContext; companyReviewFilter.removeLocation(selectedJobLocation.location); handleLocationSelection = false; handleLocationCheckbox(selectedCheckBox); handleLocationSelection = true; } }
private void populateDepartmentsAndLocations(CompanyReview companyReview) { List <string> allCompanyReviewedDepartments = new List <string> { "Select all" }; List <string> allCompanyReviewedLocations = new List <string> { "Select all" }; List <Review> reviewsForDL; if (companyReview != null) { reviewsForDL = companyReview.reviews; } else { reviewsForDL = reviews.reviews; } allCompanyReviewedDepartments.AddRange((from n in reviewsForDL select n.jobDepartment).Distinct().OrderBy(x => x).ToList()); jobDepartments = new List <JobDepartment>(); if (allCompanyReviewedDepartments.Count > 0) { foreach (string department in allCompanyReviewedDepartments) { JobDepartment jobDepartment = new JobDepartment { departmentName = department, isSelected = true }; jobDepartments.Add(jobDepartment); } } Cmb_Departments.ItemsSource = jobDepartments; allCompanyReviewedLocations.AddRange((from n in reviewsForDL select n.jobLocation).Distinct().OrderBy(x => x).ToList()); jobLocations = new List <JobLocation>(); if (allCompanyReviewedLocations.Count > 0) { foreach (string location in allCompanyReviewedLocations) { JobLocation jobLocation = new JobLocation { location = location, isSelected = true }; jobLocations.Add(jobLocation); } } Cmb_Locations.ItemsSource = jobLocations; }
public async Task <DomainModel.Models.JobLocation> CreateJobLocation(DomainModel.Models.JobLocation jobLocation) { if (jobLocation.Id == null) { var jl = new JobLocation { StreetAddress = jobLocation.StreetAddress, City = jobLocation.City, State = jobLocation.State, Country = jobLocation.Country, Zip = jobLocation.Zip }; context.JobLocation.Add(jl); await context.SaveChangesAsync(); jobLocation.Id = jl.Id; } return(jobLocation); }
private void UpdateLocation(string[] selectedLocation, int id, Posting postingToUpdate) { if (selectedLocation == null) { postingToUpdate.JobLocations = new List <JobLocation>(); return; } var selectedLocationHS = new HashSet <string>(selectedLocation); var postingLocations = new HashSet <int>(db.JobLocations.Where(l => l.PostingID == id).Select(l => l.LocationID)); foreach (var l in db.Locations) { var LocationToUpdate = db.Locations.Find(l.ID); JobLocation jobLocation = new JobLocation { Posting = postingToUpdate, Location = LocationToUpdate, PostingID = id, LocationID = l.ID }; if (selectedLocationHS.Contains(l.ID.ToString())) { if (!postingLocations.Contains(l.ID)) { db.JobLocations.Add(jobLocation); } } else { if (postingLocations.Contains(l.ID)) { var selectedItem = (from a in db.JobLocations where a.PostingID == id && a.LocationID == l.ID select a).Single(); db.JobLocations.Remove(selectedItem); } } } }
public void SaveJobPost(JobPost jobPost) { using (var dbContext = new InternshipDbContext()) { if (jobPost.JobPostID == 0) { dbContext.JobPosts.Add(jobPost); } else { JobPost dbEntry = dbContext.JobPosts.Find(jobPost.JobPostID); if (dbEntry != null) { JobType jbType = new JobType(); jbType.JobTypeID = jobPost.JobType.JobTypeID; dbEntry.JobType = jbType; Company comp = new Company(); comp.CompanyID = jobPost.Company.CompanyID; dbEntry.Company = comp; JobLocation jbLocation = new JobLocation(); jbLocation.JobLocationID = jobPost.JobLocation.JobLocationID; dbEntry.JobLocation = jbLocation; JobPostSkillSet jbPostSkillset = new JobPostSkillSet(); jbPostSkillset.JobPostSkillSetID = jobPost.JobPostSkillSet.JobPostSkillSetID; dbEntry.JobPostSkillSet = jbPostSkillset; dbEntry.JobDescription = jobPost.JobDescription; dbEntry.IsActive = jobPost.IsActive; dbEntry.IsCompanyNameHidden = jobPost.IsCompanyNameHidden; dbEntry.PostedByID = 1; dbEntry.CreatedDate = DateTime.Now; } } dbContext.SaveChanges(); } }
public async Task <JobLocation> CreateJobLocation([FromBody] JobLocation jobLocation) => await jobPostRepository.CreateJobLocation(jobLocation);
private void handleLocationCheckbox(CheckBox selectedCheckBox) { JobLocation selectedJobLocation = (JobLocation)selectedCheckBox.DataContext; bool isSelectAllCheckbox = false; if (selectedJobLocation.location == "Select all") { isSelectAllCheckbox = true; } foreach (JobLocation eachlocation in jobLocations) { if (eachlocation.location == "Select all" && (eachlocation.isSelected == true) && (isSelectAllCheckbox == false)) { eachlocation.isSelected = !eachlocation.isSelected; continue; } if (isSelectAllCheckbox) { eachlocation.isSelected = (bool)selectedCheckBox.IsChecked; } } bool isAllLocationSelected = (from n in jobLocations where n.isSelected == false select n).Count() == 1; if (isAllLocationSelected) { JobLocation selectAllLocation = (from n in jobLocations where n.location == "Select all" select n).ToList()[0]; selectAllLocation.isSelected = true; } foreach (JobLocation location in jobLocations) { if (location.isSelected == true) { if (location.location == "Select all") { companyReviewFilter.addLocation("All locations"); break; } else { companyReviewFilter.addLocation(location.location); } } } ObservableCollection <CompanyReview> tempReviews = companyReviewFilter.filterByCriteria(); Itc_reviews.ItemsSource = tempReviews; if (tempReviews.Count > 0) { isNoDataVisible = false; } else { isNoDataVisible = true; } Itc_FilterTags.ItemsSource = companyReviewFilter.getUIFilterTags(); }
public static void InitializeRestDataAsync(ApplicationDbContext context) { //Initialize Job Department Data if (context.JobDepartment.Any()) { } else { var departments = new JobDepartment[] { new JobDepartment { Id = 1, Name = "Business Opeartion" }, new JobDepartment { Id = 2, Name = "Engineering" }, new JobDepartment { Id = 3, Name = "IT Infrastructure" } }; foreach (JobDepartment s in departments) { context.JobDepartment.Add(s); } context.SaveChanges(); } //Initialize Job Experience Data if (context.JobExperience.Any()) { } else { var experiences = new JobExperience[] { new JobExperience { Id = 1, Name = "Intern" }, new JobExperience { Id = 2, Name = "Junior" }, new JobExperience { Id = 3, Name = "Experiences" } }; foreach (JobExperience s in experiences) { context.JobExperience.Add(s); } context.SaveChanges(); } //Initialize Job Location Data if (context.JobLocation.Any()) { } else { var locations = new JobLocation[] { new JobLocation { Id = 1, City = "San Diego" }, new JobLocation { Id = 2, City = "Huston" } }; foreach (JobLocation l in locations) { context.JobLocation.Add(l); } context.SaveChanges(); } //Initialize Job Data if (context.Job.Any()) { } else { var jobs = new Job[] { new Job { Id = 1, DeId = 2, ExId = 1, LId = 1, Name = "Summer 2019 .Net Engineer Intern", Description = JobDescription, PostDate = new DateTime(2018, 12, 25), Status = true }, new Job { Id = 2, DeId = 2, ExId = 1, LId = 1, Name = "Summer 2019 Software Engineer Intern", Description = JobDescription, PostDate = new DateTime(2019, 01, 15), Status = true }, new Job { Id = 3, DeId = 1, ExId = 2, LId = 2, Name = "Energy Market Analyst", Description = JobDescription, PostDate = new DateTime(2019, 01, 20), Status = true } }; foreach (Job j in jobs) { context.Job.Add(j); } context.SaveChanges(); } if (context.JobRequirement.Any()) { } else { var requirements = new JobRequirement[] { new JobRequirement { Id = 1, JobId = 1, Skill = "C#" }, new JobRequirement { Id = 2, JobId = 1, Skill = "SQL" }, new JobRequirement { Id = 3, JobId = 1, Skill = "Computer Science" }, new JobRequirement { Id = 4, JobId = 1, Skill = "ASP.NET CORE" }, new JobRequirement { Id = 5, JobId = 1, Skill = "Algorithm" }, new JobRequirement { Id = 6, JobId = 1, Skill = "Bachelor" }, new JobRequirement { Id = 7, JobId = 1, Skill = "MVC" }, new JobRequirement { Id = 8, JobId = 1, Skill = "Software Engineer" }, new JobRequirement { Id = 9, JobId = 1, Skill = "Java" }, new JobRequirement { Id = 10, JobId = 1, Skill = "C++" } }; foreach (var item in requirements) { context.JobRequirement.Add(item); } context.SaveChanges(); } }
public ActionResult Create([Bind(Include = "ID,pstNumPosition,pstFTE,pstSalary,pstCompensationType,pstJobDescription,pstOpenDate,pstEndDate,pstJobStartDate,pstJobEndDate,Enabled,PositionID" /*,CreatedBy,CreatedOn,UpdatedBy,UpdatedOn,RowVersion"*/)] Posting posting, string[] selectedQualification, string[] selectedDay, string[] selectedLocation, string[] selectedSkill, bool?SavedAsTemplate, string templateName) { try { string Locations = ""; string Requirements = ""; string Days = ""; string Skills = ""; if (SavedAsTemplate == null) { SavedAsTemplate = false; } if (selectedQualification != null) { foreach (var r in selectedQualification) { Requirements += r + ","; var qualificateToAdd = db.Qualification.Find(int.Parse(r)); JobRequirement jobRequirement = new JobRequirement { Posting = posting, Qualification = qualificateToAdd, PostingID = posting.ID, QualificationID = qualificateToAdd.ID }; db.JobRequirements.Add(jobRequirement); } } if (selectedLocation != null) { foreach (var l in selectedLocation) { Locations += l + ","; var locationToAdd = db.Locations.Find(int.Parse(l)); JobLocation jobLocation = new JobLocation { Posting = posting, Location = locationToAdd, PostingID = posting.ID, LocationID = locationToAdd.ID }; db.JobLocations.Add(jobLocation); } } if (selectedSkill != null) { foreach (var s in selectedSkill) { Skills += s + ","; var skillToAdd = db.Skills.Find(int.Parse(s)); PostingSkill postingSkill = new PostingSkill { Posting = posting, Skill = skillToAdd, PostingID = posting.ID, SkillID = skillToAdd.ID }; db.PostingSkills.Add(postingSkill); } } if (selectedDay != null) { posting.Days = new List <Day>(); foreach (var d in selectedDay) { Days += d + ","; var dayToAdd = db.Days.Find(int.Parse(d)); posting.Days.Add(dayToAdd); } } if (ModelState.IsValid) { if ((bool)SavedAsTemplate) { SavedAsTemplate_fn(templateName, posting, Requirements, Skills, Locations, Days); } db.Postings.Add(posting); db.SaveChanges(); return(RedirectToAction("Index")); } } catch (RetryLimitExceededException) { logger.Error("Create/ Retry Limit Exceeded For Update"); ModelState.AddModelError("", "Unable to save changes after multiple attemps. Try Again!"); } catch (DataException dex) { logger.Error("Create/ Data Exception Error '{0}'", dex.ToString()); if (dex.InnerException.InnerException.Message.Contains("IX_Unique_Code")) { ModelState.AddModelError("PositionCode", "Unable to save changes. The Position Code is already existed."); } if (dex.InnerException.InnerException.Message.Contains("IX_Unique_Name")) { ModelState.AddModelError("", "Unable to save changes. The Template Name is already existed."); } else if (dex.InnerException.InnerException.Message.Contains("IX_Unique_Desc")) { ModelState.AddModelError("PositionDescription", "Unable to save changes. The Position can not have the same name."); } else { ModelState.AddModelError("", "Unable to save changes. Try Again!"); } } if (templateName != null) { posting = Template_fn(templateName, posting); return(View(posting)); } PopulateListBox(); PopulateDropdownList(posting); PopulateAssignedDay(posting); return(View(posting)); }
public async System.Threading.Tasks.Task <List <string> > AsyncJobGetLocations(string location) { List <string> lstLocations = new List <string>(); DbHelper.JobLocations = new List <JobLocation>(); //var baseAddress = new Uri(Constants.JobBaseAddress); var cookieContainer = new CookieContainer(); CFNetworkHandler networkHandler = new CFNetworkHandler(); networkHandler.UseSystemProxy = true; networkHandler.CookieContainer = cookieContainer; using (var handler = new HttpClientHandler() { CookieContainer = cookieContainer }) using (var client = new HttpClient(handler)) { try { string locationURL = Constants.LocationURL + "key=" + Constants.LocationKey + "&maxResults=" + Constants.maxResults + "&countryRegion=" + Constants.countryRegion + "&c=" + Constants.JobDetailCurrentLanguage + "&locality=" + location; string URL = Constants.GoogleLocation.Replace("##LOCATION##", location); HttpResponseMessage httpResponse = new HttpResponseMessage(); if (Constants.isGoogleLocation.Equals("1")) { httpResponse = await client.GetAsync(URL); } else { httpResponse = await client.GetAsync(locationURL); } // if we are using google locaton api then if (Constants.isGoogleLocation.Equals("1") && (httpResponse.StatusCode == HttpStatusCode.OK)) { string responseContent = await httpResponse.Content.ReadAsStringAsync(); dynamic responseObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); dynamic predictions = responseObj["predictions"]; //dynamic resourceList = resourceSets[0]["resources"]; foreach (JObject resource in predictions.Children <JObject>()) { foreach (JProperty property in resource.Properties()) { if (property.Name == "description") { lstLocations.Add(property.Value.ToString()); } if (property.Name == "point") { JobLocation obj = property.Value.ToObject <JobLocation>(); DbHelper.JobLocations.Add(obj); } } } } else if (httpResponse.StatusCode == HttpStatusCode.OK) { string responseContent = await httpResponse.Content.ReadAsStringAsync(); dynamic responseObj = Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); dynamic resourceSets = responseObj["resourceSets"]; dynamic resourceList = resourceSets[0]["resources"]; foreach (JObject resource in resourceList.Children <JObject>()) { foreach (JProperty property in resource.Properties()) { if (property.Name == "name") { lstLocations.Add(property.Value.ToString()); } if (property.Name == "point") { JobLocation obj = property.Value.ToObject <JobLocation>(); DbHelper.JobLocations.Add(obj); } } } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } return(lstLocations); }