コード例 #1
0
        public ObservableCollection <Pages.DocsTable> TestDocsTableOnlyBooks()
        {
            ObservableCollection <Pages.DocsTable> temp_table = new ObservableCollection <Pages.DocsTable>();
            var load_user_docs = from b in db.documents
                                 select new
            {
                b.Id,
                b.Title,
                b.DocType,
                b.IsReference
            };

            foreach (var element in load_user_docs)
            {
                checkouts       checkoutInfo = GetOwnerInfo(element.Id);
                Pages.DocsTable row          = new Pages.DocsTable
                {
                    docID       = element.Id,
                    docTitle    = element.Title,
                    docType     = TypeString(element.DocType),
                    docOwnerID  = checkoutInfo == null ? -1 : checkoutInfo.userID,
                    dateTaked   = checkoutInfo == null ? DateTime.Now : (System.DateTime)checkoutInfo.dateTaked,
                    timeToBack  = checkoutInfo == null ? DateTime.Now : (System.DateTime)checkoutInfo.timeToBack,
                    isReference = element.IsReference
                };
                temp_table.Add(row);
            }
            return(temp_table);
        }
コード例 #2
0
        public ObservableCollection <Pages.DocsTable> TestDocsTableUsersBooks(int user_id)
        {
            ObservableCollection <Pages.DocsTable> temp_table = new ObservableCollection <Pages.DocsTable>();
            var load_user_docs = from c in db.checkouts
                                 join b in db.documents on c.bookID equals b.Id
                                 where c.userID == user_id
                                 select new
            {
                c.bookID,
                b.Title,
                b.DocType,
                c.dateTaked,
                c.timeToBack
            };

            foreach (var element in load_user_docs)
            {
                Pages.DocsTable row = new Pages.DocsTable
                {
                    docID      = element.bookID,
                    docOwnerID = user_id,
                    docTitle   = element.Title,
                    docType    = TypeString(element.DocType),
                    dateTaked  = (DateTime)element.dateTaked,
                    timeToBack = element.timeToBack
                };
                temp_table.Add(row);
            }
            return(temp_table);
        }