Ejemplo n.º 1
0
        protected void btnXoa_Click(object sender, EventArgs e)
        {
            NXBDAO nXBDAO = new NXBDAO();
            string manxb  = txtMaNXB.Text;

            if (txtMaNXB.Text != "" && txtTenNXB.Text != "")
            {
                // Kiểm tra mã nxb này đã tồn tại trong CSDL chưa
                bool exist = nXBDAO.CheckNXB(manxb);
                if (exist)
                {
                    // Thực hiện xóa từ CSDL
                    bool result = nXBDAO.DeleteNXB(manxb);
                    if (result)
                    {
                        lblMessage.Text = "Xóa thể loại thành công!";
                        LayDuLieuVaoGridView();
                    }
                    else
                    {
                        lblMessage.Text = "Có lỗi. Vui lòng thử lại sau";
                    }
                }
                else
                {
                    lblMessage.Text = "Mã loại không tồn tại";
                }
            }
            else
            {
                lblMessage.Text = "Vui lòng điền đầy đủ thông tin";
            }
        }
Ejemplo n.º 2
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";
            }
        }
Ejemplo n.º 3
0
        private void LayDuLieuVaoGridView()
        {
            NXBDAO nXBDAO = new NXBDAO();

            GridView1.DataSource = nXBDAO.GetAllNXB();
            GridView1.DataBind();
        }
Ejemplo n.º 4
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string manxb  = GridView1.SelectedRow.Cells[0].Text;
            NXBDAO nXBDAO = new NXBDAO();
            NXB    nXB    = nXBDAO.GetTheLoaiByMaNXB(manxb);

            if (nXB != null)
            {
                // Đổ dữ liệu từ đối tượng TheLoai vào các trường trên Form
                DoDuLieuLenForm(nXB);
            }
        }
Ejemplo n.º 5
0
 protected void btnSua_Click(object sender, EventArgs e)
 {
     if (txtMaNXB.Text != "" && txtTenNXB.Text != "")
     {
         NXB    nXB    = LayDuLieuTuForm();
         NXBDAO nXBDAO = new NXBDAO();
         bool   result = nXBDAO.UpdateNXB(nXB);
         if (result)
         {
             lblMessage.Text = "Cập nhật thành công";
             LayDuLieuVaoGridView();
         }
         else
         {
             lblMessage.Text = "Cập nhật không thành công, vui lòng kiểm tra lại";
         }
     }
     else
     {
         lblMessage.Text = "Vui lòng điền đầy đủ thông tin";
     }
 }
Ejemplo n.º 6
0
 public static List <NXBDTO> GetSuppliers()
 {
     return(NXBDAO.SelecSuppliers());
 }
Ejemplo n.º 7
0
 public static int AddSupplier(string ten, string email, string sdt, string fax)
 {
     return(NXBDAO.InserSupplier(new NXBDTO(ten, email, sdt, fax)));
 }
Ejemplo n.º 8
0
 public static int ChangeInfSupplier(string manxb, string ten, string email, string sdt, string fax)
 {
     return(NXBDAO.UpdatSupplier(new NXBDTO(manxb, ten, email, sdt, fax)));
 }
Ejemplo n.º 9
0
        // GET: Admin/QuanLyNXB
        public ActionResult Index()
        {
            NXBDAO nXBDAO = new NXBDAO();

            return(View(nXBDAO.dsNXB()));
        }