public JsonResult _SubmitOfferMessage(int applicationid, int requisitionid, string finalmessage, OfferLetterViewModel offerdetails) { bool action = false; try { var interview = db.Interviews.Where(x => x.JobApplicationID == applicationid); interview.First().JobOfferMessage = finalmessage; db.SaveChanges(); var applicant = db.JobApplications.Include("JobSeeker").Where(x => x.JobApplicationID == applicationid).First().JobSeeker; string applicantemail, jobtitle; using (ApplicationDbContext context = new ApplicationDbContext()) { var UserManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(context)); applicantemail = UserManager.FindById(applicant.UserId).Email; } jobtitle = db.JobRequisitions.Find(requisitionid).JobTitle; // _messaging = new SendJobOfferEmail(applicantemail, applicant.FullName, jobtitle); _messaging = new SendJobOfferEmail("*****@*****.**", applicant.FullName, jobtitle, finalmessage); _messaging.SendEmailToApplicant(); action = true; } catch { } return(Json(action, JsonRequestBehavior.AllowGet)); }
public JsonResult _NotifyApplicant(int id) { var guide = db.WelcomeGuides.Find(id); _messaging = new NotifyOnboardingEmail("*****@*****.**", guide.Name, guide.Position, Url.Action("Applicant", "Onboarding", new { guideurl = guide.previewurl })); _messaging.SendEmailToApplicant(); return(Json(true, JsonRequestBehavior.AllowGet)); }
public JsonResult _NotifyApplicant(int id) { var guide = db.WelcomeGuides.Find(id); _messaging = new NotifyOnboardingEmail("*****@*****.**", guide.Name, guide.Position, "http://localhost:54105" + "/Onboarding/Applicant/" + guide.previewurl); _messaging.SendEmailToApplicant(); return(Json(true, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> Edit([Bind(Include = "ID,LeaveAppID,EmployeeId,EmployeeName,StartDate,ResumptionDate,Duration,Status,ApplyDate,LeaveType")] LeaveResumption leaveResumption) { if (ModelState.IsValid) { var employee = _repo.GetEmployee(int.Parse(leaveResumption.EmployeeId)); if (leaveResumption.Status == LeaveResumption.LeaveResumptionStatus.Approved) { LeaveApplication leaveapplication = db.LeaveApplications.Find(leaveResumption.LeaveAppID); if (leaveapplication.LeavePlanID != null) { ManageEmployeeLeave leaveplan = db.ManageEmployeeLeaves.Find(leaveapplication.LeavePlanID); if (leaveplan.TotalLeaveAvailable == null) { leaveplan.TotalLeaveAvailable = leaveplan.LeaveLimit; } if (leaveplan.TotalLeaveTaken == null) { leaveplan.TotalLeaveTaken = 0; } leaveplan.TotalLeaveTaken += leaveResumption.Duration; leaveplan.TotalLeaveAvailable -= leaveResumption.Duration; } if (leaveapplication.TotalLeaveAvailable == null) { leaveapplication.TotalLeaveAvailable = leaveapplication.LeaveLimit; } if (leaveapplication.TotalLeaveTaken == null) { leaveapplication.TotalLeaveTaken = 0; } leaveapplication.TotalLeaveAvailable -= leaveResumption.Duration; leaveapplication.TotalLeaveTaken += leaveResumption.Duration; string FilePath = Server.MapPath("~/Assets/EmailTemplate/LeaveApproved.cshtml"); StreamReader str = new StreamReader(FilePath); string MailText = str.ReadToEnd(); str.Close(); MailText = MailText.Replace("[Date]", DateTime.Now.ToShortDateString()); MailText = MailText.Replace("[StartDate]", leaveResumption.StartDate.ToShortDateString()); MailText = MailText.Replace("[ResumptionDate]", leaveResumption.ResumptionDate.ToShortDateString()); MailText = MailText.Replace("[Name]", employee.FullName); MailText = MailText.Replace("[HRName]", "Bolaji Fashola"); _emailhandler = new LeaveApplicationAcceptedEmail(MailText); _emailhandler.SendEmail("*****@*****.**", ""); } db.Entry(leaveResumption).State = EntityState.Modified; await db.SaveChangesAsync(); //await Task.Delay(50); return(RedirectToAction("Index")); } return(View(leaveResumption)); }
private void SendEmailToApplicant(string applicantemail = "*****@*****.**", string applicantname = "", string emailtype = "") { _messaging = new ConfirmInterviewEmail(applicantemail, applicantname); _messaging.SendEmailToApplicant(); }