Esempio n. 1
0
        private void btnTiepNhanSach_Click(object sender, EventArgs e)
        {
            Sach   s      = new Sach();
            string masach = txtMaSach.Text;

            s.MaSach        = txtMaSach.Text;
            s.TenSach       = txtTenSach.Text;
            s.TacGia        = txtTacGia.Text;
            s.TheLoai       = cbTheLoai.Text;
            s.NamXuatBan    = cbNamXuatBan.Text;
            s.NhaXuatBan    = txtNhaXuatBan.Text;
            s.NgayNhap      = dtNgayNhap.Text;
            s.TriGia        = txtTriGia.Text;
            s.NguoiTiepNhan = cbNguoiTiepNhan.Text;
            List <Sach> ds  = sm.LayDanhSachSach();
            int         dem = 0;

            for (int i = 0; i < ds.Count(); i++)
            {
                if (ds[i].MaSach == masach)
                {
                    dem++;
                }
            }
            if (dem == 0)
            {
                sm.saveSach(s);
                ReLoadForm();
            }
            else
            {
                MessageBox.Show("Nhập đầy đủ thông tin rồi click thêm", "Thông báo");
                ReLoadForm();
            }
        }