Parts screen functionality mostly complete; Just need validation
This commit is contained in:
parent
179e8e13f9
commit
70400de418
@ -5,8 +5,8 @@ namespace C968Project;
|
|||||||
|
|
||||||
public class Inventory
|
public class Inventory
|
||||||
{
|
{
|
||||||
public BindingList<Product> Products { get; set; }
|
public BindingList<Product> Products { get; set; } = new();
|
||||||
public BindingList<Part> Parts { get; set; }
|
public BindingList<Part> Parts { get; set; } = new();
|
||||||
|
|
||||||
public void AddProduct(Product product)
|
public void AddProduct(Product product)
|
||||||
{
|
{
|
||||||
|
@ -8,4 +8,5 @@ public abstract class Part
|
|||||||
public int InStock { get; set; }
|
public int InStock { get; set; }
|
||||||
public int Min { get; set; }
|
public int Min { get; set; }
|
||||||
public int Max { get; set; }
|
public int Max { get; set; }
|
||||||
|
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
using System.Runtime.CompilerServices;
|
||||||
using C968Project.Views;
|
using C968Project.Views;
|
||||||
|
|
||||||
namespace C968Project;
|
namespace C968Project;
|
||||||
@ -6,6 +7,40 @@ static class Program
|
|||||||
{
|
{
|
||||||
|
|
||||||
public static Inventory Inventory = new();
|
public static Inventory Inventory = new();
|
||||||
|
public static int PartIdCounter = 2;
|
||||||
|
public static int ProductIdCounter = 1;
|
||||||
|
|
||||||
|
private static Part _testInhousePart = new Inhouse()
|
||||||
|
{
|
||||||
|
Name = "Inhouse part",
|
||||||
|
Min = 0,
|
||||||
|
Max = 100,
|
||||||
|
Price = 10,
|
||||||
|
InStock = 50,
|
||||||
|
PartID = 0,
|
||||||
|
MachineID = 2
|
||||||
|
};
|
||||||
|
private static Part _testOutsourcedPart = new Outsourced()
|
||||||
|
{
|
||||||
|
Name = "Outsourced part",
|
||||||
|
Min = 10,
|
||||||
|
Max = 100,
|
||||||
|
Price = 5,
|
||||||
|
InStock = 21,
|
||||||
|
PartID = 1,
|
||||||
|
CompanyName = "Chem Inc."
|
||||||
|
};
|
||||||
|
|
||||||
|
private static Product _testProduct = new Product()
|
||||||
|
{
|
||||||
|
Name = "Product",
|
||||||
|
AssociatedParts = new(){_testInhousePart, _testOutsourcedPart},
|
||||||
|
InStock = 500,
|
||||||
|
Max = 4000,
|
||||||
|
Min = 2,
|
||||||
|
Price = 5.45f,
|
||||||
|
ProductId = 0,
|
||||||
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
@ -13,9 +48,19 @@ static class Program
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
|
Inventory.AddPart(_testOutsourcedPart);
|
||||||
|
Inventory.AddPart(_testInhousePart);
|
||||||
|
Inventory.AddProduct(_testProduct);
|
||||||
|
|
||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new MainScreen());
|
Application.Run(new MainScreen());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ScreenOption
|
||||||
|
{
|
||||||
|
ADD,
|
||||||
|
MODIFY
|
||||||
}
|
}
|
20
C968Project/Views/AddModifyPartScreen.Designer.cs
generated
20
C968Project/Views/AddModifyPartScreen.Designer.cs
generated
@ -34,7 +34,7 @@
|
|||||||
idLabel = new Label();
|
idLabel = new Label();
|
||||||
idTextBox = new TextBox();
|
idTextBox = new TextBox();
|
||||||
nameLabel = new Label();
|
nameLabel = new Label();
|
||||||
textBox2 = new TextBox();
|
nameTextBox = new TextBox();
|
||||||
inventoryLabel = new Label();
|
inventoryLabel = new Label();
|
||||||
inventoryTextBox = new TextBox();
|
inventoryTextBox = new TextBox();
|
||||||
priceCostLabel = new Label();
|
priceCostLabel = new Label();
|
||||||
@ -69,6 +69,7 @@
|
|||||||
inHouseRadioButton.TabStop = true;
|
inHouseRadioButton.TabStop = true;
|
||||||
inHouseRadioButton.Text = "In-House";
|
inHouseRadioButton.Text = "In-House";
|
||||||
inHouseRadioButton.UseVisualStyleBackColor = true;
|
inHouseRadioButton.UseVisualStyleBackColor = true;
|
||||||
|
inHouseRadioButton.Click += inHouseRadioButton_Click;
|
||||||
//
|
//
|
||||||
// outsourcedRadioButton
|
// outsourcedRadioButton
|
||||||
//
|
//
|
||||||
@ -80,6 +81,7 @@
|
|||||||
outsourcedRadioButton.TabStop = true;
|
outsourcedRadioButton.TabStop = true;
|
||||||
outsourcedRadioButton.Text = "Outsourced";
|
outsourcedRadioButton.Text = "Outsourced";
|
||||||
outsourcedRadioButton.UseVisualStyleBackColor = true;
|
outsourcedRadioButton.UseVisualStyleBackColor = true;
|
||||||
|
outsourcedRadioButton.Click += outsourcedRadioButton_Click;
|
||||||
//
|
//
|
||||||
// idLabel
|
// idLabel
|
||||||
//
|
//
|
||||||
@ -107,12 +109,12 @@
|
|||||||
nameLabel.TabIndex = 3;
|
nameLabel.TabIndex = 3;
|
||||||
nameLabel.Text = "Name";
|
nameLabel.Text = "Name";
|
||||||
//
|
//
|
||||||
// textBox2
|
// nameTextBox
|
||||||
//
|
//
|
||||||
textBox2.Location = new Point(234, 127);
|
nameTextBox.Location = new Point(234, 127);
|
||||||
textBox2.Name = "textBox2";
|
nameTextBox.Name = "nameTextBox";
|
||||||
textBox2.Size = new Size(153, 23);
|
nameTextBox.Size = new Size(153, 23);
|
||||||
textBox2.TabIndex = 4;
|
nameTextBox.TabIndex = 4;
|
||||||
//
|
//
|
||||||
// inventoryLabel
|
// inventoryLabel
|
||||||
//
|
//
|
||||||
@ -202,6 +204,7 @@
|
|||||||
saveButton.TabIndex = 15;
|
saveButton.TabIndex = 15;
|
||||||
saveButton.Text = "Save";
|
saveButton.Text = "Save";
|
||||||
saveButton.UseVisualStyleBackColor = true;
|
saveButton.UseVisualStyleBackColor = true;
|
||||||
|
saveButton.Click += saveButton_Click;
|
||||||
//
|
//
|
||||||
// cancelButton
|
// cancelButton
|
||||||
//
|
//
|
||||||
@ -211,6 +214,7 @@
|
|||||||
cancelButton.TabIndex = 16;
|
cancelButton.TabIndex = 16;
|
||||||
cancelButton.Text = "Cancel";
|
cancelButton.Text = "Cancel";
|
||||||
cancelButton.UseVisualStyleBackColor = true;
|
cancelButton.UseVisualStyleBackColor = true;
|
||||||
|
cancelButton.Click += cancelButton_Click;
|
||||||
//
|
//
|
||||||
// AddModifyPartScreen
|
// AddModifyPartScreen
|
||||||
//
|
//
|
||||||
@ -230,7 +234,7 @@
|
|||||||
Controls.Add(inventoryLabel);
|
Controls.Add(inventoryLabel);
|
||||||
Controls.Add(inventoryTextBox);
|
Controls.Add(inventoryTextBox);
|
||||||
Controls.Add(nameLabel);
|
Controls.Add(nameLabel);
|
||||||
Controls.Add(textBox2);
|
Controls.Add(nameTextBox);
|
||||||
Controls.Add(idLabel);
|
Controls.Add(idLabel);
|
||||||
Controls.Add(idTextBox);
|
Controls.Add(idTextBox);
|
||||||
Controls.Add(outsourcedRadioButton);
|
Controls.Add(outsourcedRadioButton);
|
||||||
@ -252,7 +256,7 @@
|
|||||||
private TextBox idTextBox;
|
private TextBox idTextBox;
|
||||||
private Label idLabel;
|
private Label idLabel;
|
||||||
private Label nameLabel;
|
private Label nameLabel;
|
||||||
private TextBox textBox2;
|
private TextBox nameTextBox;
|
||||||
private Label inventoryLabel;
|
private Label inventoryLabel;
|
||||||
private TextBox inventoryTextBox;
|
private TextBox inventoryTextBox;
|
||||||
private Label priceCostLabel;
|
private Label priceCostLabel;
|
||||||
|
@ -12,9 +12,163 @@ namespace C968Project.Views
|
|||||||
{
|
{
|
||||||
public partial class AddModifyPartScreen : Form
|
public partial class AddModifyPartScreen : Form
|
||||||
{
|
{
|
||||||
public AddModifyPartScreen()
|
|
||||||
|
private ScreenOption _screenOption;
|
||||||
|
private Part? _selectedPart = null;
|
||||||
|
private Mode _mode = Mode.INHOUSE;
|
||||||
|
|
||||||
|
public AddModifyPartScreen(ScreenOption screenOption, Part? part = null)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
_screenOption = screenOption;
|
||||||
|
_selectedPart = part;
|
||||||
|
|
||||||
|
if (screenOption == ScreenOption.ADD)
|
||||||
|
{
|
||||||
|
screenLabel.Text = "Add Part";
|
||||||
|
ChangeMode(Mode.INHOUSE);
|
||||||
|
}
|
||||||
|
else if (screenOption == ScreenOption.MODIFY)
|
||||||
|
{
|
||||||
|
screenLabel.Text = "Modify Part";
|
||||||
|
PopulatePartData(_selectedPart);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PopulatePartData(Part part)
|
||||||
|
{
|
||||||
|
idTextBox.Text = part.PartID.ToString();
|
||||||
|
nameTextBox.Text = part.Name;
|
||||||
|
inventoryTextBox.Text = part.InStock.ToString();
|
||||||
|
priceCostTextBox.Text = part.Price.ToString();
|
||||||
|
maxTextBox.Text = part.Max.ToString();
|
||||||
|
minTextBox.Text = part.Min.ToString();
|
||||||
|
|
||||||
|
if (part is Outsourced op)
|
||||||
|
{
|
||||||
|
ChangeMode(Mode.OUTSOURCED);
|
||||||
|
machineCompanyTextBox.Text = op.CompanyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (part is Inhouse ip)
|
||||||
|
{
|
||||||
|
ChangeMode(Mode.INHOUSE);
|
||||||
|
machineCompanyTextBox.Text = ip.MachineID.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ModifyPart()
|
||||||
|
{
|
||||||
|
int partIndex;
|
||||||
|
if (_selectedPart != null && Program.Inventory.Parts.Contains(_selectedPart))
|
||||||
|
{
|
||||||
|
partIndex = Program.Inventory.Parts.IndexOf(_selectedPart);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Error modifying part: Could not find part index", "Error", MessageBoxButtons.OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var part = Program.Inventory.Parts[partIndex];
|
||||||
|
var partId = part.PartID;
|
||||||
|
Program.Inventory.Parts[partIndex] = CreatePart(partId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddPart()
|
||||||
|
{
|
||||||
|
int newId = Program.PartIdCounter;
|
||||||
|
Program.PartIdCounter++;
|
||||||
|
|
||||||
|
Program.Inventory.AddPart(CreatePart(newId));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Part CreatePart(int partId)
|
||||||
|
{
|
||||||
|
Part part;
|
||||||
|
|
||||||
|
if (_mode is Mode.INHOUSE)
|
||||||
|
{
|
||||||
|
var inhouse = new Inhouse();
|
||||||
|
inhouse.MachineID = int.Parse(machineCompanyTextBox.Text);
|
||||||
|
part = inhouse;
|
||||||
|
}
|
||||||
|
else if (_mode is Mode.OUTSOURCED)
|
||||||
|
{
|
||||||
|
var outsourced = new Outsourced();
|
||||||
|
outsourced.CompanyName = machineCompanyTextBox.Text;
|
||||||
|
part = outsourced;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("No part mode selected somehow");
|
||||||
|
}
|
||||||
|
|
||||||
|
part.PartID = partId;
|
||||||
|
part.Name = nameTextBox.Text;
|
||||||
|
part.InStock = int.Parse(inventoryTextBox.Text);
|
||||||
|
part.Price = float.Parse(priceCostTextBox.Text);
|
||||||
|
part.Max = int.Parse(maxTextBox.Text);
|
||||||
|
part.Min = int.Parse(minTextBox.Text);
|
||||||
|
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void saveButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (_screenOption is ScreenOption.ADD)
|
||||||
|
{
|
||||||
|
AddPart();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_screenOption is ScreenOption.MODIFY)
|
||||||
|
{
|
||||||
|
ModifyPart();
|
||||||
|
}
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void inHouseRadioButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ChangeMode(Mode.INHOUSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void outsourcedRadioButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
ChangeMode(Mode.OUTSOURCED);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ChangeMode(Mode mode)
|
||||||
|
{
|
||||||
|
_mode = mode;
|
||||||
|
if (mode is Mode.INHOUSE)
|
||||||
|
{
|
||||||
|
outsourcedRadioButton.Checked = false;
|
||||||
|
inHouseRadioButton.Checked = true;
|
||||||
|
machineCompanyLabel.Text = "Machine ID";
|
||||||
|
}
|
||||||
|
if (mode is Mode.OUTSOURCED)
|
||||||
|
{
|
||||||
|
inHouseRadioButton.Checked = false;
|
||||||
|
outsourcedRadioButton.Checked = true;
|
||||||
|
machineCompanyLabel.Text = "Company Name";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Mode
|
||||||
|
{
|
||||||
|
INHOUSE,
|
||||||
|
OUTSOURCED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
31
C968Project/Views/MainScreen.Designer.cs
generated
31
C968Project/Views/MainScreen.Designer.cs
generated
@ -32,6 +32,7 @@ partial class MainScreen
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
panel1 = new Panel();
|
panel1 = new Panel();
|
||||||
|
exitButton = new Button();
|
||||||
productsDeleteButton = new Button();
|
productsDeleteButton = new Button();
|
||||||
productsModifyButton = new Button();
|
productsModifyButton = new Button();
|
||||||
productsAddButton = new Button();
|
productsAddButton = new Button();
|
||||||
@ -47,7 +48,6 @@ partial class MainScreen
|
|||||||
label2 = new Label();
|
label2 = new Label();
|
||||||
mainScreenLabel = new Label();
|
mainScreenLabel = new Label();
|
||||||
partsDataGridView = new DataGridView();
|
partsDataGridView = new DataGridView();
|
||||||
exitButton = new Button();
|
|
||||||
panel1.SuspendLayout();
|
panel1.SuspendLayout();
|
||||||
((ISupportInitialize)productsDataGridView).BeginInit();
|
((ISupportInitialize)productsDataGridView).BeginInit();
|
||||||
((ISupportInitialize)partsDataGridView).BeginInit();
|
((ISupportInitialize)partsDataGridView).BeginInit();
|
||||||
@ -80,6 +80,17 @@ partial class MainScreen
|
|||||||
panel1.Size = new Size(929, 450);
|
panel1.Size = new Size(929, 450);
|
||||||
panel1.TabIndex = 0;
|
panel1.TabIndex = 0;
|
||||||
//
|
//
|
||||||
|
// exitButton
|
||||||
|
//
|
||||||
|
exitButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
exitButton.Location = new Point(842, 415);
|
||||||
|
exitButton.Name = "exitButton";
|
||||||
|
exitButton.Size = new Size(75, 23);
|
||||||
|
exitButton.TabIndex = 16;
|
||||||
|
exitButton.Text = "Exit";
|
||||||
|
exitButton.UseVisualStyleBackColor = true;
|
||||||
|
exitButton.Click += exitButton_Click;
|
||||||
|
//
|
||||||
// productsDeleteButton
|
// productsDeleteButton
|
||||||
//
|
//
|
||||||
productsDeleteButton.Anchor = AnchorStyles.Right;
|
productsDeleteButton.Anchor = AnchorStyles.Right;
|
||||||
@ -89,6 +100,7 @@ partial class MainScreen
|
|||||||
productsDeleteButton.TabIndex = 15;
|
productsDeleteButton.TabIndex = 15;
|
||||||
productsDeleteButton.Text = "Delete";
|
productsDeleteButton.Text = "Delete";
|
||||||
productsDeleteButton.UseVisualStyleBackColor = true;
|
productsDeleteButton.UseVisualStyleBackColor = true;
|
||||||
|
productsDeleteButton.Click += productsDeleteButton_Click;
|
||||||
//
|
//
|
||||||
// productsModifyButton
|
// productsModifyButton
|
||||||
//
|
//
|
||||||
@ -99,6 +111,7 @@ partial class MainScreen
|
|||||||
productsModifyButton.TabIndex = 14;
|
productsModifyButton.TabIndex = 14;
|
||||||
productsModifyButton.Text = "Modify";
|
productsModifyButton.Text = "Modify";
|
||||||
productsModifyButton.UseVisualStyleBackColor = true;
|
productsModifyButton.UseVisualStyleBackColor = true;
|
||||||
|
productsModifyButton.Click += productsModifyButton_Click;
|
||||||
//
|
//
|
||||||
// productsAddButton
|
// productsAddButton
|
||||||
//
|
//
|
||||||
@ -109,6 +122,7 @@ partial class MainScreen
|
|||||||
productsAddButton.TabIndex = 13;
|
productsAddButton.TabIndex = 13;
|
||||||
productsAddButton.Text = "Add";
|
productsAddButton.Text = "Add";
|
||||||
productsAddButton.UseVisualStyleBackColor = true;
|
productsAddButton.UseVisualStyleBackColor = true;
|
||||||
|
productsAddButton.Click += productsAddButton_Click;
|
||||||
//
|
//
|
||||||
// productsSearchButton
|
// productsSearchButton
|
||||||
//
|
//
|
||||||
@ -120,6 +134,7 @@ partial class MainScreen
|
|||||||
productsSearchButton.Text = "Search";
|
productsSearchButton.Text = "Search";
|
||||||
productsSearchButton.TextImageRelation = TextImageRelation.ImageAboveText;
|
productsSearchButton.TextImageRelation = TextImageRelation.ImageAboveText;
|
||||||
productsSearchButton.UseVisualStyleBackColor = true;
|
productsSearchButton.UseVisualStyleBackColor = true;
|
||||||
|
productsSearchButton.Click += productsSearchButton_Click;
|
||||||
//
|
//
|
||||||
// productsSearchTextBox
|
// productsSearchTextBox
|
||||||
//
|
//
|
||||||
@ -157,6 +172,7 @@ partial class MainScreen
|
|||||||
partsDeleteButton.TabIndex = 8;
|
partsDeleteButton.TabIndex = 8;
|
||||||
partsDeleteButton.Text = "Delete";
|
partsDeleteButton.Text = "Delete";
|
||||||
partsDeleteButton.UseVisualStyleBackColor = true;
|
partsDeleteButton.UseVisualStyleBackColor = true;
|
||||||
|
partsDeleteButton.Click += partsDeleteButton_Click;
|
||||||
//
|
//
|
||||||
// partsModifyButton
|
// partsModifyButton
|
||||||
//
|
//
|
||||||
@ -167,6 +183,7 @@ partial class MainScreen
|
|||||||
partsModifyButton.TabIndex = 7;
|
partsModifyButton.TabIndex = 7;
|
||||||
partsModifyButton.Text = "Modify";
|
partsModifyButton.Text = "Modify";
|
||||||
partsModifyButton.UseVisualStyleBackColor = true;
|
partsModifyButton.UseVisualStyleBackColor = true;
|
||||||
|
partsModifyButton.Click += partsModifyButton_Click;
|
||||||
//
|
//
|
||||||
// partsAddButton
|
// partsAddButton
|
||||||
//
|
//
|
||||||
@ -177,6 +194,7 @@ partial class MainScreen
|
|||||||
partsAddButton.TabIndex = 6;
|
partsAddButton.TabIndex = 6;
|
||||||
partsAddButton.Text = "Add";
|
partsAddButton.Text = "Add";
|
||||||
partsAddButton.UseVisualStyleBackColor = true;
|
partsAddButton.UseVisualStyleBackColor = true;
|
||||||
|
partsAddButton.Click += partsAddButton_Click;
|
||||||
//
|
//
|
||||||
// partsSearchButton
|
// partsSearchButton
|
||||||
//
|
//
|
||||||
@ -188,6 +206,7 @@ partial class MainScreen
|
|||||||
partsSearchButton.Text = "Search";
|
partsSearchButton.Text = "Search";
|
||||||
partsSearchButton.TextImageRelation = TextImageRelation.ImageAboveText;
|
partsSearchButton.TextImageRelation = TextImageRelation.ImageAboveText;
|
||||||
partsSearchButton.UseVisualStyleBackColor = true;
|
partsSearchButton.UseVisualStyleBackColor = true;
|
||||||
|
partsSearchButton.Click += partsSearchButton_Click;
|
||||||
//
|
//
|
||||||
// partsSearchTextBox
|
// partsSearchTextBox
|
||||||
//
|
//
|
||||||
@ -225,16 +244,6 @@ partial class MainScreen
|
|||||||
partsDataGridView.Size = new Size(440, 162);
|
partsDataGridView.Size = new Size(440, 162);
|
||||||
partsDataGridView.TabIndex = 0;
|
partsDataGridView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// exitButton
|
|
||||||
//
|
|
||||||
exitButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
||||||
exitButton.Location = new Point(842, 415);
|
|
||||||
exitButton.Name = "exitButton";
|
|
||||||
exitButton.Size = new Size(75, 23);
|
|
||||||
exitButton.TabIndex = 16;
|
|
||||||
exitButton.Text = "Exit";
|
|
||||||
exitButton.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// MainScreen
|
// MainScreen
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
@ -9,4 +9,58 @@ public partial class MainScreen : Form
|
|||||||
productsDataGridView.DataSource = Program.Inventory.Products;
|
productsDataGridView.DataSource = Program.Inventory.Products;
|
||||||
partsDataGridView.DataSource = Program.Inventory.Parts;
|
partsDataGridView.DataSource = Program.Inventory.Parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void exitButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Parts
|
||||||
|
private void partsAddButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AddModifyPartScreen partScreen = new AddModifyPartScreen(ScreenOption.ADD);
|
||||||
|
partScreen.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void partsModifyButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Part part = Program.Inventory.LookupPart(partsDataGridView.CurrentCell.RowIndex);
|
||||||
|
if (part is null) return;
|
||||||
|
AddModifyPartScreen partScreen = new AddModifyPartScreen(ScreenOption.MODIFY, part);
|
||||||
|
partScreen.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void partsDeleteButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Part part = Program.Inventory.LookupPart(partsDataGridView.CurrentCell.RowIndex);
|
||||||
|
Program.Inventory.DeletePart(part);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void partsSearchButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// TODO: Search functionality
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Products
|
||||||
|
private void productsAddButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AddModifyProductScreen productScreen = new AddModifyProductScreen();
|
||||||
|
productScreen.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void productsModifyButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
AddModifyProductScreen productScreen = new AddModifyProductScreen();
|
||||||
|
productScreen.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void productsDeleteButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void productsSearchButton_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// TODO: Search functionality
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user