Complete job cleanup service
This commit is contained in:
+52
@@ -0,0 +1,52 @@
|
|||||||
|
namespace BoredCareers.Services {
|
||||||
|
public partial class EmailService {
|
||||||
|
|
||||||
|
// @UserName
|
||||||
|
// @VerifyPassword
|
||||||
|
// https://mistox.com/api/account/verifyemail?UserName=@UserName&Guid=@VerifyPassword
|
||||||
|
|
||||||
|
public static string JobAutoClosedSubject = "Verify Your Email Address";
|
||||||
|
public static string JobAutoClosedEmail = @"
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang=""en"">
|
||||||
|
<head>
|
||||||
|
<meta charset=""UTF-8"">
|
||||||
|
<meta name=""viewport"" content=""width=device-width, initial-scale=1.0"">
|
||||||
|
<title>Verify Your Email</title>
|
||||||
|
</head>
|
||||||
|
<body style=""font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; padding: 0;"">
|
||||||
|
<table role=""presentation"" style=""width: 100%; background-color: #f4f4f4; padding: 20px 0;"">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<table role=""presentation"" style=""max-width: 600px; width: 100%; background-color: #ffffff; margin: 0 auto; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);"">
|
||||||
|
<tr>
|
||||||
|
<td style=""padding: 20px; text-align: center; background-color: #4CAF50; color: #ffffff; border-top-left-radius: 8px; border-top-right-radius: 8px;"">
|
||||||
|
<h2>Verify Email Request</h2>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style=""padding: 20px; text-align: left; font-size: 16px; color: #333333;"">
|
||||||
|
<p>Hi @UserName,</p>
|
||||||
|
<p>Thank you for making an account with us:</p>
|
||||||
|
<p>In order to start using your account we need to verify your email address by clicking the link below:</p>
|
||||||
|
<p style=""text-align: center;"">
|
||||||
|
<a href=""https://mistox.com/account/verifyemail?UserName=@UserName&Guid=@VerifyPassword"" style=""background-color: #4CAF50; color: #ffffff; text-decoration: none; padding: 15px 25px; font-size: 16px; border-radius: 5px; display: inline-block;"">Verify Email</a>
|
||||||
|
</p>
|
||||||
|
<p>If you didn't create an account please ignore this email.</p>
|
||||||
|
<p>Best regards</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style=""padding: 10px; text-align: center; background-color: #f4f4f4; color: #888888; font-size: 12px; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;"">
|
||||||
|
<p>If you have any questions, feel free to <a href=""mailto:webmaster@mistox.com"" style=""color: #4CAF50; text-decoration: none;"">contact support</a>.</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,9 +4,11 @@ namespace BoredCareers.Services.TimerService {
|
|||||||
public class JobCleanupService : BackgroundService {
|
public class JobCleanupService : BackgroundService {
|
||||||
|
|
||||||
private readonly DatabaseService.DatabaseService _db;
|
private readonly DatabaseService.DatabaseService _db;
|
||||||
|
private readonly EmailService _em;
|
||||||
|
|
||||||
public JobCleanupService(DatabaseService.DatabaseService db) {
|
public JobCleanupService(DatabaseService.DatabaseService db, EmailService em) {
|
||||||
_db = db;
|
_db = db;
|
||||||
|
_em = em;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken) {
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken) {
|
||||||
@@ -15,8 +17,10 @@ namespace BoredCareers.Services.TimerService {
|
|||||||
JobListing[] deletedJobListings = await _db.GetJobListingsPastExipre();
|
JobListing[] deletedJobListings = await _db.GetJobListingsPastExipre();
|
||||||
await _db.DeleteJobListingsPastExipre();
|
await _db.DeleteJobListingsPastExipre();
|
||||||
foreach (JobListing listing in deletedJobListings) {
|
foreach (JobListing listing in deletedJobListings) {
|
||||||
// Get applicants for each closed listing
|
Application[] apps = await _db.GetApplicationsFromJobListing(Convert.ToInt32(listing.ID));
|
||||||
// Notify applicants of the listing closing
|
foreach (Application app in apps) {
|
||||||
|
_em.Send(app.ResponseEmail, EmailService.JobAutoClosedSubject, EmailService.JobAutoClosedEmail);
|
||||||
|
}
|
||||||
|
|
||||||
// Mark the company for the auto closed listing
|
// Mark the company for the auto closed listing
|
||||||
Company? comp = await _db.GetCompany(listing.CompanyID);
|
Company? comp = await _db.GetCompany(listing.CompanyID);
|
||||||
|
|||||||
Reference in New Issue
Block a user