protected void btnLuuTT_Click(object sender, EventArgs e)
        {
            

            DTOTrangThai dtott = new DTOTrangThai();
            dtott.TenTT = txtTenTT.Text;

            DAO_Entity daott = new DAO_Entity();

            if (KiemTraNhap() == "")
            {
                daott.ThemTT(dtott);
                Response.Redirect("~/QLBophan_Admin/QLCauHinhTrangThai/TrangThai.aspx");
            }
            else
            {
                ThemTT.Visible = true;
                lbLoi.Text = KiemTraNhap();
            }

        }
        public DTOTrangThai LayThongTinTT(string maSua)
        {
            ketnoi.TaoKetNoi();
            DTOTrangThai dtott = null;
            try
            {
                string lenh = "select * from TrangThai where MaTT = @maSua ";
                ketnoi.LenhKetNoi = new SqlCommand(lenh, ketnoi.KetNoi);

                ketnoi.LenhKetNoi.Parameters.Add("@maSua", SqlDbType.Int);
                ketnoi.LenhKetNoi.Parameters["@maSua"].Value = maSua;

                DataTable bang = new DataTable();
                ketnoi.TichHopCSDL = new SqlDataAdapter(ketnoi.LenhKetNoi);
                ketnoi.TichHopCSDL.Fill(bang);
                DataRow dong = bang.Rows[0];
                dtott = new DTOTrangThai(dong);

            }
            catch (Exception)
            { }
            finally
            {
                ketnoi.DongKetNoi();
            }
            return dtott;
        }
        //Them LoaiKH
        public bool ThemTT(DTOTrangThai dtott)
        {
            bool kq = false;
            ketnoi.TaoKetNoi();
            try
            {
                string lenh = " insert into TrangThai(TenTT) values (@tentt)";
                ketnoi.LenhKetNoi = new SqlCommand(lenh, ketnoi.KetNoi);

                ketnoi.LenhKetNoi.Parameters.Add("@tentt", SqlDbType.NVarChar);

                ketnoi.LenhKetNoi.Parameters["@tentt"].Value = dtott.TenTT;


                if (ketnoi.LenhKetNoi.ExecuteNonQuery() != 0)
                {
                    kq = true;

                }

            }
            catch (Exception)
            {

            }
            finally
            {
                ketnoi.DongKetNoi();
            }
            return kq;
        }
        //Xoa LoaiKH
        public bool XoaTT(DTOTrangThai dtott)
        {
            bool kq = false;
            ketnoi.TaoKetNoi();
            try
            {
                string lenh = "delete from TrangThai where MaTT = @matt";
                ketnoi.LenhKetNoi = new SqlCommand(lenh, ketnoi.KetNoi);

                ketnoi.LenhKetNoi.Parameters.Add("@matt", SqlDbType.Int);
                ketnoi.LenhKetNoi.Parameters["@matt"].Value = dtott.MaTT;

                if (ketnoi.LenhKetNoi.ExecuteNonQuery() != 0)
                {
                    kq = true;
                }
            }
            catch (Exception)
            {

            }
            finally
            {
                ketnoi.DongKetNoi();
            }
            return kq;
        }
        //DAOTrangThai
        //Tao danh sach
        public List<DTOTrangThai> TaoDSTT()
        {
            List<DTOTrangThai> dstt = new List<DTOTrangThai>();
            string lenh = "select * from TrangThai";
            ketnoi.TaoKetNoi();
            DataTable bang = new DataTable();
            try
            {
                ketnoi.LenhKetNoi = new SqlCommand(lenh, ketnoi.KetNoi);
                ketnoi.TichHopCSDL = new SqlDataAdapter(ketnoi.LenhKetNoi);
                ketnoi.TichHopCSDL.Fill(bang);
                foreach (DataRow dongDL in bang.Rows)
                {
                    DTOTrangThai dtott = new DTOTrangThai(dongDL);
                    dstt.Add(dtott);
                }

            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                ketnoi.DongKetNoi();
            }
            return dstt;
        }