private void btnOK_Click(object sender, EventArgs e) { NhapSachDTO nhapSachDTO = new NhapSachDTO { MaNhap = txtMaNhap.Text, MaNV = frmDangNhap.MaNV, NgayNhap = DateTime.Now, ThanhTien = 0, TrangThai = true }; CTNhapSachDTO cTNhapSachDTO = new CTNhapSachDTO { MaNhap = txtMaNhap.Text, MaSach = txtMaSach.Text, SoLuong = int.Parse(txtSoLuong.Text), DonGia = int.Parse(txtGiaTien.Text) }; if (rdoNhapMoi.Checked) { SachDTO sachDTO = new SachDTO(); sachDTO.MaSach = txtMaSach.Text; sachDTO.TenSach = txtSach.Text; sachDTO.MaDauSach = cbbDauSach.SelectedValue.ToString(); sachDTO.TenTacGia = txtTacGia.Text; sachDTO.TenNhaXuatBan = txtNXB.Text; sachDTO.NamXuatBan = int.Parse(txtNamXB.Text); sachDTO.DonGia = int.Parse(txtGiaTien.Text); sachDTO.TrangThai = true; if (chkSachHiem.Checked) { sachDTO.SachHiem = true; } else { sachDTO.SachHiem = false; } sachDTO.SoLuong = int.Parse(txtSoLuong.Text); if (sachBUS.ThemSachMoi(sachDTO) && nhapSachBUS.NhapSach(nhapSachDTO) && cTNhapSachBUS.ThemCTNhapSach(cTNhapSachDTO)) { MessageBox.Show(Constrant.ThemThanhCong, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Information); frmNhapSach_Load(sender, e); } else { MessageBox.Show(Constrant.ThemThatBai, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (rdoNhapThem.Checked) { if (sachBUS.NhapThemSachCu(txtMaSach.Text, int.Parse(txtSoLuong.Text)) && nhapSachBUS.NhapSach(nhapSachDTO) && cTNhapSachBUS.ThemCTNhapSach(cTNhapSachDTO)) { MessageBox.Show(Constrant.ThemThanhCong, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Information); frmNhapSach_Load(sender, e); } else { MessageBox.Show(Constrant.ThemThatBai, Constrant.ThongBao, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }