public ActionResult GetListXeInfo(string ThongTin)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.CVQLChuyen))
            {
                return(AccessDeniedView());
            }
            var arrxevanchuyen = _xeinfoService.GetAllXeInfoByNhaXeId(_workContext.CurrentNhaXe.Id).Where(c => c.Longitude > 0 && c.Latitude > 0 & c.BienSo.Contains(ThongTin));
            var xeids          = _nhaxeService.GetAllChuyenDiTrongNgay(_workContext.NhaXeId, DateTime.Now).Where(c => c.XeVanChuyenId > 0 && c.LaiPhuXes.Any(t => t.nhanvien.HoVaTen.Contains(ThongTin))).Select(c => c.XeVanChuyenId.GetValueOrDefault(0)).ToArray();

            if (xeids.Count() > 0)
            {
                arrxevanchuyen = arrxevanchuyen.Where(c => xeids.Contains(c.Id));
            }
            var arrxeinfo = arrxevanchuyen.Select(c =>
            {
                var _item = new XeInfoModel();
                XeInfoToXeInfoModel(c, _item);
                var _historyxexuatben = _xeinfoService.DinhVi_GetHistoryXeXuatBenByXeVanChuyen(c.Id);
                if (_historyxexuatben != null)
                {
                    _item.NguonVeXeId = _historyxexuatben.NguonVeId;
                    _item.NgayDi      = _historyxexuatben.NgayDi.ToString();
                }

                return(_item);
            }).ToList();

            return(Json(arrxeinfo, JsonRequestBehavior.AllowGet));
        }
 protected virtual void XeInfoToXeInfoModel(XeVanChuyen nvfrom, XeInfoModel nvto)
 {
     nvto.Id              = nvfrom.Id;
     nvto.TenXe           = nvfrom.TenXe;
     nvto.TrangThaiXeId   = nvfrom.TrangThaiXeId;
     nvto.TrangThaiXeText = nvfrom.TrangThaiXe.GetLocalizedEnum(_localizationService, _workContext);
     nvto.LoaiXeId        = nvfrom.LoaiXeId;
     if (nvto.LoaiXeId > 0)
     {
         nvto.LoaiXeText = _xeinfoService.GetById(nvto.LoaiXeId).TenLoaiXe;
     }
     nvto.BienSo      = nvfrom.BienSo;
     nvto.DienThoai   = nvfrom.DienThoai;
     nvto.Latitude    = nvfrom.Latitude;
     nvto.Longitude   = nvfrom.Longitude;
     nvto.NgayGPSText = nvfrom.NgayGPS.ToString();
 }
        public ActionResult GetLatlogNew()
        {
            if (this.CheckNoAccessIntoNhaXe(_workContext, _permissionService, StandardPermissionProvider.CVQLChuyen))
            {
                return(AccessDeniedView());
            }
            if (!_permissionService.Authorize(StandardPermissionProvider.CVQLChuyen))
            {
                return(AccessDeniedView());
            }
            var arrxevanchuyen = _xeinfoService.GetAllXeInfoByNhaXeId(_workContext.CurrentNhaXe.Id);
            var arrxeinfo      = arrxevanchuyen.Select(c =>
            {
                var _item = new XeInfoModel();
                XeInfoToXeInfoModel(c, _item);

                return(_item);
            }).ToList();

            return(Json(arrxeinfo, JsonRequestBehavior.AllowGet));
        }
        public ActionResult GetListXeInfo()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.CVQLChuyen))
            {
                return(AccessDeniedView());
            }
            var arrxevanchuyen = _xeinfoService.GetAllXeInfoByNhaXeId(_workContext.CurrentNhaXe.Id);
            var arrxeinfo      = arrxevanchuyen.Select(c =>
            {
                var _item = new XeInfoModel();
                XeInfoToXeInfoModel(c, _item);
                var _historyxexuatben = _xeinfoService.DinhVi_GetHistoryXeXuatBenByXeVanChuyen(c.Id);
                if (_historyxexuatben != null)
                {
                    _item.NguonVeXeId = _historyxexuatben.NguonVeId;
                    _item.NgayDi      = _historyxexuatben.NgayDi.ToString();
                }

                return(_item);
            }).ToList();

            return(Json(arrxeinfo, JsonRequestBehavior.AllowGet));
        }