private void ChonPhuongThucVanChuyen() { if (ptvc == null) { ptvc = PhuongThucVanChuyen.ChonPhuongThucPhuHop(TrongLuong, KhoangCach, SoNgayToiDaGiaoHang()); } }
internal static PhuongThucVanChuyen ChonPhuongThucPhuHop(float trongLuong, float khoangCach, int soNgaymax) { PhuongThucVanChuyen kq = null; int SoNgay0, SoNgay1; SoNgay0 = sample[0].TinhThoiGianGiaoHang(khoangCach); SoNgay1 = sample[1].TinhThoiGianGiaoHang(khoangCach); float GiaTien0, GiaTien1; GiaTien0 = sample[0].TinhChiPhi(trongLuong, khoangCach); GiaTien1 = sample[1].TinhChiPhi(trongLuong, khoangCach); int idx = TinhPhuongAnTotHon(SoNgay0, SoNgay1, GiaTien0, GiaTien1); if (idx == -1) { //return null; // huy don dat hang, potay return(sample[LayPhuongThucMacDinh()]); } return(sample[idx]); }