-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.cs
More file actions
101 lines (83 loc) · 2.96 KB
/
Copy pathMainWindow.cs
File metadata and controls
101 lines (83 loc) · 2.96 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
using System.ComponentModel;
using System.Windows.Forms;
namespace Inventory_Management_System
{
public partial class MainWindow : Form
{
public MainWindow()
{
InitializeComponent();
// Initialize the screens
MainDisplay mainDisplay = new MainDisplay();
AddPart addPart = new AddPart();
AddProduct addProduct = new AddProduct();
// Generate some default parts and products for testing
generateDefaultParts();
generateDefaultProduct();
}
private void MainWindow_ControlAdded(object sender, ControlEventArgs e)
{
// Disable the mainDisplay when another control is added as a pop-up
mainDisplay1.Enabled = false;
}
private void MainWindow_ControlRemoved(object sender, ControlEventArgs e)
{
// Enable the mainDisplay when the pop-up is removed
mainDisplay1.Enabled = true;
}
private void generateDefaultParts()
{
Inhouse part1 = new Inhouse();
Inhouse part2 = new Inhouse();
Outsourced part3 = new Outsourced();
part1.PartID = 0;
part2.PartID = 1;
part3.PartID = 2;
part1.Name = "Curved Handlebar";
part2.Name = "Wide Seat";
part3.Name = "Street Tire";
part1.Price = 25.50M;
part2.Price = 35.95M;
part3.Price = 16.99M;
part1.InStock = 2;
part2.InStock = 3;
part3.InStock = 4;
part1.Min = 1;
part2.Min = 1;
part3.Min = 2;
part1.Max = 5;
part2.Max = 5;
part3.Max = 50;
part1.MachineID = 1;
part2.MachineID = 4;
part3.CompanyName = "Toyo";
Inventory.addPart(part1);
Inventory.addPart(part2);
Inventory.addPart(part3);
}
private void generateDefaultProduct()
{
Product product1 = new Product();
Product product2 = new Product();
product1.AssociatedParts = new BindingList<Part>();
product1.ProductID = 0;
product1.Name = "Blue Bicycle";
product1.Price = 250.95M;
product1.InStock = 2;
product1.Min = 1;
product1.Max = 5;
product1.addAssociatedPart(Inventory.AllParts[0] as Part);
product1.addAssociatedPart(Inventory.AllParts[2] as Part);
product2.AssociatedParts = new BindingList<Part>();
product2.ProductID = 1;
product2.Name = "Mountain Bike";
product2.Price = 275.00M;
product2.InStock = 2;
product2.Min = 1;
product2.Max = 5;
product2.addAssociatedPart(Inventory.AllParts[1] as Part);
Inventory.addProduct(product1);
Inventory.addProduct(product2);
}
}
}