public ProcesadorInformacionPedidoPaquete(IMensajePedidoPaquete _mensajePedidoPaquete, ITiempoEntrega _tiempoEntrega, IFechaEntrega _fechaEntrega, ICostoEnvio _costoEnvio) { mensajePedidoPaquete = _mensajePedidoPaquete ?? throw new System.ArgumentNullException(nameof(_mensajePedidoPaquete)); tiempoEntrega = _tiempoEntrega ?? throw new ArgumentNullException(nameof(_tiempoEntrega)); fechaEntrega = _fechaEntrega ?? throw new ArgumentNullException(nameof(_fechaEntrega)); costoEnvio = _costoEnvio ?? throw new ArgumentNullException(nameof(_costoEnvio)); }
public ICostoEnvio CrearInstancia(EnumMedioTransporte _enumMedioTransporte, string _cIdentificadorEmpresa) { ICostoEnvio costoEnvio = null; switch (_enumMedioTransporte) { case EnumMedioTransporte.Maritimo: break; case EnumMedioTransporte.Terrestre: break; case EnumMedioTransporte.Aereo: costoEnvio = ObtenerInstanciaCostoEnvioAereo(_cIdentificadorEmpresa); break; } return(costoEnvio); }
private static List <string> ObtenerMensajesPedido(List <PedidoDTO> _lstPedidoDTO) { DateTime dtFechaActual = new DateTime(2020, 1, 23, 14, 0, 0); var docContainer = Container.For <DI_Dependencias>(); TiempoRepartoFactory tiempoRepartoFactory = new TiempoRepartoFactory(docContainer); TiempoTrasladoFactory tiempoTrasladoFactory = new TiempoTrasladoFactory(); MensajePedidoPaquete mensajePedidoPaquete = ObtenerInstanciaMensajePedidoPaquete(); CostoEnvioFactory costoEnvioFactory = new CostoEnvioFactory(docContainer); List <string> lstInformacionPedido = new List <string>(); foreach (PedidoDTO pedido in _lstPedidoDTO) { ITiempoReparto tiempoReparto = tiempoRepartoFactory.CrearInstancia(pedido.enumEmpresa); ITiempoTraslado tiempoTraslado = tiempoTrasladoFactory.CrearInstancia(pedido.enumMedioTransporte); ITiempoEntrega tiempoEntrega = new TiempoEntrega(tiempoTraslado, tiempoReparto); IFechaEntrega fechaEntrega = new FechaEntrega(); ICostoEnvio costoEnvio = costoEnvioFactory.CrearInstancia(pedido.enumMedioTransporte, pedido.cIdentificadorEmpresa); ProcesadorInformacionPedidoPaquete procesadorInformacionPedidoPaquete = new ProcesadorInformacionPedidoPaquete(mensajePedidoPaquete, tiempoEntrega, fechaEntrega, costoEnvio); lstInformacionPedido.Add(procesadorInformacionPedidoPaquete.ObtenerInformacionPedidoPaquete(pedido, dtFechaActual)); } return(lstInformacionPedido); }