public static XeXuatBenItemModel toModel(this HistoryXeXuatBen entity, ILocalizationService localizationService) { var model = new XeXuatBenItemModel(); if (entity == null) { return(model); } XeXuatBentoModel(model, entity, localizationService); return(model); }
static void XeXuatBentoModel(XeXuatBenItemModel model, HistoryXeXuatBen entity, ILocalizationService localizationService) { model.Id = entity.Id; model.NguonVeId = entity.NguonVeId; model.XeVanChuyenId = entity.XeVanChuyenId; if (entity.xevanchuyen != null) { model.BienSo = entity.xevanchuyen.BienSo; } model.TrangThai = entity.TrangThai; model.TrangThaiText = entity.TrangThai.ToCVEnumText(localizationService); model.NgayDi = entity.NgayDi; model.SoNguoi = 0; model.NgayTao = entity.NgayTao; model.NguoiTaoId = entity.NguoiTaoId; if (entity.NguoiTao != null) { model.TenNguoiTao = entity.NguoiTao.HoVaTen; } model.GhiChu = entity.GhiChu; model.HanhTrinhId = entity.HanhTrinhId; if (entity.NguonVeInfo != null) { model.TuyenXeChay = entity.NguonVeInfo.GetHanhTrinh(); model.GioDi = entity.NguonVeInfo.ThoiGianDi.ToString("HH:mm"); model.GioDen = entity.NguonVeInfo.ThoiGianDen.ToString("HH:mm"); } model.laivaphuxes = entity.LaiPhuXes.Select(c => { return(new XeXuatBenItemModel.NhanVienLaiPhuXe(c.NhanVien_Id, c.nhanvien.ThongTin())); }).ToList(); model.nhatkys = entity.NhatKys.Select(c => { var item = new XeXuatBenItemModel.NhatKyXeXuatBen(); item.Id = c.Id; item.NgayTao = c.NgayTao; item.NguoiTaoId = c.NguoiTaoId; if (c.NguoiTao != null) { item.TenNguoiTao = c.NguoiTao.HoVaTen; } item.GhiChu = c.GhiChu; return(item); }).ToList(); //khong dc edit if (model.TrangThai == ENTrangThaiXeXuatBen.KET_THUC || model.TrangThai == ENTrangThaiXeXuatBen.HUY) { model.isEdit = false; } }
static void XeXuatBentoModel(XeXuatBenItemModel model, HistoryXeXuatBen entity, ILocalizationService localizationService) { model.Id = entity.Id; model.NguonVeId = entity.NguonVeId; model.XeVanChuyenId = entity.XeVanChuyenId.GetValueOrDefault(0); if (entity.xevanchuyen != null) { model.BienSo = entity.xevanchuyen.BienSo; } else { model.BienSo = "----"; } model.TrangThai = entity.TrangThai; model.TrangThaiText = entity.TrangThai.ToCVEnumText(localizationService); model.NgayDi = entity.NgayDi; model.SoNguoi = entity.SoNguoi; model.SoGhe = entity.NguonVeInfo.LichTrinhInfo.loaixeinfo.sodoghe.SoLuongGhe; model.NgayTao = entity.NgayTao; model.NguoiTaoId = entity.NguoiTaoId; if (entity.NguoiTao != null) { model.TenNguoiTao = entity.NguoiTao.HoVaTen; } model.GhiChu = entity.GhiChu; model.HanhTrinhId = entity.HanhTrinhId; if (model.BienSo.Length >= 4) { model.BienSoXe3So = model.BienSo.Substring(model.BienSo.Length - 4); } else { model.BienSoXe3So = "----"; } if (entity.NguonVeInfo != null) { model.TuyenXeChay = entity.NguonVeInfo.GetHanhTrinh(); model.GioDi = entity.NgayDi.ToString("HH:mm"); model.GioDen = entity.NgayDi.AddHours(4).ToString("HH:mm"); } model.laivaphuxes = entity.LaiPhuXes.Select(c => { return(new XeXuatBenItemModel.NhanVienLaiPhuXe(c.NhanVien_Id, c.nhanvien.HoVaTen)); }).ToList(); if (model.laivaphuxes.Count > 0) { model.LaiXeId = model.laivaphuxes[0].Id; model.TenLaiXe = model.laivaphuxes[0].TenLaiXe; if (model.laivaphuxes.Count > 1) { model.NTVId = model.laivaphuxes[1].Id; model.TenNTV = model.laivaphuxes[1].TenLaiXe; } } model.ThongTinLaiPhuXe = entity.ThongTinLaiPhuXes(); if (string.IsNullOrEmpty(model.ThongTinLaiPhuXe)) { model.ThongTinLaiPhuXe = "---------"; } if (model.laivaphuxes.Count > 1) { model.PhuXeId = model.laivaphuxes[1].Id; } model.nhatkys = entity.NhatKys.Select(c => { var item = new XeXuatBenItemModel.NhatKyXeXuatBen(); item.Id = c.Id; item.NgayTao = c.NgayTao; item.NguoiTaoId = c.NguoiTaoId; if (c.NguoiTao != null) { item.TenNguoiTao = c.NguoiTao.HoVaTen; } item.GhiChu = c.GhiChu; return(item); }).ToList(); //khong dc edit if (model.TrangThai == ENTrangThaiXeXuatBen.KET_THUC || model.TrangThai == ENTrangThaiXeXuatBen.HUY) { model.isEdit = false; } }
public ChuyenDiModel(XeXuatBenItemModel chuyendi) { this.xexuatben = chuyendi; }