Beispiel #1
0
        public async Task SendEmailAsync(Models.Supervisor supervisor, IList <Models.Project> projects, string supervisorStatus, string projectStatus)
        {
            var username = HttpContext.Session.GetString("_username");

            var coordinator = await _context.Coordinator.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(c => c.AssignedId == username);

            var projectString = "";

            foreach (var item in projects)
            {
                projectString += $"Project ID: {item.AssignedId} \r\nProject Title: {item.ProjectTitle} \r\n \r\n";
            }

            var mailsubject = "FYP System - Supervisor and Project Status Update";
            var mailbody    = $@"Dear {supervisor.SupervisorName}, 

Your status in the FYP System had changed to: {supervisorStatus}

These following projects had changed to {projectStatus}.

{projectString}

Please contact the Coordinator if you found any problem or difficulty using the system. Thank You.

Yours Sincerely,
{coordinator.CoordinatorName}
(FYP Coordinator)";

            await _emailSender.SendEmailAsync(coordinator.CoordinatorEmail, supervisor.SupervisorEmail, mailsubject, mailbody);
        }
Beispiel #2
0
        public async Task SendEmailAsync(Models.Supervisor supervisor, string supervisorStatus)
        {
            var username = HttpContext.Session.GetString("_username");

            var coordinator = await _context.Coordinator.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(c => c.AssignedId == username);

            var mailsubject = "FYP System - Supervisor Status Update";
            var mailbody    = "";

            if (supervisorStatus == "Committee")
            {
                mailbody = $@"Dear {supervisor.SupervisorName}, 

You had been assigned as FYP Committee Member.

Please contact the Coordinator if you found any problem or difficulty using the system. Thank You.

Yours Sincerely,
{coordinator.CoordinatorName}
(FYP Coordinator)";
            }
            if (supervisorStatus == "Not Committee")
            {
                mailbody = $@"Dear {supervisor.SupervisorName}, 

You had been removed as FYP Committee Member. 

Please contact the Coordinator if you found any problem or difficulty using the system. Thank You.

Yours Sincerely,
{coordinator.CoordinatorName}
(FYP Coordinator)";
            }

            await _emailSender.SendEmailAsync(coordinator.CoordinatorEmail, supervisor.SupervisorEmail, mailsubject, mailbody);
        }