/// <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); }
/// <summary> /// 检测借书人信息 /// </summary> /// <param name="username">借书人</param> /// <returns>提示信息</returns> public string Checkuser(string username) { string message = string.Empty; UerInfo userinfo = new UerInfo(); GetLoanInfoMgr getLoanInfoMgr = new GetLoanInfoMgr(); userinfo = getLoanInfoMgr.CheckUserInfo(username); if (userinfo.Booknum >= 5) { userinfo.Isborrow = false; message = "每人最多可以借阅5本书,你已经借阅5本书,不能再借阅。#0"; } else if (userinfo.OutBack > 0) { GetBookInfoMgr getBookInfoMgr = new GetBookInfoMgr(); GetBookItemInfoMgr getBookItemInfoMgr = new GetBookItemInfoMgr(); StringBuilder messagesb = new StringBuilder("您所借图书:"); foreach (Guid orderid in userinfo) { Guid bookid = getBookItemInfoMgr.GetBookID(orderid); Bookinfo borrowbookinfo = getBookInfoMgr.GetBookInfoBybookid(bookid); messagesb.Append("《" + borrowbookinfo.Title + "》"); } messagesb.Append(" 超期依然未归还,请归还再借阅。#0"); message = messagesb.ToString(); userinfo.Isborrow = false; } else { message = this.GetreturnMessage(username); } return(message); }
/// <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); }