private void btnLuu_Click(object sender, EventArgs e) { string tenSach = txtTenSach.Text; int idTheLoai = ((THELOAI)cbbTheLoai.SelectedItem).IDTheLoai; int idTacGia = ((TACGIA)cbbTacGia.SelectedItem).IDTacGia; int namXuatBan = Int32.Parse(cbbNamXuatBan.SelectedItem.ToString()); string nxb = txtNhaXuatBan.Text; DateTime ngayNhap = dtPickerNgayNhap.Value; string triGia = txtTriGia.Text; bool tinhTrang = cbbTinhTrang.SelectedIndex == 0 ? true : false; if (!IsEmpty(tenSach, nxb, triGia)) { try { SachBUS.AddSach(tenSach, idTheLoai, idTacGia, namXuatBan, nxb, ngayNhap, Double.Parse(triGia), tinhTrang); MessageBox.Show(this, "Thêm sách thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadSach(); btnLuu.Enabled = false; } catch { MessageBox.Show(this, "Không thể thêm sách", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } return; } }