private string FillEmailTemplate(StudentAlertModel s, ThresholdTypeModel thresholdType, string imageUrl) { var template = loadEmailTemplate(); var filledTemplate = template.Replace("{{StudentAlertMessage}}", $"Your student has {s.ValueCount} missing assignments.") .Replace("{{StudentFullName}}", $"{s.FirstName} {s.LastSurname}") .Replace("{{StudentLocalId}}", s.StudentUSI.ToString()) .Replace("{{StudentImageUrl}}", imageUrl) .Replace("{{MetricTitle}}", "Missing Assignments at or above threshold") .Replace("{{MetricValue}}", $"{s.ValueCount}/{thresholdType.ThresholdValue}") .Replace("{{StudentDetailUrl}}", _urlProvider.GetStudentDetailUrl(s.StudentUSI)) .Replace("{{WhatCanParentDo}}", thresholdType.WhatCanParentDo); return(filledTemplate); }
private string FillEmailTemplate(StudentAlertModel s, ThresholdTypeModel thresholdType, string imageUrl) { var template = loadEmailTemplate(); var filledTemplate = template.Replace("{{StudentAlertMessage}}", $"Your student has {s.ValueCount} grades below threshold.") .Replace("{{StudentFullName}}", $"{s.FirstName} {s.LastSurname}") .Replace("{{StudentLocalId}}", s.StudentUSI.ToString()) .Replace("{{StudentImageUrl}}", imageUrl) .Replace("{{MetricTitle}}", "") .Replace("{{MetricValue}}", $"{AddCoursesToMailTemplate(s.Courses)}") .Replace("{{StudentDetailUrl}}", _urlProvider.GetStudentDetailUrl(s.StudentUSI)) .Replace("{{WhatCanParentDo}}", thresholdType.WhatCanParentDo); return(filledTemplate); }
private string FillEmailTemplate(StudentAlertModel s, ThresholdTypeModel excusedThreshold, ThresholdTypeModel unexcusedThreshold, ThresholdTypeModel tardyThreshold, string imageUrl) { var template = loadEmailTemplate(); var filledTemplate = template.Replace("{{StudentAlertMessage}}", $"Your student has {s.AbsenceCount} absences.") .Replace("{{StudentFullName}}", $"{s.FirstName} {s.LastSurname}") .Replace("{{StudentLocalId}}", s.StudentUSI.ToString()) .Replace("{{StudentImageUrl}}", imageUrl) .Replace("{{MetricTitle}}", "Absences at or above threshold") .Replace("{{MetricValue}}", $"<ul><li style='text-align:left'>Excused: {s.ExcusedCount}/{excusedThreshold.ThresholdValue}</li><li style='text-align:left'>Unexcused: {s.UnexcusedCount}/{unexcusedThreshold.ThresholdValue}</li><li style='text-align:left'>Tardy: {s.TardyCount}/{tardyThreshold.ThresholdValue}</li></ul>") .Replace("{{StudentDetailUrl}}", _urlProvider.GetStudentDetailUrl(s.StudentUSI)) .Replace("{{WhatCanParentDo}}", excusedThreshold.WhatCanParentDo); return(filledTemplate); }