Пример #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            int ID;

            if (txtUserID.Text == "")
            {
                MessageBox.Show("请输入账号");
                return;
            }
            if (txtUserPwd.Text == "")
            {
                MessageBox.Show("请输入密码");
                return;
            }
            ID   = Convert.ToInt32(txtUserID.Text.Trim());
            user = UserAdmin.GetUser(ID);

            if (user == null)
            {
                txtUserID.Focus();
                MessageBox.Show("信息:无此用户");
            }
            else
            {
                if (user.Pwd == txtUserPwd.Text)
                {
                    blCanLogin = true;
                    //this.DialogResult = DialogResult.OK;
                    if (main != null)
                    {
                        main.user = user;
                        main.InitMenu();
                        main.Show();
                    }
                    this.Close();
                }
                else
                {
                    txtUserPwd.Text = "";
                    txtUserPwd.Focus();
                    MessageBox.Show("信息:密码错误!");
                }
            }
        }
Пример #2
0
        private void 登记_3_Click(object sender, EventArgs e)
        {
            if (tb3_3.Text == "")
            {
                MessageBox.Show("请输入完整信息");
                return;
            }

            new_user = UserAdmin.GetUser(Convert.ToInt32(tb3_2.Text));
            if (new_user == null)
            {
                MessageBox.Show("该用户不存在");
                return;
            }

            new_book = BookAdmin.GetBook(Convert.ToInt32(tb3_3.Text));
            if (new_book.Name == null)
            {
                MessageBox.Show("该图书不存在");
                return;
            }

            dt = BorrowAdmin.GetBorrow(Convert.ToInt32(tb3_2.Text));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                //if (dt.Rows[i][4].ToString() == listBox1.SelectedItems[0].ToString() && Convert.ToInt32(dt.Rows[i][7]) == 0)
                if (dt.Rows[i][3].ToString() == tb3_3.Text && dt.Rows[i][7].ToString() == "False")
                {
                    MessageBox.Show("该图书已借出");
                    return;
                }
            }

            if (SetTextToBorrow())
            {
                borrowBLL.Insert(new_borrow);
                new_book           = BookAdmin.GetBook(new_book.ID);
                new_book.Condition = "借出";
                bookBLL.Updata(new_book);

                MessageBox.Show("状态:登记成功!");
            }
            tb3_3.Text = "";
        }
Пример #3
0
 private void 借阅情况_3_Click(object sender, EventArgs e)
 {
     listBox1.Items.Clear();
     new_user = UserAdmin.GetUser(Convert.ToInt32(tb3_2.Text));
     if (new_user == null)
     {
         MessageBox.Show("该用户不存在");
         return;
     }
     dt = BorrowAdmin.GetBorrow(Convert.ToInt32(tb3_2.Text));
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         //if (Convert.ToInt32(dt.Rows[i][7]) == 0)
         if (dt.Rows[i][7].ToString() == "False")
         {
             listBox1.Items.Add(dt.Rows[i][4]);
         }
     }
 }
Пример #4
0
        private bool SetTextToBorrow()
        {
            if (tb3_2.Text == "")
            {
                MessageBox.Show("请输入完整信息");
                return(false);
            }
            new_borrow.UID   = Convert.ToInt32(tb3_2.Text);
            new_user         = UserAdmin.GetUser(new_borrow.UID);
            new_borrow.UName = new_user.Name;

            if (tb3_3.Text != "")
            {
                new_borrow.BID   = Convert.ToInt32(tb3_3.Text);
                new_book         = BookAdmin.GetBook(new_borrow.BID);
                new_borrow.BName = new_book.Name;
            }

            new_borrow.Borrow_time = DateTime.Now;
            new_borrow.Return_time = DateTime.Now;
            if (listBox1.SelectedItems.Count != 0)
            {
                dt = BorrowAdmin.GetBorrow(new_borrow.UID);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //if (dt.Rows[i][4].ToString() == listBox1.SelectedItems[0].ToString() && Convert.ToInt32(dt.Rows[i][7]) == 0)
                    if (dt.Rows[i][4].ToString() == listBox1.SelectedItems[0].ToString() && dt.Rows[i][7].ToString() == "False")
                    {
                        if (tb3_3.Text == "")
                        {
                            new_borrow.BID   = Convert.ToInt32(dt.Rows[i][3].ToString());
                            new_borrow.BName = listBox1.SelectedItems[0].ToString();
                        }
                        new_borrow.ID        = Convert.ToInt32(dt.Rows[i][0].ToString());
                        new_borrow.Is_return = 1;
                        break;
                    }
                }
            }
            return(true);
        }
Пример #5
0
        private bool SetTextToBorrow()
        {
            if (tb3_2.Text == "")
            {
                MessageBox.Show("请输入完整信息");
                return(false);
            }
            new_borrow.UID = Convert.ToInt32(tb3_2.Text);
            new_user       = UserAdmin.GetUser(new_borrow.UID);

            if (tb3_3.Text != "")
            {
                new_borrow.BID       = Convert.ToInt32(tb3_3.Text);
                new_book             = BookAdmin.GetBook(new_borrow.BID);
                new_borrow.Is_return = "NO";
            }

            new_borrow.Borrow_time = DateTime.Now;
            new_borrow.Return_time = DateTime.Now;
            if (listBox1.SelectedItems.Count != 0)
            {
                dt = BorrowAdmin.GetBorrow(new_borrow.UID);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string bname = BookAdmin.GetBook(int.Parse(dt.Rows[i][2].ToString())).Name;
                    if (bname == listBox1.SelectedItems[0].ToString() && dt.Rows[i][5].ToString() == "NO")
                    {
                        if (tb3_3.Text == "")
                        {
                            new_borrow.BID = Convert.ToInt32(dt.Rows[i][2].ToString());
                        }
                        new_borrow.ID        = Convert.ToInt32(dt.Rows[i][0].ToString());
                        new_borrow.Is_return = "YES";
                        break;
                    }
                }
            }
            return(true);
        }