private void Button_Click_1(object sender, RoutedEventArgs e) { BookWindow1 BookWindow = new BookWindow1(); BookWindow.WindowStartupLocation = WindowStartupLocation.Manual; BookWindow.Left = this.Left; BookWindow.Top = this.Top; BookWindow.Show(); this.Close(); }
private void Button_Click(object sender, RoutedEventArgs e) { string ID = this.IDS.Text.Trim(); string name = this.bookname.Text.Trim(); string author = this.cbs.Text.Trim(); string price = this.price.Text.Trim(); string store = this.store.Text.Trim(); if (ID == "" || name == "" || author == "" || price == "" || store == "") { // 有信息未填 MessageBox.Show("所有信息不能为空!"); return; } Book book = new Book(); BookStore.BLL.BookBLL bll = new BookBLL(); bool flag = false; book.Id = Convert.ToInt32(this.IDS.Text.Trim());//int.Parse(ID); book.Name = name; book.Price = Convert.ToDouble(this.price.Text.Trim()); book.store = Convert.ToInt32(store); book.Author = author; flag = bll.AddBook(book); if (flag) { MessageBoxResult boxResult = MessageBox.Show("图书信息添加成功!", "提示:", MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.No); if (boxResult == MessageBoxResult.Yes) { BookWindow1 BookWindow = new BookWindow1(); BookWindow.WindowStartupLocation = WindowStartupLocation.Manual; BookWindow.Left = this.Left; BookWindow.Top = this.Top; BookWindow.Show(); this.Close(); } } /* * Book book = new Book(); * BookStore.BLL.BookBLL bll = new BookBLL(); * bool flag = false; * book.Id =int.Parse(ID); * book.Name = name; * book.Price = int.Parse(price); * book.Inventory = int.Parse(kc); * book.Author = cbs; * * flag = bll.AddBook(book); * if (flag) * { * * }*/ }
private void update_Click(object sender, RoutedEventArgs e) { BookWindow1 BookWindow = new BookWindow1(); BookWindow.WindowStartupLocation = WindowStartupLocation.Manual; BookWindow.Left = this.Left; BookWindow.Top = this.Top; BookWindow.Show(); BookBLL book = new BookBLL(); BookWindow.dataGrid.ItemsSource = book.GetAllBooks(); this.Close(); }
private void Button_Select(object sender, RoutedEventArgs e) { string name = TextSelectbook.Text.Trim(); BookBLL bookball = new BookBLL(); if (bookball.SelectBooks(name).Count > 0) { BookWindow1 BookWindow = new BookWindow1(); BookWindow.WindowStartupLocation = WindowStartupLocation.Manual; BookWindow.Left = this.Left; BookWindow.Top = this.Top; BookWindow.Show(); BookBLL book = new BookBLL(); BookWindow.dataGrid.ItemsSource = book.SelectBooks(name); this.Close(); } else { MessageBox.Show("查无此书!"); } }
private void Button_Click(object sender, RoutedEventArgs e) { string ID = this.IDS.Text.Trim(); string name = this.bookname.Text.Trim(); string cbs = this.cbs.Text.Trim(); string price = this.price.Text.Trim(); string kc = this.kc.Text.Trim(); if (ID == "" || name == "" || cbs == "" || price == "" || kc == "") { // 有信息未填 MessageBox.Show("所有信息不能为空!"); return; } int count; int id = int.Parse(ID); decimal prices = decimal.Parse(price); int store = int.Parse(kc); BookBLL bookball = new BookBLL(); count = bookball.BookDelete(id, name, cbs, prices, store); if (count == 0) { MessageBox.Show("查无此书!"); } else { MessageBoxResult boxResult = MessageBox.Show("数据删除成功!", "提示:", MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.No); if (boxResult == MessageBoxResult.Yes) { BookWindow1 BookWindow = new BookWindow1(); BookWindow.WindowStartupLocation = WindowStartupLocation.Manual; BookWindow.Left = this.Left; BookWindow.Top = this.Top; BookWindow.Show(); this.Close(); } } }