示例#1
0
        private void signInButton_Click(object sender, EventArgs e)//登录,完成
        {
            FormRegisterandSignin formRegisterandSignin = new FormRegisterandSignin(1);

            if (formRegisterandSignin.ShowDialog() == DialogResult.OK)
            {
                currentClient = formRegisterandSignin.currentClient;
                if (currentClient != null)
                {
                    nameTextBox.ReadOnly        = false;
                    nameTextBox.Text            = currentClient.Name;
                    nameTextBox.ReadOnly        = true;
                    this.signOutButton.Visible  = true;
                    this.signOutButton.Enabled  = true;
                    this.signInButton.Visible   = false;
                    this.signInButton.Enabled   = false;
                    this.registerButton.Visible = false;
                    this.registerButton.Enabled = false;
                    if (currentClient.Name == "管理员")
                    {
                        this.manageButton.Visible = true;
                        this.manageButton.Enabled = true;
                    }
                    appointBooks = BookShelfService.GetAllAppointedBooks(currentClient);
                    lendBooks    = BookShelfService.GetAllLentBooks(currentClient);
                    appointBindingSource.DataSource = appointBooks;
                    lendBindingSource.DataSource    = lendBooks;
                }
            }
        }
示例#2
0
        private void manageButton_Click(object sender, EventArgs e)//图书管理,完成
        {
            FormShelf formShelf = new FormShelf(currentClient);

            if (formShelf.ShowDialog() == DialogResult.OK)
            {
                Query(1);
                appointBooks = BookShelfService.GetAllAppointedBooks(currentClient);
                lendBooks    = BookShelfService.GetAllLentBooks(currentClient);
                appointBindingSource.DataSource = appointBooks;
                lendBindingSource.DataSource    = lendBooks;
            }
        }
示例#3
0
        private void intoDetailButton_Click(object sender, EventArgs e)//查看细节,完成
        {
            if (currentClient == null)
            {
                MessageBox.Show("请登录后再进行此操作!");
                return;
            }
            Book           book           = booksBindingSource.Current as Book;
            FormBookDetail formBookDetail = new FormBookDetail(book, currentClient, 1);

            if (formBookDetail.ShowDialog() == DialogResult.OK)
            {
                Query(1);
                appointBooks = BookShelfService.GetAllAppointedBooks(currentClient);
                lendBooks    = BookShelfService.GetAllLentBooks(currentClient);
                appointBindingSource.DataSource = appointBooks;
                lendBindingSource.DataSource    = lendBooks;
            }
        }
示例#4
0
        private void renewButton_Click(object sender, EventArgs e)//续借,完成
        {
            Book book = lendBindingSource.Current as Book;

            if (book == null)
            {
                MessageBox.Show("请选择一本书进行操作!");
                return;
            }
            else
            {
                if (yearComboBox.Text != "" && monthComboBox.Text != "" && dayComboBox.Text != "")//monthComboBox之前打快了打成了monthhComboBox
                {
                    string year  = yearComboBox.Text;
                    string month = monthComboBox.Text;
                    string day   = dayComboBox.Text;
                    if (book.reNewNum < 3)
                    {
                        BookShelfService.ReNewLending(book, currentClient, year, month, day);
                    }
                    else
                    {
                        MessageBox.Show("该书续借次数太多,不允许继续续借!");
                    }
                }
                else
                {
                    MessageBox.Show("没有输入正确的日期!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            lendBooks = new List <Book>();
            lendBindingSource.DataSource = lendBooks;
            lendBooks = BookShelfService.GetAllLentBooks(currentClient);
            lendBindingSource.ResetBindings(false);
            lendBindingSource.DataSource = lendBooks;
            Books = new List <Book>();
            booksBindingSource.DataSource = Books;
            Books = BookShelfService.AllBooks();
            booksBindingSource.ResetBindings(false);
            booksBindingSource.DataSource = Books;
            Query(1);
        }
示例#5
0
        private void returnButton_Click(object sender, EventArgs e)//还书,完成
        {
            Book book = lendBindingSource.Current as Book;

            if (book == null)
            {
                MessageBox.Show("请选择一本书进行操作!");
                return;
            }
            BookShelfService.ReturnBooks(book, currentClient);//问题
            lendBooks = new List <Book>();
            lendBindingSource.DataSource = lendBooks;
            lendBooks = BookShelfService.GetAllLentBooks(currentClient);
            lendBindingSource.ResetBindings(false);
            lendBindingSource.DataSource = lendBooks;
            Books = new List <Book>();
            booksBindingSource.DataSource = Books;
            Books = BookShelfService.AllBooks();
            booksBindingSource.ResetBindings(false);
            booksBindingSource.DataSource = Books;
            Query(1);
        }