diff --git a/Sevomin.Models/Helpers/SevominRegistry.cs b/Sevomin.Models/Helpers/SevominRegistry.cs deleted file mode 100644 index d045f92..0000000 --- a/Sevomin.Models/Helpers/SevominRegistry.cs +++ /dev/null @@ -1,20 +0,0 @@ -using FluentScheduler; -using Sevomin.Models.Helpers.ScheduledTasks; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Sevomin.Models.Helpers -{ - public class SevominRegistry : Registry - { - public SevominRegistry() - { - Schedule().ToRunEvery(2).Days().At(20, 30); - Schedule().ToRunEvery(1).Days().At(20, 40); - Schedule().ToRunEvery(1).Days().At(20, 50); - } - } -} diff --git a/Sevomin.Models/Sevomin.Models.csproj b/Sevomin.Models/Sevomin.Models.csproj index effe160..e976575 100644 --- a/Sevomin.Models/Sevomin.Models.csproj +++ b/Sevomin.Models/Sevomin.Models.csproj @@ -88,7 +88,6 @@ - 201409010546480_basepoint.cs diff --git a/Sevomin.WebFrontend.Controllers/JobController.cs b/Sevomin.WebFrontend.Controllers/JobController.cs index dabef29..fb2b384 100644 --- a/Sevomin.WebFrontend.Controllers/JobController.cs +++ b/Sevomin.WebFrontend.Controllers/JobController.cs @@ -241,7 +241,33 @@ namespace Sevomin.WebFrontend.Controllers return View(new DovominJobViewModel(dj)); } - dj = _jobRepository.Apply(user, job, CoverLetter); + dj = _jobRepository.Apply(user, job, CoverLetter); + + /* Send instant email to Avalin */ + try + { + SevominEmailer emailer = new SevominEmailer(); + emailer.EmailType = EmailType.NewApplication; + emailer.Parameters.Add("avalin-name", job.Avalin.DisplayName); + emailer.Parameters.Add("avalin-contact", string.IsNullOrWhiteSpace(dj.Job.ContactPersonName) ? "" : dj.Job.ContactPersonName); + emailer.Parameters.Add("dovomin-name", dj.Dovomin.DisplayName); + + if (string.IsNullOrWhiteSpace(dj.Job.ContactPersonEMail)) + await emailer.SendAsync(job.Avalin.Email, "اعلام آمادگی جدید برای فرصت شغلی اعلام شده در سومین", true); + else + { + await emailer.SendAsync(job.Avalin.Email, "اعلام آمادگی جدید برای فرصت شغلی اعلام شده در سومین", true); + await emailer.SendAsync(dj.Job.ContactPersonEMail, "اعلام آمادگی جدید برای فرصت شغلی اعلام شده در سومین", true); + } + } + catch (Exception e) + { + var elmah = new Elmah.Error(e); + + Elmah.ErrorLog.GetDefault(System.Web.HttpContext.Current).Log(elmah); + } + /* End send instant email to avalin */ + ViewBag.Result = new PostResultViewModel(true, "اعلام آمادگی شما برای این فرصت شغلی ثبت شد."); return View(new DovominJobViewModel(dj)); } diff --git a/Sevomin.WebFrontend/Global.asax.cs b/Sevomin.WebFrontend/Global.asax.cs index c3fe35b..0dab855 100644 --- a/Sevomin.WebFrontend/Global.asax.cs +++ b/Sevomin.WebFrontend/Global.asax.cs @@ -16,8 +16,7 @@ namespace Sevomin.WebFrontend protected void Application_Start() { AreaRegistration.RegisterAllAreas(); - RouteConfig.RegisterRoutes(RouteTable.Routes); - TaskManager.Initialize(new SevominRegistry()); + RouteConfig.RegisterRoutes(RouteTable.Routes); Application["ApplicationStart"] = DateTime.Now; } diff --git a/Sevomin.WebFrontend/Web.config b/Sevomin.WebFrontend/Web.config index 781808e..c8375d6 100644 --- a/Sevomin.WebFrontend/Web.config +++ b/Sevomin.WebFrontend/Web.config @@ -34,9 +34,9 @@ - - - + + +