Esempio n. 1
0
        protected override void Importing(WinXinUserInfoPart part, Orchard.ContentManagement.Handlers.ImportContentContext context)
        {
            var openid     = context.Attribute(part.PartDefinition.Name, "openid");
            var nickname   = context.Attribute(part.PartDefinition.Name, "nickname");
            var sex        = context.Attribute(part.PartDefinition.Name, "sex");
            var province   = context.Attribute(part.PartDefinition.Name, "province");
            var city       = context.Attribute(part.PartDefinition.Name, "city");
            var country    = context.Attribute(part.PartDefinition.Name, "country");
            var headimgurl = context.Attribute(part.PartDefinition.Name, "headimgurl");
            var privilege  = context.Attribute(part.PartDefinition.Name, "privilege");

            var record = new WinXinUserInfoPartRecord
            {
                openid     = openid,
                nickname   = nickname,
                sex        = sex,
                province   = province,
                city       = city,
                country    = country,
                headimgurl = headimgurl,
                privilege  = string.Join(",", privilege),
            };

            _winXinUserInfoPartRecord.Create(record);
        }
Esempio n. 2
0
        protected override void Importing(TwitterWidgetPart part, Orchard.ContentManagement.Handlers.ImportContentContext context)
        {
            var partName = part.PartDefinition.Name;

            part.Username              = context.Attribute(partName, "Username");
            part.Count                 = int.Parse(context.Attribute(partName, "Count"));
            part.CacheMinutes          = int.Parse(context.Attribute(partName, "CacheMinutes"));
            part.ShowAvatars           = Boolean.Parse(context.Attribute(partName, "ShowAvatars"));
            part.ShowUsername          = Boolean.Parse(context.Attribute(partName, "ShowUsername"));
            part.ShowHashtagsAsLinks   = Boolean.Parse(context.Attribute(partName, "ShowHashtagsAsLinks"));
            part.ShowMentionsAsLinks   = Boolean.Parse(context.Attribute(partName, "ShowMentionsAsLinks"));
            part.ShowTimestamps        = Boolean.Parse(context.Attribute(partName, "ShowTimestamps"));
            part.ShowTimestampsAsLinks = Boolean.Parse(context.Attribute(partName, "ShowTimestampsAsLinks"));
            part.HashTagsFilter        = context.Attribute(partName, "HashTagsFilter");
        }
        protected override void Importing(FlexSliderPart part, Orchard.ContentManagement.Handlers.ImportContentContext context)
        {
            string sort = context.Attribute(part.PartDefinition.Name, "Sort");
            byte   sortNumber;

            if (sort != null && byte.TryParse(sort, out sortNumber))
            {
                part.Sort = sortNumber;
            }
            string groupId = context.Attribute(part.PartDefinition.Name, "GroupId");
            byte   groupIdNumber;

            if (groupId != null && byte.TryParse(groupId, out groupIdNumber))
            {
                part.GroupId = groupIdNumber;
            }
        }
        protected override void Importing(TenantPart part, Orchard.ContentManagement.Handlers.ImportContentContext context)
        {
            var importedText = context.Attribute(part.PartDefinition.Name, "Name");

            if (importedText != null)
            {
                part.Name = importedText;
            }
        }
Esempio n. 5
0
        protected override void Importing(BodyPart part, Orchard.ContentManagement.Handlers.ImportContentContext context)
        {
            var importedText = context.Attribute(part.PartDefinition.Name, "Text");

            if (importedText != null)
            {
                part.Text = _textRedactionService.RestoreText(importedText);
            }
        }
Esempio n. 6
0
        protected override void Importing(TenantContentPart part, Orchard.ContentManagement.Handlers.ImportContentContext context)
        {
            var importedText = context.Attribute(part.PartDefinition.Name, "ContentId");

            if (importedText != null)
            {
                part.MasterContentItemId = string.IsNullOrEmpty(importedText) ? 0 : Convert.ToInt32(importedText);
            }
        }
Esempio n. 7
0
        protected override void Importing(ConnectorPart part, Orchard.ContentManagement.Handlers.ImportContentContext context)
        {
            // TODO: Test this!
            var leftContent = context.Attribute(part.PartDefinition.Name, "LeftContent");

            if (leftContent != null)
            {
                part.LeftContent = context.GetItemFromSession(leftContent).As <SocketsPart>();
            }
            var rightContent = context.Attribute(part.PartDefinition.Name, "RightContent");

            if (rightContent != null)
            {
                part.RightContent = context.GetItemFromSession(rightContent).As <SocketsPart>();
            }
            var inverseConnector = context.Attribute(part.PartDefinition.Name, "InverseConnector");

            if (inverseConnector != null)
            {
                part.InverseConnector = context.GetItemFromSession(inverseConnector).As <ConnectorPart>();
            }
        }