Пример #1
0
        private string GetEmailBody(Student student, Requirements emailRequirements)
        {
            var sb = new StringBuilder();

            sb.Append(GetHeader(student, emailRequirements));

            if (emailRequirements.HasFlag(Requirements.Fbi))
            {
                sb.Append(GetTemplate(FbiTemplate));
            }

            if (emailRequirements.HasFlag(Requirements.Fcsr))
            {
                sb.Append(GetTemplate(FcsrTemplate));
            }

            if (emailRequirements.HasFlag(Requirements.Liab))
            {
                sb.Append(GetTemplate(LiabTemplate));
            }

            if (emailRequirements.HasFlag(Requirements.Tb))
            {
                sb.Append(GetTemplate(TbTemplate));
            }

            sb.Append(GetTemplate(FooterTemplate));

            return sb.ToString();
        }
Пример #2
0
        public MailMessage GenerateEmail(Student student, Requirements emailRequirements)
        {
            var mailMessage = new MailMessage(Environment.UserName + "@missouristate.edu", student.Email)
            {
                Subject = EmailSubject,
                SubjectEncoding = Encoding.UTF8,
                BodyEncoding = Encoding.UTF8,
                IsBodyHtml = true,
                Body = GetEmailBody(student, emailRequirements)
            };

            return mailMessage;
        }
Пример #3
0
        private Domain.Student CreateStudentFromRow(Row row)
        {
            var student = new Domain.Student
            {
                Name = row["Name"],
                MNumber = row["M-Number"],
                Email = row["Email_Address"],
                Major = row["Program_Desc"],
                FbiExpiration = string.Join(",", row["FBI_DESE"], row["FBI_MOVECHS"], row["FBW_MOVECHS"]),
                LiabExpiration = row["Liability Insurance Expiration"],
                FcsrExpiration = row["FCSR Expiration Date"],
                TbExpiration = row["TB Test Exp"]
            };

            student.Courses.Add(row["Course ID"].ToString().Split(' ')[0]);

            return student;
        }
Пример #4
0
        private string GetHeader(Student student, Requirements requirements)
        {
            GetTemplate(HeaderTemplate);

            var template = new StringBuilder(Templates[HeaderTemplate.Name]);
            template
                .Replace("%student_name%", student.Name)
                .Replace("%courses%", string.Join(",", student.Courses))
                .Replace("%plural_courses%", student.Courses.Count > 1 ? "courses" : "course")
                .Replace("%class_type%",
                    requirements.HasFlag(Requirements.Practicum) ? "a practicum" : "student teaching")
                .Replace("%plural_documents%", Convert.ToUInt64(requirements) > 1 ? "documents" : "document");

            return template.ToString();
        }