Beispiel #1
0
        /// <summary>
        /// Accept Item Share
        /// </summary>
        /// <param name="borrow">Borrow</param>
        /// <param name="userIdentifier">User Identifier</param>
        /// <returns>Item Share</returns>
        public ItemShare Accept(BorrowAction borrow, Guid userIdentifier)
        {
            if (null == borrow)
            {
                throw new ArgumentNullException("borrow");
            }

            if (Guid.Empty == userIdentifier)
            {
                throw new ArgumentException("user identifier");
            }

            var sproc = new GoodsBorrowAccept()
            {
                UserIdentifier = userIdentifier,
                Identifier     = borrow.Identifier,
                On             = borrow.On,
                Until          = borrow.Until,
                Comment        = borrow.Comment,
            };

            var data = sproc.CallObject <ItemShare>();

            if (null != data)
            {
                this.email.BorrowAccepted(data);
                this.activity.AcceptBorrow(data);
            }

            return(data);
        }
Beispiel #2
0
        public ItemShare Reject(BorrowAction reject)
        {
            if (null == reject)
            {
                throw new ArgumentNullException("reject");
            }

            if (Guid.Empty == reject.Identifier)
            {
                throw new ArgumentException("Identifier");
            }

            var userId = User.Identifier();

            return(this.borrow.Reject(reject, userId));
        }
Beispiel #3
0
        public ItemShare Accept(BorrowAction accept)
        {
            if (null == accept)
            {
                throw new ArgumentNullException("accept");
            }

            if (Guid.Empty == accept.Identifier)
            {
                throw new ArgumentException("Identifier");
            }

            var userId = User.Identifier();

            return(this.borrow.Accept(accept, userId));
        }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            ///提交之前
            if (textBox2.Text == "")
            {
                MessageBox.Show("书籍ID为空!");
                return;
            }
            else if (textBox1.Text == "")
            {
                if (type == 0)//借书时用户不能为空
                {
                    MessageBox.Show("用户ID为空!");
                    return;
                }
            }

            Borrow br = new Borrow();

            br.bkId = int.Parse(textBox2.Text);
            br.rdId = int.Parse(textBox1.Text);

            try {
                if (type == 2)
                {
                    if (BorrowAction.Renew(br) > 0)
                    {
                        MessageBox.Show("续借成功!");
                    }
                    else
                    {
                        MessageBox.Show("续借失败");
                        return;
                    }
                }
                else if (type == 1)
                {
                    if (BorrowAction.Back(br) > 0)
                    {
                        MessageBox.Show("还书成功!");
                    }
                    else
                    {
                        MessageBox.Show("还书失败");
                        return;
                    }
                }
                else
                {
                    if (BorrowAction.Borrow(br) > 0)
                    {
                        MessageBox.Show("借书成功!");
                    }
                    else
                    {
                        MessageBox.Show("借书失败");
                        return;
                    }
                }
            }catch (Exception ex) {
                MessageBox.Show("借书失败!请检查读者ID或书籍ID信息!");
            }

            ///提交之后
            button1.Enabled = false;
        }