Exemplo n.º 1
0
        private void SavePublishDetail(ItemProcessedEventArgs publishEventArgs)
        {
            var publishDetail = CreatePublishDetail(publishEventArgs);

            _currentPublishDetail = _publishDetailRepository.AddPublishDetailItem(publishDetail);
            _publishedItems.Clear();
            _publishDate = publishEventArgs.Context.PublishOptions.PublishDate;
        }
Exemplo n.º 2
0
        public PublishDetail AddPublishDetailItem(PublishDetail item)
        {
            using (var db = new SitecoreEventLogDatabaseCommand())
            {
                db.AddParameter("Cultures", item.Cultures);
                db.AddParameter("TargetDatabases", item.TargetDatabases);
                db.AddParameter("IsSitePublish", item.IsSitePublish);
                db.AddParameter("WithSubItems", item.WithSubItems);
                db.AddParameter("WithRelatedItems", item.WithRelatedItems);
                db.AddParameter("RootItemId", item.RootItemId);
                db.AddParameter("RootItemPath", item.RootItemPath);
                db.AddParameter("PublishType", item.PublishType);

                return(db.ExecuteStoredProcedureQuery <PublishDetail>("dbo.AddPublishDetailItem").FirstOrDefault());
            }
        }
Exemplo n.º 3
0
        private PublishDetail CreatePublishDetail(ItemProcessedEventArgs publishEventArgs)
        {
            var publishOptions = publishEventArgs.Context.PublishOptions;

            var rootItemId   = publishOptions.RootItem?.ID.ToGuid();
            var rootItemPath = publishOptions.RootItem?.Paths.FullPath ?? "";

            var publishDetailsEntity = new PublishDetail()
            {
                RootItemId       = rootItemId,
                Cultures         = string.Join(", ", publishEventArgs.Context.PublishContext.Languages),
                IsSitePublish    = rootItemId == null,
                RootItemPath     = rootItemPath,
                TargetDatabases  = publishOptions.TargetDatabase.Name,
                WithRelatedItems = publishOptions.PublishRelatedItems,
                WithSubItems     = publishOptions.Deep,
                PublishType      = publishOptions.Mode.ToString()
            };

            return(publishDetailsEntity);
        }