Exemplo n.º 1
0
        /// <summary>
        /// 模糊查询
        /// </summary>
        /// <param name="bookname">借阅人</param>
        /// <returns>图书</returns>
        public List <DisplayInfo> QueryByName(string bookname)
        {
            GetBookInfoMgr     getBookInfoMgr     = new GetBookInfoMgr();
            GetBookItemInfoMgr getBookItemInfoMgr = new GetBookItemInfoMgr();
            List <DisplayInfo> displayInfolist    = new List <DisplayInfo>();
            List <Bookinfo>    bookinfoList       = new List <Bookinfo>();

            // 获取全部图书信息
            bookinfoList = getBookInfoMgr.QueryBookByName(bookname);

            foreach (Bookinfo tempinfo in bookinfoList)
            {
                DisplayInfo displayInfo = new DisplayInfo();
                displayInfo.BookID   = tempinfo.BookID;
                displayInfo.Title    = tempinfo.Title;
                displayInfo.Decrible = tempinfo.Decrible;

                // 获取该书的总数
                displayInfo.BookNum = getBookItemInfoMgr.GetKindBookSum(tempinfo.BookID);

                // 获取该数的可借阅数
                displayInfo.Bookleft = getBookItemInfoMgr.GetISloanBookSum(tempinfo.BookID);
                displayInfolist.Add(displayInfo);
            }

            return(displayInfolist);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 组装显示信息
        /// </summary>
        /// <returns>显示信息</returns>
        public List <DisplayInfo> GetDisplayinfo()
        {
            GetBookInfoMgr     getBookInfoMgr     = new Business.GetBookInfoMgr();
            GetBookItemInfoMgr getBookItemInfoMgr = new GetBookItemInfoMgr();
            List <DisplayInfo> displayInfolist    = new List <DisplayInfo>();
            List <Bookinfo>    bookinfoList       = new List <Bookinfo>();

            // 获取全部图书信息
            bookinfoList = getBookInfoMgr.GetAllBookInfo();
            foreach (Bookinfo tempinfo in bookinfoList)
            {
                DisplayInfo displayInfo = new DisplayInfo();
                displayInfo.BookID   = tempinfo.BookID;
                displayInfo.Title    = tempinfo.Title;
                displayInfo.Decrible = tempinfo.Decrible;

                // 获取该书的总数
                displayInfo.BookNum = getBookItemInfoMgr.GetKindBookSum(tempinfo.BookID);

                // 获取该数的可借阅数
                displayInfo.Bookleft = getBookItemInfoMgr.GetISloanBookSum(tempinfo.BookID);
                displayInfolist.Add(displayInfo);
            }

            return(displayInfolist);
        }