Example #1
0
        private static XmlEmailNotificationAction ToXmlModel(IeEmailNotificationAction ieAction, IDictionary <string, int> propertyTypeMap)
        {
            if (ieAction == null)
            {
                return(null);
            }

            var xmlAction = new XmlEmailNotificationAction
            {
                Name    = ieAction.Name,
                Emails  = ieAction.Emails,
                Message = ieAction.Message
            };

            if (ieAction.PropertyName != null)
            {
                int propertyTypeId;
                if (!propertyTypeMap.TryGetValue(ieAction.PropertyName, out propertyTypeId))
                {
                    throw new ExceptionWithErrorCode(
                              I18NHelper.FormatInvariant("Id of Standard Property Type '{0}' is not found.",
                                                         ieAction.PropertyName),
                              ErrorCodes.UnexpectedError);
                }
                xmlAction.PropertyTypeId = propertyTypeId;
            }
            return(xmlAction);
        }
        private EmailNotificationAction ToEmailNotificationAction(XmlEmailNotificationAction emailNotification)
        {
            var action = new EmailNotificationAction
            {
                PropertyTypeId = emailNotification.PropertyTypeId,
                Message        = emailNotification.Message
            };

            action.Emails.AddRange(emailNotification.Emails);
            return(action);
        }