private void btnLuu_Click(object sender, EventArgs e) { ENTITY.Sach s = new ENTITY.Sach(); s.ID_Sach = txtMaSach.Text.Trim(); s.TenSach = txtTenSach.Text.Trim(); s.ID_TheLoai = txtMaTheLoai.Text.Trim(); s.ID_TacGia = txtMaTacGia.Text.Trim(); s.ID_NhaXuatBan = txtMaNXB.Text.Trim(); s.SoTrang = txtSoTrang.Text.Trim(); s.NamXB = txtNamXB.Text.Trim(); s.SoLuong = txtSoLuong.Text.Trim(); s.NgonNgu = txtNgonNgu.Text.Trim(); s.GiaNiemYet = txtGiaNY.Text.Trim(); DAL.Sach_Controler sa = new DAL.Sach_Controler(); if (kt == true) { sa.insertSach(s); } else { sa.editSach(s); } lockControl(); showLsvNXB(); }
private void btnXoa_Click(object sender, EventArgs e) { DialogResult check = MessageBox.Show("Bạn có muốn xóa không", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (check == DialogResult.Yes) { ENTITY.Sach s = new ENTITY.Sach(); s.ID_Sach = txtMaSach.Text.Trim(); DAL.Sach_Controler sa = new DAL.Sach_Controler(); sa.deleteSach(s); } showLsvNXB(); lockControl(); }