Ejemplo n.º 1
0
        private void deleteShelfButton_Click(object sender, EventArgs e)//删除书架
        {
            BookShelf shelf = shelfBindingSource.Current as BookShelf;

            BookShelfService.RemoveBookShelf(shelf.BookShelfId);
            shelfBindingSource.DataSource = BookShelfService.GetAllShelfs();
        }
Ejemplo n.º 2
0
 private void refreshButton_Click(object sender, EventArgs e)//将管理方式改为按书架
 {
     isNormal = true;
     shelfBindingSource.DataSource = BookShelfService.GetAllShelfs();
     bookBindingSource.DataSource  = shelfBindingSource;
     bookBindingSource.DataMember  = "Books";
 }
Ejemplo n.º 3
0
 private void managebySortButton_Click(object sender, EventArgs e)//改为按分类管理图书
 {
     isNormal = false;
     shelfBindingSource.DataSource = BookShelfService.GetAllShelfs();
     bookBindingSource.DataMember  = null;
     bookBindingSource.DataSource  = BookShelfService.AllBooks();
 }
Ejemplo n.º 4
0
        private void addShelfButton_Click(object sender, EventArgs e)//添加书架,直接添加一个新的空书架
        {
            int k = Convert.ToInt32(BookShelfService.GetAllShelfs().Max(i => i.BookShelfId)) + 1;

            BookShelfService.AddBookShelf(new BookShelf()
            {
                BookShelfId = k + ""
            });
            shelfBindingSource.DataSource = BookShelfService.GetAllShelfs();
        }
Ejemplo n.º 5
0
        private void deleteButton_Click(object sender, EventArgs e)//删除图书,同上
        {
            Book book = bookBindingSource.Current as Book;

            if (book == null)
            {
                MessageBox.Show("请选择一本书进行操作!");
                return;
            }
            BookShelfService.RemoveBooks(book.BookId);
            shelfBindingSource.DataSource = BookShelfService.GetAllShelfs();
        }
Ejemplo n.º 6
0
        private void addButton_Click(object sender, EventArgs e)//添加图书,必须选取一个书架才能添加
        {
            BookShelf      shelf          = shelfBindingSource.Current as BookShelf;
            FormBookDetail formBookDetail = new FormBookDetail(shelf);

            if (formBookDetail.ShowDialog() == DialogResult.OK)
            {
                shelfBindingSource.DataSource = BookShelfService.GetAllShelfs();
                bookBindingSource.DataSource  = shelfBindingSource;
                bookBindingSource.DataMember  = "Books";
            }
        }
Ejemplo n.º 7
0
        private void changeDetailButton_Click(object sender, EventArgs e)//修改图书细节
        {
            BookShelf      shelf          = shelfBindingSource.Current as BookShelf;
            Book           book           = bookBindingSource.Current as Book;
            FormBookDetail formBookDetail = new FormBookDetail(book, currentClient, 2);

            if (formBookDetail.ShowDialog() == DialogResult.OK)
            {
                shelfBindingSource.DataSource = BookShelfService.GetAllShelfs();
                bookBindingSource.DataSource  = shelfBindingSource;
                bookBindingSource.DataMember  = "Books";
            }
        }
Ejemplo n.º 8
0
 public FormShelf(Client client)
 {
     InitializeComponent();
     shelfBindingSource.DataSource = BookShelfService.GetAllShelfs();
     currentClient = client;
 }