public static Boolean CapNhatTrangThaiChoThanhToan()
        {
            var entity = new QuanLyThueXeEntities();

            try
            {
                var hd = entity.HopDongs.Where(n => n.MaTrangThai == "1");
                foreach (var item in hd)
                {
                    var cthd = entity.CT_HopDongs.Where(n => n.SoHopDong == item.SoHopDong);
                    foreach (var c in cthd)
                    {
                        if (c.NgayVe < DateTime.Now)
                        {
                            HopDong result = entity.HopDongs.SingleOrDefault(n => n.SoHopDong == c.SoHopDong);
                            result.MaTrangThai = "3";
                            TrangThaiQueries.CapNhatTrangThaiPhuXeRanh(c.SoHopDong);
                            TrangThaiQueries.CapNhatTrangThaiTaiXeRanh(c.SoHopDong);
                            TrangThaiQueries.CapNhatTrangThaiXeRanh(c.SoHopDong);
                        }
                    }
                }
                entity.SaveChanges();
                return(true);
            }
            catch (Exception ex)
            {
                entity.Dispose();
                return(false);
            }
        }
        /// <summary>
        /// cap nhat lai trang thai hop dong
        /// </summary>
        /// <returns>Boolean</returns>
        public static Boolean CapNhatTrangThai()
        {
            var entity = new QuanLyThueXeEntities();

            try
            {
                //Lay danh sach hop dong dang cho
                var lstDangCho = entity.HopDongs.Where(n => n.MaTrangThai == "0");
                foreach (var dcho in lstDangCho)
                {
                    TrangThaiQueries.CapNhatTrangThaiDangChay(dcho.SoHopDong);
                }
                TrangThaiQueries.CapNhatTrangThaiPhuXeDangChay();
                TrangThaiQueries.CapNhatTrangThaiTaiXeDangChay();
                TrangThaiQueries.CapNhatTrangThaiXeDangChay();
                return(true);
            }
            catch (Exception ex)
            {
                entity.Dispose();
                return(false);
            }
        }