Beispiel #1
0
        /// <summary>
        /// Конструктор-копировщик
        /// </summary>
        public BlockBase(BlockBase srcBlock)
        {
            b_id        = srcBlock.b_id;
            bt          = srcBlock.bt;
            parent      = srcBlock.parent;
            treeorder   = srcBlock.treeorder;
            fh_id       = srcBlock.fh_id;
            predecessor = srcBlock.predecessor;
            successor   = srcBlock.successor;
            _UserAttrs  = new AttrsCollection();
            var tplist = new List <enAttrTypes>();

            foreach (var attr in srcBlock.UserAttrs.Attrs.OrderBy(o => o.Order))
            {
                _UserAttrs.AddElement(attr);
                tplist.Add(attr.AttrType);
            }
            created_at = srcBlock.created_at;
            if (srcBlock.blob == null)
            {
                this.blob = new Blob(tplist, null);
            }
            else
            {
                this.blob = new Blob(tplist, srcBlock.blob.Data);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Конструктор
        /// </summary>
        public BlockBase(BlockAddress _b_id, BlockType _bt, BlockAddress _parent, long _order,
                         BlockAddress _fh_id, BlockAddress _predecessor, BlockAddress _successor, AttrsCollection _userAttrs, DateTime?_created_at = null)
        {
            b_id        = _b_id;
            bt          = _bt;
            parent      = _parent;
            treeorder   = _order;
            fh_id       = _fh_id;
            predecessor = _predecessor;
            successor   = _successor;
            if (_created_at == null)
            {
                created_at = DateTime.Now;
            }
            else
            {
                created_at = (DateTime)_created_at;
            }

            if (_userAttrs == null)
            {
                this._UserAttrs = Session.Instance().GetUserAttrs(_bt);
            }
            else
            {
                this._UserAttrs = _userAttrs;
            }
        }