Exemplo n.º 1
0
        //--------------------------Methods related to Email------------------------
        /// <summary>
        /// Provides Email body for specified Enum. If Enum is not found then returns empty string.
        /// </summary>
        /// <param name="subject"></param>
        /// <param name="bodyParameters"></param>
        /// <returns></returns>
        public static string GetBody(this EmailSubjects subject, params object[] bodyParameters)
        {
            string htmlBody = string.Empty;

            //    htmlBody += " <html>";
            //    htmlBody += "<body>";
            //    htmlBody += "<table>";
            //    htmlBody += "<tr>";
            //    htmlBody += "<td>User Name : </td><td> HAi </td>";
            //    htmlBody += "</tr>";

            //    htmlBody += "<tr>";
            //    htmlBody += "<td>Password : </td><td>aaaaaaaaaa</td>";
            //    htmlBody += "</tr>";
            //    htmlBody += "</table>";
            //    htmlBody += "</body>";
            //    htmlBody += "</html>";

            switch (subject)
            {
            case EmailSubjects.NewUser:
                htmlBody = $"Hi {bodyParameters[0]},\n\rYou have successfully registered as a nicheBees User. \nYour username: {bodyParameters[1]},\nPassword: {bodyParameters[2]}";
                break;

            case EmailSubjects.ChangePassword:
                htmlBody = $"Hi {bodyParameters[0]},\n\rYour password for the username '{bodyParameters[1]}' is updated successfully. \nNew Password: {bodyParameters[2]}";
                break;

            default:
                break;
            }
            return(htmlBody);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Provides Email subject for specified Enum. If Enum is not found then returns empty string.
        /// </summary>
        /// <param name="subject"></param>
        /// <param name="subjects"></param>
        /// <returns></returns>
        public static string GetSubject(this EmailSubjects subject, Subjects subjects)
        {
            string subj = string.Empty;

            switch (subject)
            {
            case EmailSubjects.NewUser:
                subj = subjects.NewUser;
                break;

            case EmailSubjects.ChangePassword:
                subj = subjects.ChangePassword;
                break;

            default:
                break;
            }
            return(subj);
        }