コード例 #1
0
        public override bool Filter(object element)
        {
            Item item = null;

            if (element is Item)
            {
                item = element as Item;
            }
            else if (element is ItemWorkflowEvent)
            {
                item = (element as ItemWorkflowEvent).Item;
            }
            if (item != null)
            {
                if (UseFirstVersion)
                {
                    var versions   = item.Versions.GetVersionNumbers();
                    var minVersion = versions.Min(v => v.Number);
                    item = item.Database.GetItem(item.ID, item.Language, Version.Parse(minVersion));
                }
                DateTime dateCreated = item.Statistics.Created;
                if (FromDate <= dateCreated && dateCreated < ToDate)
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #2
0
 protected virtual void ParseField(ImageField imageFieldParse)
 {
     Assert.ArgumentNotNull(imageFieldParse, "imageFieldParse");
     if (!string.IsNullOrEmpty(database))
     {
         imageFieldParse.MediaDatabase = Factory.GetDatabase(database);
     }
     if (!string.IsNullOrEmpty(language))
     {
         imageFieldParse.MediaLanguage = Language.Parse(language);
     }
     if (!string.IsNullOrEmpty(version))
     {
         imageFieldParse.MediaVersion = Version.Parse(version);
     }
     if (imageFieldParse.MediaItem != null)
     {
         source = StringUtil.GetString(source, imageFieldParse.MediaItem.Paths.FullPath);
     }
     alt       = StringUtil.GetString(alt, imageFieldParse.Alt);
     border    = StringUtil.GetString(border, imageFieldParse.Border);
     hspace    = StringUtil.GetString(hspace, imageFieldParse.HSpace);
     vspace    = StringUtil.GetString(vspace, imageFieldParse.VSpace);
     className = StringUtil.GetString(className, imageFieldParse.Class);
 }
コード例 #3
0
        protected override Item DoExecute()
        {
            var dbitem         = this.dataStorage.GetFakeItem(this.Item.ID);
            var language       = this.Item.Language.Name;
            var currentVersion = dbitem.GetVersionCount(language) != 0 ? this.Item.Version.Number : 0;
            var nextVersion    = Version.Parse(currentVersion + 1);

            dbitem.AddVersion(language, currentVersion);

            return(this.dataStorage.GetSitecoreItem(this.Item.ID, this.Item.Language, nextVersion));
        }
コード例 #4
0
        protected override Item DoExecute()
        {
            var version = this.Version;

            if (version == Version.Latest)
            {
                var item = this.DataStorage.GetFakeItem(this.ItemId);
                if (item != null)
                {
                    var language = this.Language.Name;
                    version = Version.Parse(item.GetVersionCount(language));
                }
            }

            return(this.dataStorage.GetSitecoreItem(this.ItemId, this.Language, version));
        }
コード例 #5
0
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, nameof(context));
            var database = context.Parameters["database"];
            var id       = context.Parameters["id"];
            var language = context.Parameters["language"];
            var version  = context.Parameters["version"];

            var db   = Factory.GetDatabase(database);
            var item = db.GetItem(id, Language.Parse(language), Version.Parse(version));

            using (new EditContext(item))
            {
                item["Enabled"] = "1";
            }
        }
コード例 #6
0
        protected override VersionCollection DoExecute()
        {
            var item     = this.dataStorage.GetFakeItem(this.Item.ID);
            var versions = new VersionCollection();

            if (item == null)
            {
                return(versions);
            }

            var versionsCount = item.GetVersionCount(this.Language.Name);

            for (var i = 1; i <= versionsCount; i++)
            {
                versions.Add(Version.Parse(i));
            }

            return(versions);
        }