public override void ReportPackage(Package package) { _principal.ReportPackage(package); //Recomendacion decimal lowestPrice = _calculadorCostoEnvio.ObtenerCostoEnvio(package); IDeliveryCompany lowestCompany = package.Empresa; foreach (IDeliveryCompany empresa in _deliveryCompanies.Values) { if (package.Empresa.Name != empresa.Name && empresa.TransportesDisponibles.Contains(package.MedioTransporte.Name)) { decimal price = _calculadorCostoEnvio.ObtenerCostoEnvio(new Package() { Distancia = package.Distancia, Empresa = empresa, MedioTransporte = package.MedioTransporte }); if (price < lowestPrice) { lowestCompany = empresa; lowestPrice = price; } } } if (lowestCompany.Name != package.Empresa.Name) { Console.WriteLine(string.Format("Si hubieras pedido en {0} te hubiera costado({1})", lowestCompany.Name, lowestPrice)); } }
public void Print(Package package, PackageStatusResponse packageStatusResponse) { RangoResponse rangoResponse = _rangoDeTiempoProvider.GetValorPorRango(packageStatusResponse.TimeCheckerResponse.TimePast); decimal costoEnvio = _calculadorCostoEnvio.ObtenerCostoEnvio(package); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(string.Format(Template, Expression1, package.Origen, Expression2, package.Destino, Expression3, rangoResponse.Valor + " " + rangoResponse.Rango, Expression4, costoEnvio, package.Empresa.Name )); Console.ResetColor(); }