public bool Save(IFeedDataSavingProviderContext context)
        {
            if (!ProviderIsSuitable(context.Mapping, context.FeedSyncProfilePart.ContentType))
            {
                return(false);
            }

            var commonPart = context.Content.As <CommonPart>();

            if (commonPart == null)
            {
                return(false);
            }

            var dateValue = default(DateTime);

            if (!DateTimeHelper.TryParseDateTime(context.FeedContent.First(), out dateValue))
            {
                return(false);
            }

            commonPart.PublishedUtc = dateValue;

            return(true);
        }
コード例 #2
0
        public bool Save(IFeedDataSavingProviderContext context)
        {
            if (!ProviderIsSuitable(context.Mapping, context.FeedSyncProfilePart.ContentType))
            {
                return(false);
            }

            var splitMapping = context.Mapping.ContentItemStorageMapping.Split('.');

            var booleanField = context.Content.AsField <BooleanField>(splitMapping[0], splitMapping[1]);

            if (booleanField == null)
            {
                return(false);
            }

            var booleanValue = default(bool);

            if (!bool.TryParse(context.FeedContent.First(), out booleanValue))
            {
                return(false);
            }
            booleanField.Value = booleanValue;

            return(true);
        }
コード例 #3
0
        public bool Save(IFeedDataSavingProviderContext context)
        {
            if (!ProviderIsSuitable(context.Mapping, context.FeedSyncProfilePart.ContentType))
            {
                return(false);
            }

            var splitMapping = context.Mapping.ContentItemStorageMapping.Split('.');

            var numericField = context.Content.AsField <NumericField>(splitMapping[0], splitMapping[1]);

            if (numericField == null)
            {
                return(false);
            }

            var decimalValue = default(decimal);

            if (!decimal.TryParse(context.FeedContent.First(), NumberStyles.Number, CultureInfo.InvariantCulture, out decimalValue))
            {
                return(false);
            }
            numericField.Value = decimalValue;

            return(true);
        }
コード例 #4
0
        public bool Save(IFeedDataSavingProviderContext context)
        {
            if (!ProviderIsSuitable(context.Mapping, context.FeedSyncProfilePart.ContentType))
            {
                return(false);
            }

            var bodyPart = context.Content.As <BodyPart>();

            if (bodyPart == null)
            {
                return(false);
            }

            bodyPart.Text = context.FeedContent.First();

            return(true);
        }
コード例 #5
0
        public bool Save(IFeedDataSavingProviderContext context)
        {
            if (!ProviderIsSuitable(context.Mapping, context.FeedSyncProfilePart.ContentType))
            {
                return(false);
            }

            var splitMapping = context.Mapping.ContentItemStorageMapping.Split('.');

            var textField = context.Content.AsField <TextField>(splitMapping[0], splitMapping[1]);

            if (textField == null)
            {
                return(false);
            }

            textField.Value = context.FeedContent.First();

            return(true);
        }
コード例 #6
0
        public bool Save(IFeedDataSavingProviderContext context)
        {
            if (!ProviderIsSuitable(context.Mapping, context.FeedSyncProfilePart.ContentType))
            {
                return(false);
            }

            var tagsPart = context.Content.As <TagsPart>();

            if (tagsPart == null)
            {
                return(false);
            }

            foreach (var feedContent in context.FeedContent)
            {
                _tagService.CreateTag(feedContent);
            }

            _tagService.UpdateTagsForContentItem(context.Content.ContentItem, context.FeedContent);

            return(true);
        }