public DetailsShelf(Guid id)
        {
            var shelf = new Worker.Books.Shelf.Details(id);

            if (!shelf._isExist)
            {
                return;
            }

            this.DocumentId = shelf.DocumentId;
            this.TimeStamp  = shelf.TimeStamp;

            this.Title      = shelf.Title;
            this.Priority   = shelf.Priority;
            this.UpdateTime = shelf.UpdateTime;

            var iBook  = new Worker.Books.Book.Index(parentDocumentId: id);
            var iShelf = new Worker.Books.Shelf.Index(parentDocumentId: id);

            if (iBook.List.Count() == 0 && iShelf.List.Count() == 0)
            {
                this.IsNoChild = true;
            }

            this._isExist = true;
        }
        public IndexShelf()
        {
            var shelf = new Worker.Books.Shelf.Index(isRoot: true);

            this.List = new List <Item>();
            var level = 0;

            this.AddShelf(shelf, level);
        }
        private void AddShelf(Worker.Books.Shelf.Index i, int level)
        {
            foreach (var shelf in i.List)
            {
                this.List.Add(new Item(shelf, level));

                var subShelf = new Worker.Books.Shelf.Index(parentDocumentId: shelf.DocumentId);

                this.AddShelf(subShelf, level + 1);
            }
        }
Exemple #4
0
        public CreateShelf(Guid?parentDocumentId)
        {
            this.ParentDocumentId = parentDocumentId;

            if (parentDocumentId == null)
            {
                var i = new Worker.Books.Shelf.Index(isRoot: true);
                if (i.List.Count > 0)
                {
                    var max = i.List.Max(c => c.Priority);
                    if (max.HasValue)
                    {
                        this.Priority = max.Value + 1;
                    }
                }
                else
                {
                    this.Priority = 1;
                }
            }
            else
            {
                var i = new Worker.Books.Shelf.Index(parentDocumentId: parentDocumentId);
                if (i.List.Count > 0)
                {
                    var max = i.List.Max(c => c.Priority);
                    if (max.HasValue)
                    {
                        this.Priority = max.Value + 1;
                    }
                }
                else
                {
                    this.Priority = 1;
                }
            }
        }
Exemple #5
0
        public EditShelf(Guid documentId)
        {
            var b = new Worker.Books.Shelf.Details(documentId);

            this._isExist = b._isExist;
            if (!b._isExist)
            {
                return;
            }

            this.DocumentId = b.DocumentId;
            this.TimeStamp  = b.TimeStamp;

            this.Title    = b.Title;
            this.Priority = b.Priority;

            var iBook  = new Worker.Books.Book.Index(parentDocumentId: documentId);
            var iShelf = new Worker.Books.Shelf.Index(parentDocumentId: documentId);

            if (iBook.List.Count() == 0 && iShelf.List.Count() == 0)
            {
                this.IsNoChild = true;
            }
        }
        public IndexShelfForShelf(Guid parentDocumentId)
        {
            var shelf = new Worker.Books.Shelf.Index(parentDocumentId: parentDocumentId);

            this.List = shelf.List.Select(c => new Item(c)).ToList();
        }