public List <ClassNhanVien> TimTheoMa(int maNV)
        {
            using (CSDLQuanLyQuanAoDataContext db = new CSDLQuanLyQuanAoDataContext())
            {
                List <ClassNhanVien> lstNV = new List <ClassNhanVien>();

                db.DeferredLoadingEnabled = false;
                var ttNV = from n in db.NhanViens
                           join u in db.ChucVus on n.ChucVu equals u.MaChucVu

                           where n.MaNhanVien == maNV
                           select new
                {
                    n.MaNhanVien,
                    n.TenNhanVien,
                    n.NgaySinh,
                    n.GioiTinh,
                    n.Email,
                    n.NgayVaoLam,
                    n.NgayNghiLam,
                    n.ChucVu,
                    n.DiaChi,
                    n.SoDT,
                    n.TinhTrang,
                    n.GhiChu,
                    n.Anh,
                    n.CMND,
                    u.TenChucVu
                };

                foreach (var i in ttNV)
                {
                    ClassNhanVien NVNew = new ClassNhanVien();
                    NVNew.MaNhanVien  = i.MaNhanVien;
                    NVNew.TenNhanVien = i.TenNhanVien;
                    NVNew.NgaySinh    = i.NgaySinh;
                    NVNew.GioiTinh    = i.GioiTinh;
                    NVNew.Email       = i.Email;
                    NVNew.CMND        = i.CMND;
                    NVNew.NgayVaoLam  = i.NgayVaoLam;
                    NVNew.NgayNghiLam = i.NgayNghiLam;
                    NVNew.ChucVu      = i.TenChucVu;
                    NVNew.DiaChi      = i.DiaChi;
                    NVNew.SoDT        = i.SoDT;
                    NVNew.TinhTrang   = i.TinhTrang;
                    NVNew.GhiChu      = i.GhiChu;

                    if (i.Anh != null)
                    {
                        NVNew.Image = ByteArrayToImage(i.Anh.ToArray());
                    }
                    lstNV.Add(NVNew);
                }
                //classNV = lstHH;
                return(lstNV);
            }
        }
        public List <ClassNhanVien> GetNhanVien()
        {
            using (CSDLQuanLyQuanAoDataContext db = new CSDLQuanLyQuanAoDataContext())
            {
                List <ClassNhanVien> lstNV = new List <ClassNhanVien>();

                db.DeferredLoadingEnabled = false;
                var ttNV = from n in db.NhanViens
                           join c in db.ChucVus on n.ChucVu equals c.MaChucVu
                           join u in db.Users on n.MaNhanVien equals u.MaNhanVien into temp
                           from subtemp in temp.DefaultIfEmpty()


                           //where n.TinhTrang == true && c.ChucVu != 1
                           select new
                {
                    NhanVien = n,
                    User     = subtemp == null ? -1 : subtemp.ID,
                    c.TenChucVu
                };


                foreach (var i in ttNV)
                {
                    if (i.User == -1)
                    {
                        ClassNhanVien HHNew = new ClassNhanVien();
                        HHNew.MaNhanVien  = i.NhanVien.MaNhanVien;
                        HHNew.TenNhanVien = i.NhanVien.TenNhanVien;
                        HHNew.NgaySinh    = i.NhanVien.NgaySinh;
                        HHNew.GioiTinh    = i.NhanVien.GioiTinh;
                        HHNew.Email       = i.NhanVien.Email;
                        HHNew.CMND        = i.NhanVien.CMND;
                        HHNew.NgayVaoLam  = i.NhanVien.NgayVaoLam;
                        HHNew.NgayNghiLam = i.NhanVien.NgayNghiLam;
                        HHNew.ChucVu      = i.TenChucVu;
                        HHNew.DiaChi      = i.NhanVien.DiaChi;
                        HHNew.SoDT        = i.NhanVien.SoDT;
                        HHNew.TinhTrang   = i.NhanVien.TinhTrang;
                        HHNew.GhiChu      = i.NhanVien.GhiChu;

                        lstNV.Add(HHNew);
                    }
                }

                return(lstNV);
            }
        }