public static DiemDonModel ToModel(this DiemDon nvfrom, ILocalizationService _localizationService) { var nvto = new DiemDonModel(); if (nvfrom == null) { return(nvto); } nvto.Id = nvfrom.Id; nvto.TenDiemDon = nvfrom.TenDiemDon; nvto.LoaiDiemDonId = nvfrom.LoaiDiemDonId; nvto.LoaiDiemDonText = nvfrom.LoaiDiemDon.ToCVEnumText(_localizationService); nvto.VanPhongId = nvfrom.VanPhongId.GetValueOrDefault(0); if (nvfrom.vanphong != null) { nvto.VanPhongText = nvfrom.vanphong.TenVanPhong; } nvto.DiaChiId = nvfrom.DiaChiId; nvto.BenXeId = nvfrom.BenXeId.GetValueOrDefault(0); if (nvfrom.benxe != null) { nvto.BenXeText = nvfrom.benxe.TenBenXe; } return(nvto); }
public virtual void DeleteDiemDon(DiemDon _item) { if (_item == null) { throw new ArgumentNullException("DiemDon"); } _diemdonRepository.Delete(_item); }
public ActionResult _GetBangGia(int HanhTrinhId, string NgayDi) { if (this.CheckNoAccessIntoNhaXe(_workContext, _permissionService, StandardPermissionProvider.CVHoatDongBanVe)) { return(AccessDeniedPartialView()); } if (_workContext.CurrentVanPhong.Id == CommonHelper.VanPhongKhoiTaoId) { return(AccessDeniedPartialView()); } var model = new BangVeInfoModel(); model.NgayDi = Convert.ToDateTime(NgayDi); var hanhtrinh = _hanhtrinhService.GetHanhTrinhById(HanhTrinhId); var hanhtrinhdiemdon = _hanhtrinhService.GetAllHanhTrinhDiemDonByHanhTrinhId(HanhTrinhId).OrderBy(c => c.ThuTu); var diemdonhientai = new DiemDon(); if (hanhtrinhdiemdon.Count() > 0) { diemdonhientai = _hanhtrinhService.GetDiemDonByHanhTrinhDiemDonId(hanhtrinhdiemdon.First().Id); } else { return(null); } model.TenDauTuyen = diemdonhientai.TenDiemDon; int TongVe = 0; decimal TongTien = 0; model.HanhTrinhGiaVes = _hanhtrinhService.GetallHanhTrinhGiaVe(HanhTrinhId, 0, diemdonhientai.Id).Select(c => { var item = new HanhTrinhGiaVeModel(); ToHanhTrinhGiaVeModel(c, item); item.VeXes = _giaodichkeveService.GetVeXeBanQuayByDay(_workContext.NhaXeId, model.NgayDi, c.Id, 0, _workContext.CurrentNhanVien.Id, c.GiaVe, c.HanhTrinh.isTuyenDi); item.SoVeDaBan = item.VeXes.Count(); TongVe = TongVe + item.SoVeDaBan; TongTien = TongTien + (item.SoVeDaBan * c.GiaVe); for (int k = 0; k < item.SoVeDaBan; k++) { if (k == 0) { var vetruoc = _giaodichkeveService.GetVeXeItemById(item.VeXes[k].Id + 1); if (item.VeXes[k].NgayBan.Value.AddMinutes(5) >= DateTime.Now && vetruoc.TrangThai == ENVeXeItemTrangThai.DA_GIAO_HANG) { item.VeXes[k].CanDelete = true; } } else { item.VeXes[k].CanDelete = false; } } var vechuanbiban = _giaodichkeveService.GetVeChuanBiBanTaiQuay(_workContext.NhaXeId, _workContext.CurrentVanPhong.Id, c.GiaVe, c.HanhTrinh.isTuyenDi); if (vechuanbiban != null) { item.SoSeriHienTai = vechuanbiban.SoSeri; if (vechuanbiban.quyenve != null) { item.QuyenDangBan = vechuanbiban.quyenve.ThongTin; } else { item.QuyenDangBan = "_________________"; } } else { item.IsHetVe = true; item.QuyenDangBan = "_________________"; } item.SoVeConLai = _giaodichkeveService.CountVeConLaiTaiQuay(_workContext.NhaXeId, _workContext.CurrentVanPhong.Id, c.GiaVe, c.HanhTrinh.isTuyenDi); return(item); }).ToList(); model.TongVeDaBan = TongVe; model.TongTien = TongTien.ToTien(_priceFormatter); model.SoDiemDon = model.HanhTrinhGiaVes.Count(); return(PartialView(model)); }
public NguonVeListModel() { DiemDonDi = new DiemDon(); DiemDoDen = new DiemDon(); }