Exemplo n.º 1
0
        /// <summary>
        /// Create a sigle Series item in sitecore
        /// </summary>
        /// <param name="series">Series object generated from XML</param>
        private ID CreateSeriesItemInSitecore(Series series, Item publisherGroupOwner)
        {
            try
            {
                using (new SecurityDisabler())
                {
                    Database masterDb = Sitecore.Configuration.Factory.GetDatabase(sitecoreMasterDatabaseName);
                    //Item SeriesFolderItem = masterDb.GetItem(SeriesFolderItemId);
                    //TemplateItem SeriesItemTemplate = masterDb.GetTemplate(SeriesItemTemplateId);
                    //Item SeriesItem = SeriesFolderItem.Add(series.DisplayName.Trim(), SeriesItemTemplate);

                    //Item SeriesItemTemplate = masterDb.GetItem(SeriesItemTemplateId);
                    //Item SeriesFolderItem = masterDb.GetItem(SeriesFolderItemId);
                    //BranchItem SeriesBranchItem = masterDb.GetItem(SeriesItemTemplate.ID);
                    //Item SeriesItem = SeriesFolderItem.Add(series.DisplayName.Trim(), SeriesBranchItem);
                    Item SeriesItem = SitecoreCreationHelper.CreateBranchItem(series.DisplayName, masterDb, SeriesItemTemplateId, SeriesFolderItemId);
                    return(ExtractDataFromAuhorObject(series, SeriesItem, publisherGroupOwner));
                }
            }
            catch (Exception ex)
            {
                BooksImportLog.Error("There is an error when trying to import Series " + series.DisplayName, ex);
            }
            return(null);
        }
        /// <summary>
        /// Create a sigle book item in sitecore
        /// </summary>
        /// <param name="book">Book object generated from XML</param>
        private void CreateBookItemInSitecore(Book book, string bookName)
        {
            try
            {
                using (new SecurityDisabler())
                {
                    Item bookItem = SitecoreCreationHelper.CreateBranchItem(bookName, masterDb, bookItemTemplateId, booksBucketItemId);
                    BooksImportLog.Info(string.Format("Created new book [{0}] with item ID: {1}", book.Title.TitleText, bookItem != null ? bookItem.ID.ToString() : ""));

                    this.ExtractDataToBookItem(book, bookItem);
                }
            }
            catch (Exception ex)
            {
                BooksImportLog.Error("There is an error when trying to import book (new) " + book.Title.TitleText, ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create a sigle author item in sitecore
        /// </summary>
        /// <param name="author">Author object generated from XML</param>
        private ID CreateAuthorItemInSitecore(Author author, ContributorType contributorType, Item publisherGroupOwner)
        {
            try
            {
                using (new SecurityDisabler())
                {
                    Item authorItem = SitecoreCreationHelper.CreateBranchItem(author.DisplayName, masterDb, authorItemTemplateId, authorFolderItemId);
                    BooksImportLog.Info(string.Format("Created new author [{0}] with item ID: {1}", author.PersonNameInverted, authorItem != null ? authorItem.ID.ToString() : ""));

                    this.ExtractDataFromAuthorObject(author, contributorType, authorItem, publisherGroupOwner);

                    return(authorItem.ID);
                }
            }
            catch (Exception ex)
            {
                BooksImportLog.Error("There is an error when trying to import author " + author.PersonNameInverted, ex);
                return(null);
            }
        }