public string PopulateBody(ApplyJobModel apply) { var JobTitle = apply.JobTitle; var FirstName = apply.FirstName; var LastName = apply.LastName; var Phone = apply.Phone; var Email = apply.Email; var LinkedIn = apply.LinkedIn; var Information = apply.Information; var Country = apply.Country; string Path_URL = HttpRuntime.AppDomainAppPath; string body = string.Empty; using (StreamReader reader = new StreamReader(Path_URL + "/Views/Partials/EmailTemplate/ApplyJobEmail.cshtml")) { body = reader.ReadToEnd(); } body = body.Replace("{JobTitle}", JobTitle); body = body.Replace("{FirstName}", FirstName); body = body.Replace("{LastName}", LastName); body = body.Replace("{Phone}", Phone); body = body.Replace("{Email}", Email); body = body.Replace("{LinkedIn}", LinkedIn); body = body.Replace("{Information}", Information); body = body.Replace("{Country}", Country); return(body); }
public ActionResult Edit(int?id) { if (!id.HasValue) { return(RedirectToAction("List")); } var applyJob = applyJobService.GetById(id.Value); if (applyJob == null) { this.NotifyError("Item not found."); return(RedirectToAction("List")); } if (applyJob.IsRead == false) { applyJob.IsRead = true; applyJobService.Save(applyJob); } var model = new ApplyJobModel { Id = applyJob.Id, FullName = applyJob.FullName, Email = applyJob.Email, Phone = applyJob.Phone, ApplyDate = applyJob.ApplyDateUtc, Message = applyJob.Message, IsActive = applyJob.IsActive, JobName = applyJob.Job.Title }; return(View(model)); }
public string TestData(ApplyJobModel apply) { var result = ""; result = PopulateBody(apply); return(result); }
public ActionResult ApplyJob(ApplyJobModel model) { var jobApplication = Mapper.Map <JobApplication>(model); jobApplication.FilingDate = DateTime.Now; jobApplication.InterviewResult = InterviewResults.UnderConsideration; this.jobsAppRepo.SaveOrUpdate(jobApplication); return(RedirectToAction("Index")); }
public string SendEmailSubcribe(ApplyJobModel apply) { var subject = "Subcribe Email"; var siteConfig = Umbraco.Content(2865); var recipientEmail = siteConfig.Value("subscribeEmailRecieve").ToString();; var configEmailSender = siteConfig.Value("emailSender").ToString(); var configSMTP = siteConfig.Value("sMTP").ToString(); int configPort = int.Parse(siteConfig.Value("port").ToString()); var configPassword = siteConfig.Value("password").ToString(); try { if (ModelState.IsValid) { var senderEmail = new MailAddress(configEmailSender, "Rouse Subcribe Email"); var receiverEmail = new MailAddress(recipientEmail, "Receiver"); var password = configPassword; var sub = subject; //var body = message; var body = SubcribeEmailBody(apply); var smtp = new SmtpClient { Host = configSMTP, Port = configPort, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(senderEmail.Address, password) }; using (var mess = new MailMessage(senderEmail, receiverEmail) { }) { mess.IsBodyHtml = true; mess.Body = body; mess.Subject = subject; smtp.Send(mess); } return(""); } } catch (Exception) { } return(""); }
public string SubcribeEmailBody(ApplyJobModel apply) { var Email = apply.Email; string Path_URL = HttpRuntime.AppDomainAppPath; string body = string.Empty; using (StreamReader reader = new StreamReader(Path_URL + "/Views/Partials/EmailTemplate/SubcribleEmail.cshtml")) { body = reader.ReadToEnd(); } body = body.Replace("{Email}", Email); return(body); }
public ActionResult ApplyJob(long id) { var curUser = this.usersRepo.FindOne(new UserByLoginSpecify(User.Identity.Name)); var job = this.jobsRepo.FindOne(new ByIdSpecify <Job>(id)); var model = new ApplyJobModel { JobId = id, UserId = curUser.Id, Department = job.Department.Title, Project = job.Project.ProjectFormalizeName.FormalizeName, Salary = job.Salary, JobDescription = job.Description, JobTitle = job.Title }; return(View(model)); }
public ActionResult Edit(ApplyJobModel model) { if (model == null) { return(RedirectToAction("List")); } if (ModelState.IsValid) { var applyJob = applyJobService.GetById(model.Id); if (applyJob == null) { this.NotifyError("Item not found."); return(RedirectToAction("List")); } else { applyJob.IsActive = model.IsActive; applyJob.FullName = model.FullName; applyJob.Email = model.Email; applyJob.Phone = model.Phone; applyJob.Message = model.Message; var result = applyJobService.Save(applyJob); if (result) { this.NotifySuccess("Successfully saved."); } else { this.NotifyError("Item can not saved!"); } } } return(View(model)); }
public string SendEmail(ApplyJobModel apply) { var subject = "Application for " + apply.JobTitle; string URL = HttpRuntime.AppDomainAppPath; string jobCountry = apply.Country; var file = URL + apply.Cv; var extension = Path.GetExtension(file); var listCountry = Umbraco.Content(Guid.Parse("a7cfa562-c717-4ca1-a0c8-7b9518b4f484")) .Children().OfTypes("whereWeWorkMain") .Where(x => x.IsVisible()); var siteConfig = Umbraco.Content(2865); var recipientEmail = ""; var configEmailSender = siteConfig.Value("emailSender").ToString(); var configSMTP = siteConfig.Value("sMTP").ToString(); int configPort = int.Parse(siteConfig.Value("port").ToString()); var configPassword = siteConfig.Value("password").ToString(); try { foreach (var item in listCountry) { if (item.Value("countryName").ToString().Trim().ToLower() == jobCountry.Trim().ToLower()) { recipientEmail = item.Value("recipientEmail").ToString(); } } } catch (Exception e) { recipientEmail = ""; } try { if (ModelState.IsValid) { var senderEmail = new MailAddress(configEmailSender, "Rouse Career Apply Job"); var receiverEmail = new MailAddress(recipientEmail, "Receiver"); var password = configPassword; var sub = subject; //var body = message; var body = PopulateBody(apply); var smtp = new SmtpClient { Host = configSMTP, Port = configPort, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(senderEmail.Address, password) }; using (var mess = new MailMessage(senderEmail, receiverEmail) { //Subject = subject, //Body = message }) { System.Net.Mail.Attachment attachment; attachment = new System.Net.Mail.Attachment(file); attachment.Name = apply.Name + extension; mess.IsBodyHtml = true; mess.Body = body; mess.Subject = subject; mess.Attachments.Add(attachment); smtp.Send(mess); } return(""); } } catch (Exception) { } return(""); }