public ActionResult Create(int vacancyId) { JobRequirement jobRequirement = new JobRequirement(); jobRequirement.VacancyId = vacancyId; return(View(jobRequirement)); }
public static void InsertNewJobRequirement(JobRequirement jobRequirement) { using (MoreHolidaysDBEntities db = new MoreHolidaysDBEntities()) { db.JobRequirements.Add(jobRequirement); db.SaveChanges(); } }
private void gridRequirements_CellClick(object sender, ODGridClickEventArgs e) { if (e.Button == MouseButtons.Right) { return; } //Do not check ReadOnly here. List <JobRequirement> listRequirements = GetListJobRequirements(); JobRequirement jobRequirement = listRequirements[e.Row]; switch (e.Col) { case 1: //Expert jobRequirement.HasExpert = !jobRequirement.HasExpert; listRequirements[e.Row] = jobRequirement; SetListJobRequirements(listRequirements); OnTextEdited(); break; case 2: //Engineer jobRequirement.HasEngineer = !jobRequirement.HasEngineer; listRequirements[e.Row] = jobRequirement; SetListJobRequirements(listRequirements); OnTextEdited(); break; case 3: //Reviewer jobRequirement.HasReviewer = !jobRequirement.HasReviewer; listRequirements[e.Row] = jobRequirement; SetListJobRequirements(listRequirements); OnTextEdited(); break; case 4: //Up if (e.Row == 0) { return; } listRequirements.Reverse(e.Row - 1, 2); SetListJobRequirements(listRequirements); OnTextEdited(); break; case 5: //Down if (e.Row == gridRequirements.ListGridRows.Count - 1) { return; } listRequirements.Reverse(e.Row, 2); SetListJobRequirements(listRequirements); OnTextEdited(); break; default: //Do Nothing break; } }
public static void UpdateJobRequirement(JobRequirement jobRequirement) { using (MoreHolidaysDBEntities db = new MoreHolidaysDBEntities()) { var q = db.JobRequirements.FirstOrDefault(a => a.Id == jobRequirement.Id); if (q != null) { q.Details = jobRequirement.Details; q.ArabicDetails = jobRequirement.ArabicDetails; db.SaveChanges(); } } }
private int AddNewRequirement() { List <JobRequirement> listRequirements = GetListJobRequirements(); JobRequirement jobRequirement = new JobRequirement(); jobRequirement.Description = ""; jobRequirement.HasExpert = false; jobRequirement.HasEngineer = false; jobRequirement.HasReviewer = false; listRequirements.Add(jobRequirement); SetListJobRequirements(listRequirements); OnTextEdited(); return(listRequirements.Count() - 1); }
private void gridRequirements_CellLeave(object sender, ODGridClickEventArgs e) { List <JobRequirement> listRequirements = GetListJobRequirements(); JobRequirement jobRequirement = listRequirements[e.Row]; jobRequirement.Description = gridRequirements.ListGridRows[e.Row].Cells[e.Col].Text; //Reset the "X" columns that act like check boxes if the description of the requirement just changed. if (listRequirements[e.Row].Description != jobRequirement.Description) { jobRequirement.HasExpert = false; jobRequirement.HasEngineer = false; jobRequirement.HasReviewer = false; } listRequirements[e.Row] = jobRequirement; SetListJobRequirements(listRequirements); OnTextEdited(); }
public ActionResult Edit(int id) { JobRequirement JobRequirement = new JobRequirement(); try { JobRequirement = JobRequirementsLogic.GetJobRequirementById(id); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "MoreHolidays/JobRequirements/Edit(Get)", Parameters = "id=" + id }); } return(View("Edit", JobRequirement)); }
private void UpdatePositionQualification(string[] selectedQualification, int id, Posting postingToUpdate) { if (selectedQualification == null) { postingToUpdate.JobRequirements = new List <JobRequirement>(); return; } var selectQualificationsHS = new HashSet <string>(selectedQualification); var PostingQualifications = new HashSet <int>(db.JobRequirements.Where(j => j.PostingID == id).Select(j => j.QualificationID)); foreach (var q in db.Qualification) { var QualificationToUpdate = db.Qualification.Find(q.ID); JobRequirement jobRequirement = new JobRequirement { Posting = postingToUpdate, Qualification = QualificationToUpdate, PostingID = id, QualificationID = q.ID }; if (selectQualificationsHS.Contains(q.ID.ToString())) { if (!PostingQualifications.Contains(q.ID)) { db.JobRequirements.Add(jobRequirement); } } else { if (PostingQualifications.Contains(q.ID)) { var selectedItem = (from a in db.JobRequirements where a.PostingID == id && a.QualificationID == q.ID select a).Single(); db.JobRequirements.Remove(selectedItem); } } } }
public ActionResult Create(JobRequirement jobRequirement) { if (ModelState.IsValid) { try { JobRequirementsLogic.InsertNewJobRequirement(jobRequirement); return(RedirectToAction("Index", new { vacancyId = jobRequirement.VacancyId })); } catch (Exception e) { LogsLogic.InsertLog(new Log() { Message = e.Message, StackTrace = e.StackTrace, StoryName = "MoreHolidays/JobRequirements/Create(Post)" }); return(View(jobRequirement)); } } return(View(jobRequirement)); }
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 static void UpdateJobRequirement(JobRequirement jobRequirement) { JobRequirementsRepositories.UpdateJobRequirement(jobRequirement); }
public static void InsertNewJobRequirement(JobRequirement JobRequirement) { JobRequirementsRepositories.InsertNewJobRequirement(JobRequirement); }