コード例 #1
0
        public async Task SendBirthdayMessageAsync(ApplicationUserManager UserManager, AppMember user, string unSubscribeCallBack)
        {
            string msgBody = "HAPPY BIRTHDAY TO YOU TODAY";

            /*
             * Get the message template for communication preference
             */
            var result = template_manager.findTemplateByTypeAndCommPref((int)MessageTypeId.Birthday, user.CommunicationType);

            if (user.CommunicationType == (int)CommunicationPreferenceId.Email)
            {
                string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);

                await UserManager.SendEmailAsync(user.Id,
                                                 subject : "PPOK Refill System: Birthday Notification",
                                                 body : "HAPPY BIRTHDAY TO YOU TODAY!!!" +
                                                 "<br /><br />" +
                                                 "To unsubscribe, click here " + "<a href=\"" + HttpUtility.HtmlEncode(unSubscribeCallBack) + "\">unsubscribe</a>");
            }

            if (user.CommunicationType == (int)CommunicationPreferenceId.TextMessage)
            {
                var birthdayText = new MessageController();
                birthdayText.SendSms("+1" + user.PhoneNumber, msgBody);
            }

            if (user.CommunicationType == (int)CommunicationPreferenceId.PhoneCall)
            {
                var birthdayVoiceCall = new MessageController();
                birthdayVoiceCall.SendVoiceCall("+1" + user.PhoneNumber);
            }
        }