Ejemplo n.º 1
0
        public static async Task <string> EmailAddOnNotificationRedemption(EmailAddOnNotificationInfo emailInfo)
        {
            var mail = BuildMailInfo(EmailConfig.DefaultSendFromEmail, emailInfo.UserEmail);

            mail.TemplateId = EmailConfig.AvailableAddOnRedemption;
            mail.AddSubstitution("[Hotel_Name]", emailInfo.HotelName);
            mail.AddSubstitution("[Product_Name]", emailInfo.ProductName);
            mail.AddSubstitution("[FirstName]", emailInfo.FirstName);
            mail.AddSubstitution("[AddOnString]", emailInfo.AddOnString);
            mail.AddSubstitution("[CheckInDate]", emailInfo.CheckInDate);
            mail.SendAt = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds + 15 * 60;

            dynamic response = await sendgrid.SendEmailAsync(mail);

            HttpStatusCode      statusCode = response.StatusCode;
            string              result     = response.Body.ReadAsStringAsync().Result;
            HttpResponseHeaders header     = response.Headers;

            return(statusCode + " - " + result + " - " + header);
        }
Ejemplo n.º 2
0
        public static async Task <string> EmailAddOnNotification(EmailAddOnNotificationInfo emailInfo)
        {
            var mail = BuildMailInfo(EmailConfig.DefaultSendFromEmail, emailInfo.UserEmail);

            mail.TemplateId = EmailConfig.AvailableAddOn;
            mail.AddSubstitution("[Hotel_Name]", emailInfo.HotelName);
            mail.AddSubstitution("[Product_Name]", emailInfo.ProductName);
            mail.AddSubstitution("[FirstName]", emailInfo.FirstName);
            mail.AddSubstitution("[AddOnString]", emailInfo.AddOnString);
            mail.AddSubstitution("[CheckInDate]", emailInfo.CheckInDate);
            mail.SendAt = (long)emailInfo.SentAt;

            dynamic response = await sendgrid.SendEmailAsync(mail);

            HttpStatusCode      statusCode = response.StatusCode;
            string              result     = response.Body.ReadAsStringAsync().Result;
            HttpResponseHeaders header     = response.Headers;

            return(statusCode + " - " + result + " - " + header);
        }