public ActionResult ResumeFileEdit([Bind(Include = "Id,ResumeId,PdfFile")] ResumeFile resumeFile) { string ext = System.IO.Path.GetExtension(resumeFile.PdfFile.FileName); ViewBag.ext = ext; if (resumeFile.PdfFile.ContentLength > 0 && ext == ".pdf") { string filename = ""; filename = resumeFile.ResumeId + ext; resumeFile.Path = "../../UploadedResume/" + filename; filename = System.IO.Path.Combine(Server.MapPath("~/UploadedResume/"), filename); resumeFile.PdfFile.SaveAs(filename); resumeFile.UploadedAt = DateTime.Now; if (ModelState.IsValid) { db.Entry(resumeFile).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ResumeFile")); } ModelState.Clear(); } else { ViewBag.ext = ViewBag.ext + " Not Valid Formate of File"; } return(View(resumeFile)); }
public void TestEmailContents() { // Create a member. var member = CreateMember(); // Create a resume. var resume = new ResumeFile { Contents = "This is my resume", FileName = "Test.doc" }; // Send the email. var templateEmail = new ResumeAttachmentEmail(member, resume); _emailsCommand.TrySend(templateEmail); // Check. var email = _emailServer.AssertEmailSent(); email.AssertAddresses(Return, Return, member); email.AssertSubject(Subject); email.AssertHtmlViewChecks(); email.AssertHtmlView(GetBody(templateEmail, member, GetContent(templateEmail, member))); email.AssertAttachment(resume.FileName, "application/msword"); AssertCompatibleAddresses(email); }
public async Task <ActionResult> DeleteConfirmed(string id) { AspNetUser aspNetUser = await db.AspNetUsers.FindAsync(id); Resume resume = db.Resumes.FirstOrDefault(m => m.UserId == id); ResumeFile resumefile = db.ResumeFiles.FirstOrDefault(m => m.Resume.UserId == id); if (System.IO.File.Exists(resumefile.Path)) { System.IO.File.Delete(resumefile.Path); } var job = db.JobApplies.Where(m => m.Resume.UserId == id).ToList(); foreach (JobApply i in job) { var j = db.Jobs.FirstOrDefault(m => m.Id == i.JobId); j.JobSeeker = j.JobSeeker + 1; db.SaveChanges(); db.JobApplies.Remove(i); } db.ResumeFiles.Remove(resumefile); db.Resumes.Remove(resume); db.AspNetUsers.Remove(aspNetUser); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public void Resume_Integration_WordFile_Exists_WordExistsReturnTrue() { var resume = new ResumeFile(basePath + "\\resume.docx", DocumentType.Word, stop, preFact, docFact); var word = "work"; var res = resume.Exists(word); Assert.AreEqual(true, res); }
public void Resume_Integration_WordFile_Exists_WordNotExistsReturnFalse() { var basePath = Helpers.GetProjectDir(); var resume = new ResumeFile(basePath + "\\resume.docx", DocumentType.Word, stop, preFact, docFact); var word = "poop"; var res = resume.Exists(word); Assert.AreEqual(false, res); }
public JsonResult UploadResume() { HttpPostedFileBase httpPostedFileBase = Request.Files["myPDF"]; string resumeId = _Util.Facade.CreateCVFacade.GetResumeId(User.Identity.Name); PersonalDetail _PersonalDetail = _Util.Facade.CreateCVFacade.GetPersonalDetailByResumeId(resumeId); string returnfilename = ""; bool result = false; if (httpPostedFileBase != null && httpPostedFileBase.ContentLength != 0) { string extention = Path.GetExtension(httpPostedFileBase.FileName); if (extention == ".pdf" || extention == ".doc" || extention == ".docx") { _PersonalDetail.Name = _PersonalDetail.Name.Replace(' ', '-'); int count = 0; string fileName = ""; if (_Util.Facade.CreateCVFacade.GetAllResumeByResumeId(resumeId).Count != 0) { ResumeFile resume = _Util.Facade.CreateCVFacade.GetAllResumeByResumeId(resumeId).Last(); resume.FileName = Path.GetFileName(resume.ResumeLocation); var split = resume.FileName.Split('.'); split = split[0].Split('-'); //split = split[1]; count = Convert.ToInt32(split[3]); fileName = _PersonalDetail.Name + "{0}-" + ++count + "{1}"; } else { fileName = _PersonalDetail.Name + "{0}-" + ++count + "{1}"; } string resumefolder = AppConfig.UserResumeFolder; string profileImageFolderPath = Server.MapPath("~/" + resumefolder + resumeId); returnfilename = resumefolder + resumeId + "/" + string.Format(fileName, "full", extention); ResumeFile resumeFile = new ResumeFile(); resumeFile.ResumeId = new Guid(resumeId); resumeFile.ResumeLocation = "/" + returnfilename; resumeFile.IsActive = true; _Util.Facade.CreateCVFacade.InsertResume(resumeFile, out _error); if (FileHelper.CreateFolderIfNeeded(profileImageFolderPath)) { var path = Path.Combine(profileImageFolderPath, string.Format(fileName, "full", extention)); httpPostedFileBase.SaveAs(path); result = true; } } else { result = false; return(Json(new { success = result, filename = "Invalid" })); } } return(Json(new { success = result, filename = returnfilename })); }
public ActionResult ResumeFileEdit(int?id) { if (id == null) { return(HttpNotFound()); } ResumeFile resumeFile = db.ResumeFiles.Find(id); if (resumeFile == null) { return(HttpNotFound()); } return(View(resumeFile)); }
public override TemplateEmail GeneratePreview(Community community) { // Create a member. var member = CreateMember(community); // Create a resume. var resume = new ResumeFile { Contents = "This is my resume", FileName = "Test" }; // Send the email. return(new ResumeAttachmentEmail(member, resume)); }
public async Task <List <Listing> > SearchListings(int resumeId, string phrase, string location, bool isFullTime) { //load resumes var resumeEntity = uow.ResumeRepository.GetById(resumeId); if (resumeEntity == null) { throw new ArgumentNullException("Resume was null"); } var listings = await listingService.SearchListings(phrase, location, isFullTime); var resume = new ResumeFile(resumeEntity); return(ranker.Rank(resume, listings)); }
public List <Listing> Rank(ResumeFile resume, List <Listing> listings) { //count keyword matches in each listing and calc percentage foreach (var l in listings) { var matchCnt = 0; foreach (var w in resume.Words) { if (l.Words.Contains(w)) { matchCnt++; } } l.PercentMatch = Math.Round(Convert.ToDecimal(matchCnt) / Convert.ToDecimal(l.Words.Count), 4); } return(listings.OrderByDescending(x => x.PercentMatch).ToList()); }
public IActionResult Upload(ResumeFileViewModel resumeFileViewModel) { string fileName = string.Empty; if (ModelState.IsValid) { if (resumeFileViewModel.File != null && resumeFileViewModel.File.Length > 0) { // Retrieve file name fileName = ContentDispositionHeaderValue.Parse(resumeFileViewModel.File.ContentDisposition).FileName.Trim('"'); // Create unique name string uniqueName = Convert.ToString(Guid.NewGuid()); // Retrieve file extension string fileExtension = Path.GetExtension(fileName); // Concat name and extension string newName = uniqueName + fileExtension; // Add new path fileName = Path.Combine(_env.WebRootPath, "resume-files") + $@"\{newName}"; } ; ResumeFile newResume = new ResumeFile { UserName = HttpContext.User.Identity.Name, UserId = _userManager.GetUserId(User), FileName = HttpContext.User.Identity.Name + "Resume", FilePath = fileName }; context.Resume.Add(newResume); context.SaveChanges(); } ; return(RedirectToAction("/Job")); }
public ResumeAttachmentEmail(ICommunicationUser to, ResumeFile resumeFile) : base(to) { _resumeFile = resumeFile; }
public List <Listing> Rank(ResumeFile resume, List <Listing> listings) { return(strategy.Rank(resume, listings)); }
private static string GetResumeValue(ResumeFile resumeFile) { return(Convert.ToBase64String(Encoding.ASCII.GetBytes(resumeFile.Contents))); }
public async Task <ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl) { if (User.Identity.IsAuthenticated) { return(RedirectToAction("Index", "Manage")); } if (ModelState.IsValid) { // Get the information about the user from the external login provider var info = await AuthenticationManager.GetExternalLoginInfoAsync(); if (info == null) { return(View("ExternalLoginFailure")); } var user = new ApplicationUser { UserName = model.Email, Email = model.Email, CreatedAt = DateTime.Now }; user.Role = "Jobseeker"; var result = await UserManager.CreateAsync(user); if (result.Succeeded) { Entities db = new Entities(); var role = new AspNetUserRole(); role.UserId = user.Id; role.RoleId = "3"; db.AspNetUserRoles.Add(role); db.SaveChanges(); Resume rs = new Resume(); rs.UserId = user.Id; rs.Name = user.UserName; db.Resumes.Add(rs); db.SaveChanges(); ResumeFile rf = new ResumeFile(); rf.ResumeId = rs.Id; rf.Path = "~/ADD RESUME"; db.ResumeFiles.Add(rf); db.SaveChanges(); result = await UserManager.AddLoginAsync(user.Id, info.Login); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); return(RedirectToLocal(returnUrl)); } } AddErrors(result); } ViewBag.ReturnUrl = returnUrl; return(View(model)); }
public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email, FullName = model.FullName, Address = model.Address, PhoneNumber = model.PhoneNo, CreatedAt = DateTime.Now, Role = model.Role }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); Entities db = new Entities(); AspNetUserRole ab = new AspNetUserRole(); ab.UserId = user.Id; if (user.Role == "Jobseeker") { ab.RoleId = "3"; Resume rs = new Resume(); rs.Address = user.Address; rs.MobileNo = user.PhoneNumber; rs.UserId = user.Id; rs.Name = user.FullName; db.Resumes.Add(rs); db.SaveChanges(); ResumeFile rf = new ResumeFile(); rf.ResumeId = rs.Id; rf.Path = "~/ADD RESUME"; db.ResumeFiles.Add(rf); db.SaveChanges(); } if (user.Role == "Recruiter") { ab.RoleId = "2"; Recruiter re = new Recruiter(); re.Name = user.FullName; re.UserId = user.Id; db.Recruiters.Add(re); db.SaveChanges(); } ab.AssignAt = DateTime.Now; db.AspNetUserRoles.Add(ab); db.SaveChanges(); return(RedirectToAction("Index", "Home")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
public void Insert(ResumeFile entity) { resumeFileRepository.Insert(entity); }
public void Update(ResumeFile entity) { resumeFileRepository.Update(entity); }
public void Resume_Integration_WordFile_Ctor_FileNotExistsException() { var resume = new ResumeFile(basePath + "\\oops.docx", DocumentType.Word, stop, preFact, docFact); }