Example #1
0
        public ITransporte ObtenerTransporte(string _cTransporte, DatosConfiguracion _entDatosConfig)
        {
            ITransporte      Transporte;
            MediosTransporte datosMedios;

            switch (_cTransporte)
            {
            case "Marítimo":
                datosMedios = _entDatosConfig.MediosTransporte.Where(w => w.Medio == "Marítimo").FirstOrDefault();
                Transporte  = new Barco(datosMedios.CostoPorKilometro, datosMedios.Velocidad);
                break;

            case "Terrestre":
                datosMedios = _entDatosConfig.MediosTransporte.Where(w => w.Medio == "Terrestre").FirstOrDefault();
                Transporte  = new Tren(datosMedios.CostoPorKilometro, datosMedios.Velocidad);
                break;

            case "Aéreo":
                datosMedios = _entDatosConfig.MediosTransporte.Where(w => w.Medio == "Aéreo").FirstOrDefault();
                Transporte  = new Avion(datosMedios.CostoPorKilometro, datosMedios.Velocidad);
                break;

            default:
                throw new Exception("No existe el transporte solicitado");
            }

            return(Transporte);
        }
Example #2
0
 public DatosConfiguracion LeerConfiguracion(string _cRuta)
 {
     if (File.Exists(_cRuta))
     {
         using (StreamReader r = new StreamReader(_cRuta))
         {
             string cJson = r.ReadToEnd();
             //List<DatosConfiguracion> prueba = JsonConvert.DeserializeObject<List<DatosConfiguracion>>(cJson);
             DatosConfiguracion entConfiguracion = JsonConvert.DeserializeObject <DatosConfiguracion>(cJson);
             return(entConfiguracion);
         }
     }
     else
     {
         throw new Exception("No se encontro el archivo de configuración");
     }
 }
Example #3
0
 public ConfiguracionLogica()
 {
     this.datos = new DatosConfiguracion();
 }
Example #4
0
 public EmpresaFactory(ITransporte _Transporte, DatosPedido _Datos, DatosConfiguracion _entDatosConfig)
 {
     Transporte     = _Transporte;
     DatosPedido    = _Datos;
     entDatosConfig = _entDatosConfig;
 }
Example #5
0
 public EmpresaTransporteService(List <DatosPedido> _lstDatosPedido, DatosConfiguracion _entDatosConfig)
 {
     lstDatosPedido = _lstDatosPedido;
     entDatosConfig = _entDatosConfig;
 }