protected override void Importing(CalendarPart part, global::Orchard.ContentManagement.Handlers.ImportContentContext context) { var root = context.Data.Element(part.PartDefinition.Name); var CalendarShape = root.Attribute("CalendarShape"); if (CalendarShape != null) { part.CalendarShape = CalendarShape.Value; } var DisplayPager = root.Attribute("DisplayPager"); if (DisplayPager != null) { part.DisplayPager = Convert.ToBoolean(DisplayPager.Value); } var ItemsPerPage = root.Attribute("ItemsPerPage"); if (ItemsPerPage != null) { part.ItemsPerPage = Convert.ToInt32(ItemsPerPage.Value); } var NumDays = root.Attribute("NumDays"); if (NumDays != null) { part.NumDays = NumDays.Value; } var PagerSuffix = root.Attribute("PagerSuffix"); if (PagerSuffix != null) { part.PagerSuffix = PagerSuffix.Value; } var StartDate = root.Attribute("StartDate"); if (StartDate != null) { part.StartDate = StartDate.Value; } context.ImportAttribute(part.PartDefinition.Name, "Query", x => { // cerca la campagna con l'identity indicato var query = context.GetItemFromSession(x); // verifica che si tratti effettivamente di una query if (query != null && query.Has <QueryPart>()) { part.QueryPartRecord = query.As <QueryPart>().Record; // layout var layoutIndex = context.Attribute(part.PartDefinition.Name, "LayoutIndex"); int layoutIndexValue = 0; if (layoutIndex != null && Int32.TryParse(layoutIndex, out layoutIndexValue) && layoutIndexValue >= 0 && part.Record.QueryPartRecord.Layouts.Count > layoutIndexValue) { part.Record.LayoutRecord = part.Record.QueryPartRecord.Layouts[Int32.Parse(layoutIndex)]; } } }); }
protected override void Importing(FaqTypePart part, global::Orchard.ContentManagement.Handlers.ImportContentContext context) { part.Title = context.Attribute(part.PartDefinition.Name, "FaqTypeTitle") ?? string.Empty; }
protected override void Importing(FaqPart part, global::Orchard.ContentManagement.Handlers.ImportContentContext context) { part.Question = context.Attribute(part.PartDefinition.Name, "Question") ?? string.Empty; part.FaqTypeId = context.Attribute(part.PartDefinition.Name, "FaqTypeId") == string.Empty ? 0 : int.Parse(context.Attribute(part.PartDefinition.Name, "FaqTypeId")); }