Ejemplo n.º 1
0
        protected void grv_sp_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Chonsp")
            {
                string tensp = e.CommandArgument.ToString();

                DTO_Sanpham sp = BUS_Sanpham.LayThongTinsp(tensp);
                if (sp != null)
                {
                    txb_masp.Text     = sp.Masp;
                    txb_tensp.Text    = sp.Tensp;
                    txb_giatien.Text  = sp.Giatien;
                    txb_sltonkho.Text = sp.Soluongtonkho;
                    txb_thongtin.Text = sp.Thongtin;
                    txb_maloaisp.Text = sp.Maloaisp;
                }
            }

            if (e.CommandName == "Xoasp")
            {
                string tensp = e.CommandArgument.ToString();

                if (BUS_Sanpham.XoaSP(tensp))
                {
                    //XoaForm();
                    LoadDSSP();
                }
                else
                {
                    Response.Write("<script>alert('Xóa tài khoản thất bại');</script>");
                }
            }
        }
Ejemplo n.º 2
0
        protected void grv_sp_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Chonsp")
            {
                string tensp = e.CommandArgument.ToString();

                DTO_Sanpham sp = BUS_Sanpham.LayThongTinsp(tensp);
                if (sp != null)
                {
                    txt_masp.Text        = sp.Masp;
                    txt_tensp.Text       = sp.Tensp;
                    txt_giatien.Text     = sp.Giatien;
                    txt_slton.Text       = sp.Soluongtonkho;
                    txt_thongtinsp.Text  = sp.Thongtin;
                    txt_maloaisp.Text    = sp.Maloaisp;
                    img_anhminhhoa.Text  = sp.Anhminhhoa;
                    chkTrangThai.Checked = sp.TrangThai;
                    GiaoDienThem(false);
                }
            }

            if (e.CommandName == "Xoasp")
            {
                string tensp = e.CommandArgument.ToString();

                if (BUS_Sanpham.XoaSP(tensp))
                {
                    XoaForm();
                    loadsp();
                }
                else
                {
                    Response.Write("<script>alert('Xóa tài sản phẩm thất bại');</script>");
                }
            }
        }