예제 #1
0
        protected void grvDSLoaiSP_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "ChonLoaiSP")
            {
                string maLoaiSP = e.CommandArgument.ToString();

                LoaiSanPhamDTO loaisp = LoaiSanPhamBUS.LayThongTinLoaiSanPham(maLoaiSP);
                if (loaisp != null)
                {
                    txtMaLoaiSP.Text     = loaisp.MaLoaiSP;
                    txtTenLoaiSP.Text    = loaisp.TenLoaiSP;
                    chkTrangThai.Checked = loaisp.TrangThai;
                    GiaoDienThem(false);
                }
            }

            if (e.CommandName == "XoaLoaiSP")
            {
                string maLoaiSP = e.CommandArgument.ToString();

                if (TaiKhoanBUS.XoaTK(maLoaiSP))
                {
                    XoaForm();
                    LoadDSLoaiSanPham();
                }
                else
                {
                    Response.Write("<script>alert('Xóa tài khoản thất bại');</script>");
                }
            }
        }
예제 #2
0
        protected void btnSua_Click(object sender, EventArgs e)
        {
            LoaiSanPhamDTO loaisp = LoaiSanPhamBUS.LayThongTinLoaiSanPham(txtMaLoaiSP.Text);

            loaisp.MaLoaiSP  = txtMaLoaiSP.Text;
            loaisp.TenLoaiSP = txtTenLoaiSP.Text;
            loaisp.TrangThai = chkTrangThai.Checked;
            if (LoaiSanPhamBUS.SuaLoaiSP(loaisp))
            {
                XoaForm();
                LoadDSLoaiSanPham();
                GiaoDienThem(true);
            }
            else
            {
                Response.Write("<script>alert('Thêm tài khoản thất bại');</script>");
            }
        }