-
Notifications
You must be signed in to change notification settings - Fork 0
/
StoragMaster.cs
90 lines (71 loc) · 2.63 KB
/
StoragMaster.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Net.NetworkInformation;
using System.Reflection.Metadata.Ecma335;
using System.Text;
namespace StorageMaster
{
class StoragMaster
{
public List<Product> productsPool = new List<Product>();
public List<Storage> storagesPool = new List<Storage>();
public IDictionary<string, Storage> StorageRgistery = new Dictionary<string, Storage>();
public Vehicle currentvehicle;
public string AddProduct(string type, double price)
{
Product newProduct;
switch (type)
{
case "Gpu":
newProduct = new Gpu(price);
break;
case "Ram":
newProduct = new Ram(price);
break;
case "hardDrive":
newProduct = new HardDrive(price);
break;
case "SolidStateDrive":
newProduct = new SolidStateDrive(price);
break;
default: { throw new InvalidOperationException("Invalid product type!"); }
}
productsPool.Add(newProduct);
return "Added {type} to pool.";
}
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} ";
}
public string SelectVehicle(string storageName, int garageSlot)
{
currentvehicle = StorageRgistery[storageName].GetVehicle(garageSlot);
return $"Selected {currentvehicle.GetType()}";
}
public void LoadVehicle(IEnumerable<string> productNames)
{
foreach (var item in productsPool)
{
if (currentvehicle.IsFull) break;
// if(currentvehicle.products[item].)
}
// IENumberable<string> tempList = productsPool..Select(x => x.).ToList();
}
}
}