public ActionResult saveExp(int?id, ProfessionalExperience exx) { ProfessionalExperience entity = db.ProfessionalExperiences.Find(id); if (entity == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (ModelState.IsValid) { entity.CompanyName = exx.CompanyName; entity.Details = exx.Details; entity.Duration = exx.Duration; entity.JobTitle = exx.JobTitle; entity.Location = exx.Location; entity.ModifiedDate = DateTime.UtcNow; db.Entry(entity).State = EntityState.Modified; db.SaveChanges(); var exs = db.ProfessionalExperiences.ToList(); return(PartialView("~/Areas/Admin/Views/Dashboard/partial/_PartialExperienceList.cshtml", exs)); } return(View()); }
private void SetAccomplishment(ProfessionalExperience current, AccomplishmentViewModel acc) { Accomplishment existing = string.IsNullOrEmpty(acc.Id) ? new Accomplishment { IsRelevant = acc.IsRelevant, Summary = "", Title = acc.Title, } : _accomplishmentService.GetById(Guid.Parse(acc.Id)); if (acc.IsDeleted) { _accomplishmentService.Delete(existing); } else { existing.IsRelevant = acc.IsRelevant; existing.Title = acc.Title; if (string.IsNullOrEmpty(acc.Id)) { current.Accomplishments.Add(existing); } } }
public async Task <IActionResult> Edit(int id, [Bind("ProfessionalExperienceId,DateBegin,DateEnd,Role,Employer,Activities_Responsibilities,ResumeId")] ProfessionalExperience professionalExperience) { if (id != professionalExperience.ProfessionalExperienceId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(professionalExperience); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProfessionalExperienceExists(professionalExperience.ProfessionalExperienceId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Edit", "Resumes", new { id = professionalExperience.ResumeId })); // return RedirectToAction(nameof(Index)); } ViewData["ResumeId"] = new SelectList(_context.Set <Resume>(), "ResumeId", "ResumeId", professionalExperience.ResumeId); return(View(professionalExperience)); }
private void SetTechnicalEnvironment(ProfessionalExperience current, TechnicalEnvironmentViewModel tech) { var existing = string.IsNullOrEmpty(tech.Id) ? new TechnicalEnvironment { IsRelevant = tech.IsRelevant, Name = tech.Name, }: _techService.GetById(Guid.Parse(tech.Id)); if (tech.IsDeleted) { _techService.Delete(existing); } else { existing.IsRelevant = tech.IsRelevant; existing.Name = tech.Name; if (string.IsNullOrEmpty(tech.Id)) { current.TechnicalEnvironments.Add(existing); } } }
private void SetProfessionalExperience(Konsultant newConsultant, ProfessionalExperienceViewModel exper) { ProfessionalExperience current = null; if (!string.IsNullOrEmpty(exper.Id)) { //update values if exists current = _expService.GetById(Guid.Parse(exper.Id)); current.IsRelevant = exper.IsRelevant; current.Position = exper.Position; current.StartDate = exper.StartDate; current.EndDate = exper.EndDate; current.Summary = exper.Summary; } else { //create a new one current = new ProfessionalExperience(exper, newConsultant.Id); } foreach (var acc in exper.Accomplishments) { SetAccomplishment(current, acc); } foreach (var tech in exper.TechnicalEnvironments) { SetTechnicalEnvironment(current, tech); } newConsultant.ProfessionalExperiences.Add(current); }
public async ValueTask AddCareer(string name, ProfessionalExperience career) { var introduceItem = await _redisCacheClient.GetDbFromConfiguration().GetAsync <Introduce>(name.ToLower()); if (introduceItem.Career != null) { var introduceCareer = introduceItem.Career.FirstOrDefault(a => a.Index == career.Index); if (introduceCareer != null) { introduceItem.Career.Remove(introduceCareer); } introduceItem.Career.Add(career); } else { introduceItem.Career = new List <ProfessionalExperience>() { career } }; await _redisCacheClient.GetDbFromConfiguration().ReplaceAsync <Introduce>(introduceItem.Author.Name.ToLower(), introduceItem); }
public ActionResult ExperiencePost(ProfessionalExperience professionalExperience) { if (ModelState.IsValid) { professionalExperience.CreatedDate = DateTime.Now; db.ProfessionalExperience.Add(professionalExperience); db.SaveChanges(); } return(RedirectToAction("EditResumeAdmin")); }
public async Task <IActionResult> Create([Bind("ProfessionalExperienceId,DateBegin,DateEnd,Role,Employer,Activities_Responsibilities,ResumeId")] ProfessionalExperience professionalExperience) { if (ModelState.IsValid) { var result = _context.Resume.First <Resume>(); professionalExperience.ResumeId = result.ResumeId; _context.Add(professionalExperience); await _context.SaveChangesAsync(); //return RedirectToAction(nameof(Index)); return(RedirectToAction("Edit", "Resumes", new { id = professionalExperience.ResumeId })); } ViewData["ResumeId"] = new SelectList(_context.Set <Resume>(), "ResumeId", "ResumeId", professionalExperience.ResumeId); return(View(professionalExperience)); }
public IHttpActionResult Get() { try { ProfessionalExperience exp = service.Get(); if (exp != null) { return(Ok(service.Get())); } else { return(NotFound()); } } catch (Exception ex) { return(InternalServerError(ex)); } }
public ActionResult AddExperiences(ProfessionalExperience experience, HttpPostedFileBase mediaUrl, string fileName) { if (experience == null) { throw new NullReferenceException(); } if (mediaUrl != null) { bool valid = true; if (!mediaUrl.CheckImageType()) { ModelState.AddModelError("mediaUrl", "Şəkil uyğun deyil!"); valid = false; } if (!mediaUrl.CheckImageSize(5)) { ModelState.AddModelError("mediaUrl", "Şəklin ölçüsü uyğun deyil!"); valid = false; } if (valid) { string newPath = mediaUrl.SaveImage(Server.MapPath("~/Template/media")); //System.IO.File.Move(Server.MapPath(System.IO.Path.Combine("~/Template/media", entity.MediaUrl)), // Server.MapPath(System.IO.Path.Combine("~/Template/media", entity.MediaUrl))); experience.MediaUrl = newPath; } } else if (string.IsNullOrWhiteSpace(experience.MediaUrl)) { experience.MediaUrl = null; } if (ModelState.IsValid) { experience.CreationDate = DateTime.UtcNow; db.ProfessionalExperiences.Add(experience); db.SaveChanges(); } return(View("EditCV")); }
public ActionResult AddProEx(ProfessionalExperience ProfExp, HttpPostedFileBase Image, string fileName) { if (Image != null) { bool valid = true; if (!Image.CheckImageType()) { ModelState.AddModelError("mediaUrl", "Şəkil uyğun deyil!"); valid = false; } if (!Image.CheckImageSize(5)) { ModelState.AddModelError("mediaUrl", "Şəklin ölçüsü uyğun deyil!"); valid = false; } if (valid) { string newPath = Image.SaveImage(Server.MapPath("~/Template/Media/")); //System.IO.File.Move(Server.MapPath(System.IO.Path.Combine("~/Template/media", entity.MediaUrl)), // Server.MapPath(System.IO.Path.Combine("~/Template/media", entity.MediaUrl))); ProfExp.Image = newPath; } } else if (!string.IsNullOrWhiteSpace(ProfExp.Image) && !string.IsNullOrWhiteSpace(fileName)) { ProfExp.Image = null; } if (ModelState.IsValid) { ProfExp.CreatedDate = DateTime.Now; db.ProfessionalExperience.Add(ProfExp); db.SaveChanges(); } return(RedirectToAction("EditCV")); }
private ProtechDbContext() { ProfessionalExperience = new ProfessionalExperience("Cristiano", "24"); ProfessionalExperience.TotalExperience = 3; ProfessionalExperience.Formations.Add(new Formation() { Course = "Engenharia Mecatronica", ConclusionDate = "2019", Status = "Concluido" }); ProfessionalExperience.Formations.Add(new Formation() { Course = "Ciência da computação", ConclusionDate = "2022", Status = "Andamento" }); ProfessionalExperience.CompanyExperiences.Add(new CompanyExperience { Company = "Atos Capital", InitialDate = "02/12/2019", FinalDate = "--/--/--", Position = "Desenvolvedor Júnior", DetailExperience = "Desenvolvimento de web crawler utiliznado c#" }); ProfessionalExperience.CompanyExperiences.Add(new CompanyExperience { Company = "Atos Capital", InitialDate = "02/12/2019", FinalDate = "--/--/--", Position = "Desenvolvedor Júnior", DetailExperience = "Desenvolvimento de web crawler utiliznado c#" }); ProfessionalExperience.Experiences.Add(new Experience() { Technology = "c#", TimeExperience = 2, DetailExperience = "desenvolvimento de spiders para coleta de dados em sites" }); }
public ActionResult Index() { try { ProfessionalExperience professionalExperience = service.Get(); ProfessionalExperienceModel model = new ProfessionalExperienceModel() { Name = professionalExperience.Name, DateOfBirth = professionalExperience.DateOfBirth, TotalExperience = professionalExperience.TotalExperience, Formations = professionalExperience.Formations, CompanyExperiences = professionalExperience.CompanyExperiences, Experiences = professionalExperience.Experiences }; return(View(model)); } catch (Exception ex) { return(View()); } }
public ActionResult getEx(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProfessionalExperience exx = db.ProfessionalExperiences.Find(id); if (exx == null) { if (Request.IsAjaxRequest()) { return(Content("")); } return(HttpNotFound()); } if (Request.IsAjaxRequest()) { return(PartialView("~/Areas/Admin/Views/Dashboard/partial/_PartialExperience.cshtml", exx)); } return(View(exx)); }
public async ValueTask PostIntroduce() { var sangWan = new Introduce(); sangWan.Author = new Author() { Name = "Park Sang Wan", Age = 99, CareerYear = (DateTime.Now - new DateTime(1990, 1, 1)).Days / 365, }; sangWan.Carrer = new List <ProfessionalExperience>(); ///Json 파일 읽어서 하는걸로 바꿀것. var professionalExperience = new ProfessionalExperience() { ProjectName = "참좋은여행", Company = "참좋은여행", ImageLink = "#", SkillInventory = new List <string> { "Jquery", "ASP.NET", "반응형" }, }; ProfessionalExperience professionalExperience2 = new ProfessionalExperience() { ProjectName = "참좋은여행 불꽃폭발", Company = "참망한여행", ImageLink = "#", SkillInventory = new List <string> { "Jquery 1.12.4", "반응형" }, }; sangWan.Carrer.Add(professionalExperience); sangWan.Carrer.Add(professionalExperience2); await _redisCacheClient.GetDbFromConfiguration().AddAsync <Introduce>("SangWan", sangWan); }
private async Task SetUserCareerInfo(User user, UserInfoDB userInfo, CancellationToken token) { bool createNew = false; var userCareer = await _db.UserCareerCollection.AsQueryable() .Where(uc => uc.CreatedBy == user.Id) .FirstOrDefaultAsync(); if (userCareer == null) { userCareer = UserCareer.Create(user.Id).Data; createNew = true; } if ( !CellIsEmpty(userInfo.GrauCurso1) || !CellIsEmpty(userInfo.NomeCurso1) || !CellIsEmpty(userInfo.Instituicao1) || !CellIsEmpty(userInfo.AnoInicio1) || !CellIsEmpty(userInfo.AnoConclusao1) || !CellIsEmpty(userInfo.PeriodoAnoConclusao1) || !CellIsEmpty(userInfo.CRAcumulado1) || !CellIsEmpty(userInfo.SituacaoCurso1) || !CellIsEmpty(userInfo.Campus1) ) { var college = new College() { AcademicDegree = userInfo.GrauCurso1, Name = userInfo.NomeCurso1, Title = userInfo.Instituicao1, Campus = userInfo.Campus1, CR = userInfo.CRAcumulado1, Status = userInfo.SituacaoCurso1 }; if (!CellIsEmpty(userInfo.PeriodoAnoConclusao1)) { college.CompletePeriod = Int32.Parse(userInfo.PeriodoAnoConclusao1); } if (!CellIsEmpty(userInfo.AnoInicio1)) { int year = Int32.Parse(userInfo.AnoInicio1); college.StartDate = new DateTime(year, 1, 1); } if (!CellIsEmpty(userInfo.AnoConclusao1)) { int year = Int32.Parse(userInfo.AnoConclusao1); college.EndDate = new DateTime(year, 1, 1); } if (userCareer.Colleges == null) { userCareer.Colleges = new List <College>(); } userCareer.Colleges.Add(college); } if (!CellIsEmpty(userInfo.Ingles)) { var language = new PerkLanguage() { Names = "Inglês", Level = userInfo.Ingles }; if (userCareer.Languages == null) { userCareer.Languages = new List <PerkLanguage>(); } userCareer.Languages.Add(language); } if (!CellIsEmpty(userInfo.Excel)) { var excel = new Perk() { Name = "Excel", Level = userInfo.Excel }; if (userCareer.Abilities == null) { userCareer.Abilities = new List <Perk>(); } userCareer.Abilities.Add(excel); } if (!CellIsEmpty(userInfo.VBA)) { var vba = new Perk() { Name = "VBA", Level = userInfo.VBA }; if (userCareer.Abilities == null) { userCareer.Abilities = new List <Perk>(); } userCareer.Abilities.Add(vba); } if ( !CellIsEmpty(userInfo.Empresa1) || !CellIsEmpty(userInfo.CargoEmpresa1) || !CellIsEmpty(userInfo.DescricaoEmpresa1) ) { var experience = new ProfessionalExperience() { Title = userInfo.Empresa1, Role = userInfo.CargoEmpresa1, Description = userInfo.DescricaoEmpresa1 }; if (userCareer.ProfessionalExperiences == null) { userCareer.ProfessionalExperiences = new List <ProfessionalExperience>(); } userCareer.ProfessionalExperiences.Add(experience); } if (!CellIsEmpty(userInfo.ObjetivoProfissionalCurto) && String.IsNullOrEmpty(userCareer.ShortDateObjectives)) { userCareer.ShortDateObjectives = userInfo.ObjetivoProfissionalCurto; } if (!CellIsEmpty(userInfo.ObjetivoProfissionalLongo) && String.IsNullOrEmpty(userCareer.LongDateObjectives)) { userCareer.LongDateObjectives = userInfo.ObjetivoProfissionalLongo; } if (createNew) { await _db.UserCareerCollection.InsertOneAsync( userCareer, cancellationToken : token ); } else { await _db.UserCareerCollection.ReplaceOneAsync( u => u.CreatedBy == user.Id, userCareer, cancellationToken : token ); } }
public async Task <IActionResult> OnPostAsync(string title, string first_name, string last_name, string father_name, string mother_name, string present_address, string permanent_address, IFormFile profile_img, string phone_number, string mobile_number, DateTime date_of_birth, string gender, string marritual_status, string national_id, string religion, string nationality, string email, string[] qualification, string[] passing_year, string[] subject, string[] grade, string[] university, string[] company_name, DateTime?[] duration_from, string[] company_address, DateTime?[] duration_to, string[] role) { UserModel user = null; user = _db.Users.Include(a => a.Resume).Include(a => a.Resume.Experiences).Include(a => a.Resume.EducationalDetails).Single(aa => aa.Id == _accountManage.User.Id); if (user == null) { return(NotFound()); } Resume resume = new Resume(); resume.Title = title; resume.FirstName = first_name; resume.LastName = last_name; resume.DateOfBirth = date_of_birth; List <string> qualifications = new List <string>(); foreach (var item in qualification) { if (item != "" && item != null) { qualifications.Add(item); } } List <string> Subjects = new List <string>(); foreach (var item in subject) { Subjects.Add(item); } List <string> Institutes = new List <string>(); foreach (var item in university) { Institutes.Add(item); } List <string> passing_years = new List <string>(); foreach (var item in passing_year) { passing_years.Add(item); } List <string> resutls = new List <string>(); foreach (var item in grade) { resutls.Add(item); } List <string> company_names = new List <string>(); foreach (var item in company_name) { if (item != null && item != "") { company_names.Add(item); } } List <string> company_addresses = new List <string>(); foreach (var item in company_address) { company_addresses.Add(item); } List <string> roles = new List <string>(); foreach (var item in role) { roles.Add(item); } List <DateTime?> duration_froms = new List <DateTime?>(); foreach (var item in duration_from) { duration_froms.Add(item); } List <DateTime?> duration_tos = new List <DateTime?>(); foreach (var item in duration_to) { duration_tos.Add(item); } if (qualifications.Count > 0) { resume.EducationalDetails = new List <DegreeDetails>(); for (int i = 0; i < qualifications.Count; i++) { var degree = new DegreeDetails(); degree.Grade = resutls[i]; degree.Institute = Institutes[i]; degree.PassingYear = passing_years[i]; degree.Qualification = qualifications[i]; degree.Subject = Subjects[i]; resume.EducationalDetails.Add(degree); } } resume.Email = email; if (company_names.Count > 0) { resume.Experiences = new List <ProfessionalExperience>(); for (int i = 0; i < company_names.Count; i++) { var experience = new ProfessionalExperience(); experience.CompanyAddress = company_addresses[i]; experience.CompanyName = company_names[i]; experience.DurationFrom = duration_froms[i]; experience.DurationTo = duration_tos[i]; experience.Role = roles[i]; resume.Experiences.Add(experience); } } resume.FatherName = father_name; resume.Gender = gender; resume.MarritualStatus = marritual_status; resume.MobileNumber = mobile_number; resume.MotherName = mother_name; resume.NationalID = national_id; resume.Nationality = nationality; resume.PermanentAddress = permanent_address; resume.PhoneNumber = phone_number; resume.PresentAddress = present_address; if (profile_img != null) { using (var memoryStream = new MemoryStream()) { await profile_img.CopyToAsync(memoryStream); resume.ProfileImage = memoryStream.ToArray(); user.ProfileImage = memoryStream.ToArray(); _accountManage.User.ProfileImage = memoryStream.ToArray(); _accountManage.User.ProfileImageSrc = _accountManage.ImgSrc(_accountManage.User.ProfileImage); } } else { MemoryStream memoryStream = new MemoryStream(); var current_directory = Directory.GetCurrentDirectory(); FileStream fileStream = new FileStream($"{current_directory}/wwwroot/img/user.png", FileMode.Open); await fileStream.CopyToAsync(memoryStream); resume.ProfileImage = memoryStream.ToArray(); user.ProfileImage = memoryStream.ToArray(); _accountManage.User.ProfileImage = memoryStream.ToArray(); _accountManage.User.ProfileImageSrc = _accountManage.ImgSrc(_accountManage.User.ProfileImage); } resume.Religion = religion; user.Resume = resume; await _db.SaveChangesAsync(); var us = _db.Users.Include(u => u.Resume).SingleOrDefault(u => u.Id == _accountManage.User.Id); return(RedirectToPage("./ViewCV", new { id = us.Resume.Id })); }
private static void CreateOrUpdateProfessionalExperience(KlanikContext _context, ProfessionalExperience exp) { var profExpExists = _context.ProfessionalExperiences.Any(x => x.Id == exp.Id); _context.Entry(exp).State = profExpExists ? EntityState.Modified : EntityState.Added; }
public ActionResult AddExperience(ProfessionalExperience newExperiencee, HttpPostedFileBase imgPath, string fileName) { if (imgPath != null) { bool valid = true; if (!imgPath.CheckImageType()) { ModelState.AddModelError("mediaUrl", "Şəkil uyğun deyil!"); valid = false; } if (!imgPath.CheckImageSize(5)) { ModelState.AddModelError("mediaUrl", "Şəklin ölçüsü uyğun deyil!"); valid = false; } if (valid) { string newPath = imgPath.SaveImage(Server.MapPath("~/Template/Media/Experience")); //System.IO.File.Move(Server.MapPath(System.IO.Path.Combine("~/Template/media", entity.MediaUrl)), // Server.MapPath(System.IO.Path.Combine("~/Template/media", entity.MediaUrl))); newExperiencee.imgPath = newPath; } } else if (!string.IsNullOrWhiteSpace(newExperiencee.imgPath) && !string.IsNullOrWhiteSpace(fileName)) { newExperiencee.imgPath = null; } if ((newExperiencee.Location == null) || (newExperiencee.Duration == null) || (newExperiencee.JobTitle == null) || (newExperiencee.CompanyName == null) || (newExperiencee.Details == null)) { TempData["Fill all Inputs Experience"] = "Company's Name, Job Title, Location, Duration, and Details must be filled!! "; return(RedirectToAction("EditPage", "Edit")); } else { ProfessionalExperience newExperience = new ProfessionalExperience { Duration = newExperiencee.Duration, JobTitle = newExperiencee.JobTitle, CompanyName = newExperiencee.CompanyName, Location = newExperiencee.Location, Details = newExperiencee.Details, CreatedDate = DateTime.UtcNow, imgPath = newExperiencee.imgPath, }; db.ProfessionalExperience.Add(newExperiencee); db.SaveChanges(); return(RedirectToAction("EditPage", "Edit")); } }