private void btnhoantat_Click(object sender, EventArgs e) { ss = new Entities.tblSach(); if (checkmenu_s == "xoa") { ss.Id1 = int.Parse(txtId.Text); bool kt = bll_ls.Delete_S(ss); if (kt) { MessageBox.Show("Bạn vừa xóa thành công !", "xóa thành công", MessageBoxButtons.OK); Reset(); Load_sach(); binding_s(); return; } else { MessageBox.Show("Lỗi, Không thể xóa được!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (checkObject_s()) { if (checkmenu_s == "add") { ss.MaL1 = txtMaL.Text; ss.MaS1 = txtMaS.Text; bool kt = bll_ls.Insert_Sach(ss); if (kt) { MessageBox.Show("Bạn vừa lưu thành công !", "Thêm thành công", MessageBoxButtons.OK); Reset(); Load_sach(); } else { MessageBox.Show("Không thành công, xin vui lòng thực hiện lại !", "Thêm không thành công", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } if (checkmenu_s == "sua") { ss.Id1 = int.Parse(txtId.Text); ss.MaL1 = txtMaL.Text; ss.MaS1 = txtMaS.Text; bool kt = bll_ls.Update_S(ss); if (kt) { MessageBox.Show("Bạn vừa sửa thành công !", "sửa thành công", MessageBoxButtons.OK); Reset(); Load_sach(); binding_s(); } else { MessageBox.Show("Lỗi, Không thể sửa được! có thể trùng mã nhân viên", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }