public void Main()
        {
            ITransporteFactory transporte     = new TransporteFactory();
            IEmpresaFactory    empresaFactory = new EmpresaFactory();

            do
            {
                ITipoEnvio tipoEnvio = transporte.CrearInstancia(ObtenerTransporte());
                int        iEmpresa  = ObtenerEmpresa();
                string     cProducto = ObtenerProducto();
                Empresas   empresa   = empresaFactory.CrearInstancia(iEmpresa, tipoEnvio, cProducto);

                IniciarMensajeria(empresa);
            } while (true);
        }
示例#2
0
        public Empresas CrearInstancia(int iTipo, ITipoEnvio tipoEnvio, string cProducto)
        {
            Empresas empresa = null;

            switch (iTipo)
            {
            case 1:
                empresa = new DHL(tipoEnvio, cProducto);
                break;

            case 2:
                empresa = new Fedex(tipoEnvio, cProducto);

                break;

            case 4:
                empresa = new Estafeta(tipoEnvio, cProducto);

                break;
            }

            return(empresa);
        }
示例#3
0
        public ITipoEnvio CrearInstancia(int iTipo)
        {
            ITipoEnvio tipoEnvio = null;

            switch (iTipo)
            {
            case 1:
                tipoEnvio = new Avion();
                break;

            case 2:
                tipoEnvio = new Tren();
                break;

            case 3:
                tipoEnvio = new Barco();
                break;

            default:
                break;
            }

            return(tipoEnvio);
        }
 public Fedex(ITipoEnvio tipoEnvio, string cProducto) : base(tipoEnvio, cProducto)
 {
 }
 public Empresas(ITipoEnvio tipoEnvio, string cProducto)
 {
     _tipoEnvio = tipoEnvio;
     _cProducto = cProducto;
 }
示例#6
0
 public EmpresaDHL(ITipoEnvio _ITipoEnvio)
 {
     this.ITipoEnvio = _ITipoEnvio;
 }
 public Estafeta(ITipoEnvio tipoEnvio, string cProducto) : base(tipoEnvio, cProducto)
 {
 }
示例#8
0
 public EmpresaFedex(ITipoEnvio _ITipoEnvio)
 {
     this.ITipoEnvio = _ITipoEnvio;
 }
 public EmpresaEstafeta(ITipoEnvio _ITipoEnvio)
 {
     this.ITipoEnvio = _ITipoEnvio;
 }
示例#10
0
 public DHL(ITipoEnvio tipoEnvio, string cProducto) : base(tipoEnvio, cProducto)
 {
 }