67 lines
1.9 KiB
C#
67 lines
1.9 KiB
C#
namespace C968Project.Views;
|
|
|
|
public partial class MainScreen : Form
|
|
{
|
|
public MainScreen()
|
|
{
|
|
InitializeComponent();
|
|
|
|
productsDataGridView.DataSource = Program.Inventory.Products;
|
|
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)
|
|
{
|
|
if (partsDataGridView.CurrentCell is null) return;
|
|
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
|
|
}
|
|
} |