Exemplo 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>");
                }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var id = Request.QueryString["id"];

            if (!Page.IsPostBack)
            {
                BUS_Sanpham.LayThongTinsp(id);
            }
        }
Exemplo n.º 3
0
        protected void btnSua_Click(object sender, EventArgs e)
        {
            DTO_Sanpham sp = BUS_Sanpham.LayThongTinsp(txt_tensp.Text);

            sp.Tensp = txt_tensp.Text;

            sp.Thongtin  = txt_thongtinsp.Text;
            sp.Maloaisp  = txt_maloaisp.Text;
            sp.Giatien   = txt_giatien.Text;
            sp.TrangThai = chkTrangThai.Checked;

            if (BUS_Sanpham.Suasp(sp))
            {
                XoaForm();
                loadsp();
                GiaoDienThem(true);
            }
            else
            {
                Response.Write("<script>alert('Sửa san pham thất bại');</script>");
            }
        }
Exemplo n.º 4
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>");
                }
            }
        }