Пример #1
0
        protected void btnThem_Click(object sender, EventArgs e)
        {
            if (txtMaNXB.Text != "" && txtTenNXB.Text != "")
            {
                // Lấy các giá trị từ giao diện
                NXB    nXB    = LayDuLieuTuForm();
                NXBDAO nXBDAO = new NXBDAO();
                // Kiểm tra mã nxb này đã tồn tại trong CSDL chưa
                bool exist = nXBDAO.CheckNXB(nXB.MaNXB);
                if (exist)
                {
                    lblMessage.Text = "Tài khoản đã tồn tại";
                }
                else
                {
                    // Thực hiện ghi xuống CSDL
                    bool result = nXBDAO.Insert(nXB);

                    if (result)
                    {
                        lblMessage.Text = "Thêm thành công!";
                        LayDuLieuVaoGridView();
                    }
                    else
                    {
                        lblMessage.Text = "Có lỗi. Vui lòng thử lại sau";
                    }
                }
            }
            else
            {
                lblMessage.Text = "Vui lòng điền đầy đủ thông tin";
            }
        }
Пример #2
0
 public int Insert(NhaXuatBan obj)
 {
     return(DAO.Insert(obj));
 }