Browse Source

Send instant email message to Avalin for each job apply

master
miladkdz 10 years ago
parent
commit
c743f883b3
4 changed files with 19 additions and 24 deletions
  1. +0
    -20
      Sevomin.Models/Helpers/SevominRegistry.cs
  2. +0
    -1
      Sevomin.Models/Sevomin.Models.csproj
  3. +18
    -1
      Sevomin.WebFrontend.Controllers/JobController.cs
  4. +1
    -2
      Sevomin.WebFrontend/Global.asax.cs

+ 0
- 20
Sevomin.Models/Helpers/SevominRegistry.cs View File

@ -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<NewApplication>().ToRunEvery(2).Days().At(20, 30);
Schedule<ExpiringJob>().ToRunEvery(1).Days().At(20, 40);
Schedule<NewJob>().ToRunEvery(1).Days().At(20, 50);
}
}
}

+ 0
- 1
Sevomin.Models/Sevomin.Models.csproj View File

@ -88,7 +88,6 @@
<Compile Include="Helpers\ScheduledTasks\ExpiringJob.cs" /> <Compile Include="Helpers\ScheduledTasks\ExpiringJob.cs" />
<Compile Include="Helpers\ScheduledTasks\NewJob.cs" /> <Compile Include="Helpers\ScheduledTasks\NewJob.cs" />
<Compile Include="Helpers\ScheduledTasks\NewApplication.cs" /> <Compile Include="Helpers\ScheduledTasks\NewApplication.cs" />
<Compile Include="Helpers\SevominRegistry.cs" />
<Compile Include="Migrations\201409010546480_basepoint.cs" /> <Compile Include="Migrations\201409010546480_basepoint.cs" />
<Compile Include="Migrations\201409010546480_basepoint.Designer.cs"> <Compile Include="Migrations\201409010546480_basepoint.Designer.cs">
<DependentUpon>201409010546480_basepoint.cs</DependentUpon> <DependentUpon>201409010546480_basepoint.cs</DependentUpon>


+ 18
- 1
Sevomin.WebFrontend.Controllers/JobController.cs View File

@ -241,7 +241,24 @@ namespace Sevomin.WebFrontend.Controllers
return View(new DovominJobViewModel(dj)); return View(new DovominJobViewModel(dj));
} }
dj = _jobRepository.Apply(user, job, CoverLetter);
dj = _jobRepository.Apply(user, job, CoverLetter);
/* Send instant email to Avalin */
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);
}
/* End send instant email to avalin */
ViewBag.Result = new PostResultViewModel(true, "اعلام آمادگی شما برای این فرصت شغلی ثبت شد."); ViewBag.Result = new PostResultViewModel(true, "اعلام آمادگی شما برای این فرصت شغلی ثبت شد.");
return View(new DovominJobViewModel(dj)); return View(new DovominJobViewModel(dj));
} }


+ 1
- 2
Sevomin.WebFrontend/Global.asax.cs View File

@ -16,8 +16,7 @@ namespace Sevomin.WebFrontend
protected void Application_Start() protected void Application_Start()
{ {
AreaRegistration.RegisterAllAreas(); AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
TaskManager.Initialize(new SevominRegistry());
RouteConfig.RegisterRoutes(RouteTable.Routes);
Application["ApplicationStart"] = DateTime.Now; Application["ApplicationStart"] = DateTime.Now;
} }


Loading…
Cancel
Save