Exemple #1
0
        public string RegisterStorage(string type, string name)
        {
            if (!storageTypes.Contains(type))
            {
                throw new InvalidOperationException("Invalid storage type!");
            }

            if (type == storageTypes[0])
            {
                AutomatedWarehouse automatedWarehouse = new AutomatedWarehouse(name);
                storages.Add(automatedWarehouse);
            }
            else if (type == storageTypes[1])
            {
                DistributionCenter distributionCenter = new DistributionCenter(name);
                storages.Add(distributionCenter);
            }
            else if (type == storageTypes[2])
            {
                Warehouse warehouse = new Warehouse(name);
                storages.Add(warehouse);
            }

            return($"Registered {name}");
        }
Exemple #2
0
        private Storage CreateStorage(string type, string name)
        {
            Storage storage = null;

            switch (type)
            {
            case "AutomatedWarehouse":
            {
                storage = new AutomatedWarehouse(name);
                break;
            }

            case "DistributionCenter":
            {
                storage = new DistributionCenter(name);
                break;
            }

            case "Warehouse":
            {
                storage = new Warehouse(name);
                break;
            }

            default:
            {
                throw new InvalidOperationException("Invalid storage type!");
            }
            }
            return(storage);
        }
        public string RegisterStorage(string type, string name)
        {
            Storage newStorage;


            switch (type)
            {
            case "AutomatedWarehouse":
                newStorage = new AutomatedWarehouse();
                break;

            case "DistributionCenter":
                newStorage = new DistributionCenter();
                break;

            case "Warehouse":
                newStorage = new Warehouse();
                break;

            default: { throw new InvalidOperationException("Invalid storage type!"); }
            }

            storagesPool.Add(newStorage);
            return($"Registered {name} ");
        }