public ActionResult AddMyTecgnologies(technology_resume objectTechnology) { if (objectTechnology.rank == null && objectTechnology.core_technology == null) { objectTechnology.rank = 0; objectTechnology.core_technology = false; } else if (objectTechnology.rank == null) { objectTechnology.rank = 0; } else if (objectTechnology.core_technology == null) { objectTechnology.core_technology = false; } FullResumeOperations resumeOperations = new FullResumeOperations(); resumeOperations.AddMyTechnologies(objectTechnology.technology_id, objectTechnology.resume_id, objectTechnology.core_technology, objectTechnology.rank); // CV:t hämtas för att listan med kompetenser ska uppdateras FullResume fullResume = resumeOperations.GetFullResumeById(objectTechnology.resume_id); int num = db.SaveChanges(); return(Json(num)); }
private void GetEducationsListByResume(FullResume fullResume) { //fullResume.MyEducations = new List<education>(); try { var list = (from ed in db.education join re in db.resume on ed.resume_id equals re.resume_id where ed.resume_id == fullResume.Resume_id select new { ed.resume_id, ed.title, ed.description, ed.date, ed.education_id, ed.resume }).ToList(); foreach (var item in list) { education edu = new education(); edu.date = item.date; edu.description = item.description; edu.education_id = item.education_id; edu.resume = item.resume; edu.resume_id = item.resume_id; edu.title = item.title; fullResume.MyEducations.Add(edu); } } catch (SqlException ex) { //TODO: gör något med felmeddelandet throw; } }
private void GetCompetenceList(FullResume fullResume) //Metod för att hämta teknologier på inskickad freelancerVM och lagra dessa i en lista { string sql = "SELECT competence_id, name FROM competence"; competence c; try { using (SqlConnection conn = new SqlConnection(GetBuilder().ConnectionString)) { conn.Open(); using (SqlCommand command = new SqlCommand(sql, conn)) { command.Parameters.AddWithValue("resume_id", fullResume.Resume_id); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { c = new competence() { competence_id = (reader.GetInt32(0)), name = (reader.GetString(1)) }; fullResume.Competences.Add(c); } } } } } catch (Exception) { // gör något med felmeddelandet throw; } }
public ActionResult RemoveMyCompetences(competence competence) { FullResumeOperations resumeOperations = new FullResumeOperations(); resumeOperations.RemoveMyCompetences(competence.competence_id, competence.resume_id); // CV:t hämtas för att listan med kompetenser ska uppdateras FullResume fullResume = resumeOperations.GetFullResumeById(competence.resume_id); int num = db.SaveChanges(); return(Json(num)); }
public ActionResult RemoveMyTecgnologies(technology_resume objectTechnology) { FullResumeOperations resumeOperations = new FullResumeOperations(); resumeOperations.RemoveMyTechnologies(objectTechnology.technology_id, objectTechnology.resume_id); // CV:t hämtas för att listan med kompetenser ska uppdateras FullResume fullResume = resumeOperations.GetFullResumeById(objectTechnology.resume_id); int num = db.SaveChanges(); return(Json(num)); }
public IActionResult Resume(FullResume model, char Separator) { //ViewData["Message"] = "Your application description page."; ViewData["Message"] = "Submitted!! You can get a result in Analysis Tab"; int splitUnit = 5; if (Separator.Equals(".")) { Separator = '.'; splitUnit = 5; } else if (Separator.Equals("blank")) { Separator = ' '; splitUnit = 30; } else { Separator = '\n'; splitUnit = 5; } // int splitUnit = 30; String[] word = model.Context.Split(Separator); int wordLen = word.Length; int arrSize = wordLen / splitUnit + 1; PartialResume[] wordArr = new PartialResume[arrSize]; StringBuilder sb = null; for (int i = 0; i < arrSize - 1; i++) { sb = new StringBuilder(); for (int j = i * splitUnit; j < (i + 1) * splitUnit; j++) { sb.AppendLine(word[j]); } wordArr[i] = new PartialResume(); wordArr[i].Context = sb.ToString(); sb = null; } sb = new StringBuilder(); for (int i = (arrSize - 1) * splitUnit; i < wordLen; i++) { sb.AppendLine(word[i]); } wordArr[arrSize - 1] = new PartialResume(); wordArr[arrSize - 1].Context = sb.ToString(); sb = null; ViewBag.partialContext = wordArr; return(View()); }
//FreelancerProfileOperations fp = new FreelancerProfileOperations(); public FullResume GetFullResumeById(int?id) //Metod för att hämta information om en freelancer { FullResume fullResume = new FullResume(); string sql = "SELECT freelancer.freelancer_id, firstname, lastname, resume_id, profile, driving_license from resume INNER JOIN freelancer on resume.freelancer_id = freelancer.freelancer_id WHERE resume.resume_id = @resume_id"; try { using (SqlConnection conn = new SqlConnection(GetBuilder().ConnectionString)) { conn.Open(); using (SqlCommand command = new SqlCommand(sql, conn)) { command.Parameters.AddWithValue("resume_id", id); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { fullResume.Freelancer_id = reader.GetInt32(0); fullResume.Firstname = reader.GetString(1); fullResume.Lastname = reader.GetString(2); fullResume.Resume_id = reader.GetInt32(3); fullResume.Profile = reader.GetString(4); fullResume.Driving_license = reader.GetString(5).Trim(); } } } } GetMyCompetences(fullResume); GetMyTechnologies(fullResume); GetCompetenceList(fullResume); GetTechnologyList(fullResume); GetEducationsListByResume(fullResume); } catch (Exception) { // gör något med felmeddelandet throw; } return(fullResume); }
public void GetMyTechnologies(FullResume fullResume) //Metod för att hämta teknologier på inskickad freelancerVM och lagra dessa i en lista { fullResume.MyTechnologies.Clear(); string sql = "SELECT technology.technology_id, technology.name, technology_resume.rank, " + "technology_resume.core_technology, technology.competence_id from technology_resume " + "INNER JOIN technology on technology_resume.technology_id = technology.technology_id " + "WHERE resume_id = @resume_id"; FullTechnology t; try { using (SqlConnection conn = new SqlConnection(GetBuilder().ConnectionString)) { conn.Open(); using (SqlCommand command = new SqlCommand(sql, conn)) { command.Parameters.AddWithValue("resume_id", fullResume.Resume_id); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { t = new FullTechnology() { technology_id = (reader.GetInt32(0)), name = (reader.GetString(1)), rank = (reader.GetInt32(2)), core_technology = (reader.GetBoolean(3)), competence_id = (reader.GetInt32(4)), }; fullResume.MyTechnologies.Add(t); } } } } } catch (Exception) { // gör något med felmeddelandet throw; } }
public ActionResult Edit([Bind(Include = "resume_id,freelancer_id,driving_license,profile")] FullResume fullResume) { resume resume = new resume(); resume.resume_id = fullResume.Resume_id; resume.freelancer_id = fullResume.Freelancer_id; resume.driving_license = fullResume.Driving_license; resume.profile = fullResume.Profile.Trim(); if (ModelState.IsValid) { db.Entry(resume).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details", "freelancers", new { id = resume.freelancer_id })); //return RedirectToAction("Index"); } //ViewBag.freelancer_id = new SelectList(db.freelancer, "freelancer_id", "firstname", resume.freelancer_id); return(View(resume)); }
private void GetMyCompetences(FullResume fullResume)//Metod för att hämta kompetenser på inskickad freelancerVM och lagra dessa i en lista { fullResume.MyCompetences.Clear(); competence c; string sql = "SELECT competence.competence_id, resume_id, name from competence_resume " + "INNER JOIN competence on competence_resume.competence_id = competence.competence_id " + "WHERE resume_id = @resume_id"; try { using (SqlConnection conn = new SqlConnection(GetBuilder().ConnectionString)) { conn.Open(); using (SqlCommand command = new SqlCommand(sql, conn)) { command.Parameters.AddWithValue("resume_id", fullResume.Resume_id); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { c = new competence() { competence_id = (reader.GetInt32(0)), resume_id = (reader.GetInt32(1)), name = (reader.GetString(2)) }; fullResume.MyCompetences.Add(c); } } } } } catch (Exception) { //gör något med felmeddelandet throw; } }
public void GetTechnologyList(FullResume fullResume) //Metod för att hämta teknologier med inskickad ResumeVM och lagra dessa i en lista { fullResume.Technologies.Clear(); foreach (competence competence in fullResume.MyCompetences) { string sql = "SELECT name, technology_id FROM technology WHERE competence_id = @competenceID"; technology t; try { using (SqlConnection conn = new SqlConnection(GetBuilder().ConnectionString)) { conn.Open(); using (SqlCommand command = new SqlCommand(sql, conn)) { command.Parameters.AddWithValue("competenceID", competence.competence_id); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { t = new technology() { name = (reader.GetString(0)), technology_id = (reader.GetInt32(1)) }; fullResume.Technologies.Add(t); } } } } } catch (Exception) { // gör något med felmeddelandet throw; } } }