protected void grvDSLoaiSanPham_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "ChonLoaiSP")
            {
                string maLoaiSP = e.CommandArgument.ToString();

                clsLoaiSPDTO loaiSPDTO = clsLoaiSPBUS.LayLoaiSP(maLoaiSP);
                txtMaLoaiSP.Text     = loaiSPDTO.MaLoaiSP;
                txtTenLoaiSP.Text    = loaiSPDTO.TenLoaiSP;
                chkTrangThai.Checked = loaiSPDTO.TrangThai;
            }

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

                if (clsLoaiSPBUS.XoaLoaiSanPham(maLoaiSP))
                {
                    lblThongBaoThanhCong.Text    = "Xóa thành công";
                    lblThongBaoThanhCong.Visible = true;
                    lblThongBaoThatBai.Visible   = false;

                    LoadDSLoaiSP();
                }
                else
                {
                    lblThongBaoThatBai.Text      = "Xóa thất bại";
                    lblThongBaoThatBai.Visible   = true;
                    lblThongBaoThanhCong.Visible = false;
                }
            }
        }
Пример #2
0
        public static clsLoaiSPDTO LayLoaiSP(string maLoaiSP)
        {
            DataRow      dr        = clsLoaiSPDAO.LayLoaiSP(maLoaiSP);
            clsLoaiSPDTO loaiSPDTO = new clsLoaiSPDTO();

            loaiSPDTO.MaLoaiSP  = dr["MaLoaiSP"].ToString();
            loaiSPDTO.TenLoaiSP = dr["TenLoaiSP"].ToString();
            loaiSPDTO.TrangThai = Convert.ToBoolean(dr["TrangThai"]);

            return(loaiSPDTO);
        }