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 NhaXeInfoConnect(int nhaxeId) { var nhaxemodel = new NhaXeInfoModel(); var nhaxe = _nhaxeService.GetNhaXeById(nhaxeId); nhaxemodel.TenNhaXe = GetLabel("nhaxe") + " " + nhaxe.TenNhaXe; nhaxemodel.HanhTrinhs = _hanhtrinhService.GetAllHanhTrinhByNhaXeId(nhaxeId).Select(c => { var _hanhtrinh = new NhaXeInfoModel.HanhTrinhInNhaXeModel(); _hanhtrinh.Id = c.Id; _hanhtrinh.Mota = c.MoTa; _hanhtrinh.HangXe = GetLabel("vexe") + " " + nhaxe.TenNhaXe; var _lichtrinh = _hanhtrinhService.GetAllLichTrinhByHanhTrinhId(c.Id).First(); _hanhtrinh.LoaiXe = _xeinfoService.GetById(_lichtrinh.LoaiXeId).TenLoaiXe; _hanhtrinh.GiaVeToanTuyenText = _priceFormatter.FormatPrice(_lichtrinh.GiaVeToanTuyen, true, false); _hanhtrinh.SoChuyenTrongNgay = _hanhtrinhService.GetAllLichTrinhByHanhTrinhId(c.Id).Count() + GetLabel("Chuyen/ngay"); return(_hanhtrinh); }).ToList(); return(View(nhaxemodel)); }
public ActionResult GetSoDoGheXeInfo(int NguonVeXeId, int ParentId, long NgayDi, int?TangIndex) { int nguonveid = NguonVeXeId; if (ParentId > 0) { nguonveid = ParentId; } //lấy thong tin nguồn xe var nguonvexe = _hanhtrinhService.GetNguonVeXeById(nguonveid); if (nguonvexe == null) { return(new HttpUnauthorizedResult()); } var loaixe = _xeinfoService.GetById(nguonvexe.LoaiXeId); if (loaixe == null) { return(new HttpUnauthorizedResult()); } //var nhaxe = this.getCurrentNhaXe; var sodoghe = _xeinfoService.GetSoDoGheXeById(loaixe.SoDoGheXeID); var modelsodoghe = new LoaiXeModel.SoDoGheXeModel(); modelsodoghe.PhanLoai = ENPhanLoaiPhoiVe.PHOI_VE; SoDoGheXeToSoDoGheXeModel(sodoghe, modelsodoghe); //Lấy thông tin ma tran var sodoghevitris = _xeinfoService.GetAllSoDoGheViTri(sodoghe.Id); var sodoghequytacs = _xeinfoService.GetAllSoDoGheXeQuyTac(loaixe.Id); modelsodoghe.MaTran = new int[modelsodoghe.SoHang, modelsodoghe.SoCot]; modelsodoghe.PhoiVes1 = new LoaiXeModel.PhoiVeAdvanceModel[modelsodoghe.SoHang + 1, modelsodoghe.SoCot + 1]; modelsodoghe.SoTang = 1; if (sodoghe.KieuXe == ENKieuXe.GiuongNam) { modelsodoghe.SoTang = 2; modelsodoghe.PhoiVes2 = new LoaiXeModel.PhoiVeAdvanceModel[modelsodoghe.SoHang + 1, modelsodoghe.SoCot + 1]; } foreach (var s in sodoghevitris) { modelsodoghe.MaTran[s.y, s.x] = 1; } DateTime _ngaydi = new DateTime(NgayDi); if (sodoghequytacs != null && sodoghequytacs.Count > 0) { foreach (var s in sodoghequytacs) { if (s.Tang == 1) { modelsodoghe.PhoiVes1[s.y, s.x] = new LoaiXeModel.PhoiVeAdvanceModel(); modelsodoghe.PhoiVes1[s.y, s.x].KyHieu = s.Val; if (s.y >= 1 && s.x >= 1) { //kiem tra thong tin vi tri phoi ve modelsodoghe.PhoiVes1[s.y, s.x].Info = _phoiveService.GetPhoiVe(nguonveid, s, _ngaydi, true); modelsodoghe.PhoiVes1[s.y, s.x].IsCurrentCustomer = true; if (modelsodoghe.PhoiVes1[s.y, s.x].Info.TrangThai != ENTrangThaiPhoiVe.Huy && modelsodoghe.PhoiVes1[s.y, s.x].Info.TrangThai != ENTrangThaiPhoiVe.ConTrong) { if (modelsodoghe.PhoiVes1[s.y, s.x].Info.CustomerId != _workContext.CurrentCustomer.Id) { modelsodoghe.PhoiVes1[s.y, s.x].IsCurrentCustomer = false; } } } } else { modelsodoghe.PhoiVes2[s.y, s.x] = new LoaiXeModel.PhoiVeAdvanceModel(); modelsodoghe.PhoiVes2[s.y, s.x].KyHieu = s.Val; if (s.y >= 1 && s.x >= 1) { //kiem tra thong tin vi tri phoi ve modelsodoghe.PhoiVes2[s.y, s.x].Info = _phoiveService.GetPhoiVe(nguonveid, s, _ngaydi, true); modelsodoghe.PhoiVes2[s.y, s.x].IsCurrentCustomer = true; if (modelsodoghe.PhoiVes2[s.y, s.x].Info.TrangThai != ENTrangThaiPhoiVe.Huy && modelsodoghe.PhoiVes2[s.y, s.x].Info.TrangThai != ENTrangThaiPhoiVe.ConTrong) { if (modelsodoghe.PhoiVes2[s.y, s.x].Info.CustomerId != _workContext.CurrentCustomer.Id) { modelsodoghe.PhoiVes2[s.y, s.x].IsCurrentCustomer = false; } } } } } } //selected tab SaveSelectedTabIndex(TangIndex); return(PartialView(modelsodoghe)); }