Exemplo n.º 1
0
        /// <summary>
        /// Sends an email notification in response to an event.
        /// </summary>
        /// <param name="toAddress">
        /// E-mail address to which to send the notification.
        /// </param>
        /// <param name="content">
        /// Content of the email payload
        /// </param>
        /// <param name="isEarn">Is Earn</param>
        internal void SendEmailNotification(string toAddress, NotificationContent content, bool isEarn = false)
        {
            string fromAddress = isEarn ? FromAddressEarn : FromAddressClo;
            string fromDisplay = isEarn ? FromFieldTextEarn : FromFieldTextClo;

            // Build the send e-mail request.
            EmailContent emailContent = new EmailContent
            {
                From        = fromAddress,
                FromDisplay = fromDisplay,
                Subject     = content.Subject,
                HtmlBody    = content.HtmlBody,
                TextBody    = content.TextBody
            };

            SendEmailRequest sendEmailRequest = new SendEmailRequest
            {
                Content = emailContent,
                IsTest  = false,
                ToList  = new List <string> {
                    toAddress
                }
            };

            // Send the e-mail.
            try
            {
                // Use a generous timeout to ensure best chance of success. Because this can be a time consuming call, consumers
                //  should run notifications on a separate thread.
                UserServicesClient.SendEmail(Context.Log.ActivityId, sendEmailRequest, new TimeSpan(0, 0, 0, 5, 0));
            }
            catch (HttpRequestException ex)
            {
                Context.Log.Warning("Unable to send notification. {0}", ex.Message);
            }
        }
Exemplo n.º 2
0
 public UserLoginPresenter(IUserLoginView loginview)
 {
     this.loginview = loginview;
     this.user      = new UserServicesClient();
 }
 public UserRegisterPresenter(IUserRegisterView registeruser)
 {
     this.User         = new UserServicesClient();
     this.registeruser = registeruser;
 }