Beispiel #1
0
 /// <summary>
 /// This Method will recive the booking Id, pull out the current status of the booking.
 /// and pull the email message and contacts and sent the email to the contacts.
 /// </summary>
 /// <param name="BookingId"></param>
 /// <returns></returns>
 public bool SendEventMail(int BookingId, ENums.EventName eventName)
 {
     try
     {
         EventEmailHelper eventEmailProxy = new EventEmailHelper();
         return(eventEmailProxy.SendEventMail(BookingId, eventName));
     }
     catch (Exception exp)
     {
         throw exp;
     }
 }
Beispiel #2
0
        private bool PrepareAndSendEmail(int BookingId, ENums.EventName eventName)
        {
            StringBuilder EmailText = new StringBuilder();
            string        text      = string.Empty;

            EventMessageDTO[] EventMessageDTO;
            EventMessageDTO = PrepareEmailMessage(eventName, out text);
            EmailText.Append(text);

            EmailIdDTO emailIdDTO             = new EmailIdDTO();
            EmailIdDTO accomodationEmailIdDto = GetAccomodationContact(BookingId);
            EmailIdDTO userAgentEmailIdDTO    = GetAgentUsersContact(BookingId);

            if (accomodationEmailIdDto != null)
            {
                emailIdDTO.TOs = accomodationEmailIdDto.TOs;
                emailIdDTO.CCs = accomodationEmailIdDto.CCs;
            }
            if (userAgentEmailIdDTO != null)
            {
                if (!String.IsNullOrEmpty(emailIdDTO.TOs.Trim()) && !emailIdDTO.TOs.Trim().EndsWith(";"))
                {
                    emailIdDTO.TOs = emailIdDTO.TOs.Trim() + ";";
                }
                if (!String.IsNullOrEmpty(emailIdDTO.CCs.Trim()) && !emailIdDTO.CCs.Trim().EndsWith(";"))
                {
                    emailIdDTO.CCs = emailIdDTO.CCs.Trim() + ";";
                }
                emailIdDTO.TOs += userAgentEmailIdDTO.TOs;
                emailIdDTO.CCs += userAgentEmailIdDTO.CCs;
            }

            if (String.IsNullOrEmpty(emailIdDTO.TOs.Trim()))
            {
                return(false);
            }
            text = UpdateMessageWithContacts(EmailText.ToString(), emailIdDTO);
            EmailText.Remove(0, EmailText.Length);
            EmailText.Append(text);

            text = PrepareBookingDetails(BookingId);
            text = UpdateMessageWithBookingDetails(EmailText.ToString(), text);
            EmailText.Remove(0, EmailText.Length);
            EmailText.Append(text);

            if (emailIdDTO != null && EventMessageDTO[0] != null)
            {
                SendEmail(emailIdDTO, EventMessageDTO[0], EmailText.ToString());
            }
            return(true);
        }
Beispiel #3
0
        private EventMessageDTO[] PrepareEmailMessage(ENums.EventName eventName, out string EmailMessageText)
        {
            EventMessageMaster eventMessageMaster = new EventMessageMaster();

            EventMessageDTO[] eventMessageDTO   = eventMessageMaster.GetEventMessage(Enum.GetName(typeof(ENums.EventName), eventName));
            string            _EmailMessageText = string.Empty;

            if (eventMessageDTO != null)
            {
                _EmailMessageText = PrepareMessageText(eventMessageDTO[0]);
            }
            EmailMessageText = _EmailMessageText;
            return(eventMessageDTO);
        }
Beispiel #4
0
 /// <summary>
 /// This Method will recive the booking Id, pull out the current status of the booking.
 /// and pull the email message and contacts and sent the email to the contacts.
 /// </summary>
 /// <param name="BookingId"></param>
 /// <returns></returns>
 public bool SendEventMail(int BookingId, ENums.EventName eventName)
 {
     try
     {
         EventEmailHandler eventEmailHandler = new EventEmailHandler();
         return(eventEmailHandler.SendEventMail(BookingId, eventName));
     }
     catch (Exception exp)
     {
         //Swallowing the email exception.
         //throw exp;
         return(false);
     }
 }
Beispiel #5
0
 /// <summary>
 /// This Method will recive the booking Id, pull out the current status of the booking.
 /// and pull the email message and contacts and sent the email to the contacts.
 /// </summary>
 /// <param name="BookingId"></param>
 /// <returns></returns>
 public bool SendEventMail(int bookingId, ENums.EventName eventName)
 {
     return(PrepareAndSendEmail(bookingId, eventName));
 }