예제 #1
0
        protected void btnBorrow_Click(object sender, EventArgs e)
        {
            string bookCode = this.txtBookSer.Text.Trim();

            YueDuLibrary.Model.BookInfo bookModel = BookInfo.GetModeBybookCode(bookCode);
            if (bookModel != null)
            {
                if (bookModel.storage > 0)
                {
                    bookModel.storage--;
                    BookInfo.Update(bookModel);
                    YueDuLibrary.Model.BorrowandReturn borrowandReturnModel = new Model.BorrowandReturn();
                    borrowandReturnModel.ReaderID = Convert.ToInt32(readID.Text);
                    borrowandReturnModel.BookCode = this.txtBookSer.Text.Trim();
                    borrowandReturn.Add(borrowandReturnModel);
                    MessageBox.Show(this, "借阅成功!");
                }
                else
                {
                    MessageBox.Show(this, "该书已经被借完!");
                }
            }
            else
            {
                MessageBox.Show(this, "暂无该书!");
            }
        }
예제 #2
0
        public bool BackBook(string readerId, string bookCode)
        {
            bool    isSuccess = false;
            DataSet ds        = dal.GetList(string.Format("ReaderID={0} and BookCode={1}", readerId, bookCode));

            if (ds != null)
            {
                DataRow row = ds.Tables[0].Rows[0];
                Model.BorrowandReturn model = dal.DataRowToModel(row);
                model.BackTime = DateTime.Now;
                dal.Update(model);
                isSuccess = true;
            }
            return(isSuccess);
        }