Exemple #1
0
        private void btnThemSach_ThemSach_Click(object sender, EventArgs e)
        {
            Sach sach = new Sach();

            sach.TenSach    = txtTenSach_ThemSach.Text.Trim();
            sach.TheLoai    = txtTheLoai_ThemSach.Text.Trim();
            sach.TacGia     = txtTacGia_ThemSach.Text.Trim();
            sach.NhaXuanBan = txtNXB_ThemSach.Text.Trim();
            sach.SoLuong    = txtSoLuong_ThemSach.Text.Trim();
            SachService s = new SachService();

            try
            {
                s.InsertSach(sach);
                MessageBox.Show("Thêm thành công!");
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Thêm thất bại!");
                this.Close();
            }
        }