コード例 #1
0
ファイル: base.cs プロジェクト: quantum-fulltilt/chai-hiv
        /// <summary> </summary>
        virtual public posting get_working_copy()
        {
            _base target = this;

            if (target.parent != null && target.parent.baseid > 0)
            {
                target = target.parent;
            }
            return(ActiveRecordBase <posting> .Find(target.baseid));
        }
コード例 #2
0
ファイル: base.cs プロジェクト: quantum-fulltilt/chai-hiv
        /* what revisions are there */
        // may want to rethink this one
        /// <summary> </summary>
        virtual public IList <posting> get_latest_revisions()
        {
            _base target = this;

            if (target.parent != null && target.parent.baseid > 0)
            {
                target = target.parent;
            }
            return(ActiveRecordBase <posting> .FindAll(new Order[] { Order.Desc("version"), Order.Desc("revision") },
                                                       new List <AbstractCriterion>() {
                Expression.Eq("parent", target),
                Expression.Gt("revision", 0),
                Expression.Eq("version", target.version)
            }.ToArray()
                                                       ));
        }
コード例 #3
0
ファイル: base.cs プロジェクト: quantum-fulltilt/chai-hiv
        /// <summary>
        /// Travel up to the parent post (working post) as a percaution then get the children and find the newest published version
        /// </summary>
        /// <returns></returns>
        virtual public posting get_published()
        {
            _base target = this;

            if (target.parent != null && target.parent.baseid > 0)
            {
                target = target.parent;
            }
            if (target.children != null && target.children.Count() > 0)
            {
                target = target.children.Where(x => x.published = true).OrderByDescending(x => x.version).FirstOrDefault();
            }
            if (target != null && target.baseid > 0 && target.published == true)
            {
                return(ActiveRecordBase <posting> .Find(target.baseid));
            }
            else
            {
                return(null);
            }
        }