From 0279a3a363943ca81893ef6310b5fe7657b90065 Mon Sep 17 00:00:00 2001 From: Jacob Boislard Date: Mon, 17 Apr 2017 20:47:20 -0400 Subject: [PATCH] Started chef station --- Enigma/Enigma.csproj | 10 ++ Enigma/EnigmaMain.cs | 7 + Enigma/Stations/ChefStation.cs | 24 ++++ .../StationsGUI/AdminStationView.Designer.cs | 60 ++++----- .../StationsGUI/ChefStationView.Designer.cs | 95 ++++++++++++++ Enigma/StationsGUI/ChefStationView.cs | 87 +++++++++++++ Enigma/StationsGUI/ChefStationView.resx | 123 ++++++++++++++++++ EnigmaX/Classes/Order.cs | 30 +++++ EnigmaX/EnigmaX.csproj | 1 + 9 files changed, 407 insertions(+), 30 deletions(-) create mode 100644 Enigma/Stations/ChefStation.cs create mode 100644 Enigma/StationsGUI/ChefStationView.Designer.cs create mode 100644 Enigma/StationsGUI/ChefStationView.cs create mode 100644 Enigma/StationsGUI/ChefStationView.resx create mode 100644 EnigmaX/Classes/Order.cs diff --git a/Enigma/Enigma.csproj b/Enigma/Enigma.csproj index 06de531..74a86c1 100644 --- a/Enigma/Enigma.csproj +++ b/Enigma/Enigma.csproj @@ -124,6 +124,12 @@ + + Form + + + ChefStationView.cs + Form @@ -137,6 +143,7 @@ WaiterStationView.cs + @@ -167,6 +174,9 @@ AdminStationView.cs + + ChefStationView.cs + DebugStationView.cs diff --git a/Enigma/EnigmaMain.cs b/Enigma/EnigmaMain.cs index f54c0b2..52e9f2a 100644 --- a/Enigma/EnigmaMain.cs +++ b/Enigma/EnigmaMain.cs @@ -81,5 +81,12 @@ namespace Enigma loadedStations.Add(station); station.showView(); } + + private void chefbutton_Click(object sender, EventArgs e) + { + ChefStation station = new ChefStation("debugchef"); + loadedStations.Add(station); + station.showView(); + } } } diff --git a/Enigma/Stations/ChefStation.cs b/Enigma/Stations/ChefStation.cs new file mode 100644 index 0000000..d02614d --- /dev/null +++ b/Enigma/Stations/ChefStation.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using EnigmaX.Classes; + +namespace Enigma.Stations +{ + class ChefStation : Station + { + public ChefStation(string stationid) : base(StationTypeDef.host, stationid) + { + Employee activeEmployee = SystemFunctions.showPinScreenUntilAuthenticated(EmployeeRole.chef); + view = new StationsGUI.ChefStationView(); + + } + + public override void showView() + { + view.Show(); + } + } +} \ No newline at end of file diff --git a/Enigma/StationsGUI/AdminStationView.Designer.cs b/Enigma/StationsGUI/AdminStationView.Designer.cs index 74cec3b..6ae99bb 100644 --- a/Enigma/StationsGUI/AdminStationView.Designer.cs +++ b/Enigma/StationsGUI/AdminStationView.Designer.cs @@ -138,9 +138,9 @@ this.menuTab.HorizontalScrollbarBarColor = true; this.menuTab.HorizontalScrollbarHighlightOnWheel = false; this.menuTab.HorizontalScrollbarSize = 10; - this.menuTab.Location = new System.Drawing.Point(4, 38); + this.menuTab.Location = new System.Drawing.Point(4, 39); this.menuTab.Name = "menuTab"; - this.menuTab.Size = new System.Drawing.Size(1360, 790); + this.menuTab.Size = new System.Drawing.Size(1360, 789); this.menuTab.TabIndex = 0; this.menuTab.Text = "Edit Menus"; this.menuTab.VerticalScrollbarBarColor = true; @@ -153,7 +153,7 @@ this.menuSelectionBox.FormattingEnabled = true; this.menuSelectionBox.Location = new System.Drawing.Point(169, 35); this.menuSelectionBox.Name = "menuSelectionBox"; - this.menuSelectionBox.Size = new System.Drawing.Size(355, 28); + this.menuSelectionBox.Size = new System.Drawing.Size(355, 24); this.menuSelectionBox.TabIndex = 12; this.menuSelectionBox.SelectedIndexChanged += new System.EventHandler(this.menuSelectionBox_SelectedIndexChanged); // @@ -164,7 +164,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.menuListBox.Font = new System.Drawing.Font("Segoe UI Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.menuListBox.FormattingEnabled = true; - this.menuListBox.ItemHeight = 38; + this.menuListBox.ItemHeight = 31; this.menuListBox.Items.AddRange(new object[] { "Item1", "Item1", @@ -182,7 +182,7 @@ this.menuListBox.Location = new System.Drawing.Point(8, 69); this.menuListBox.Name = "menuListBox"; this.menuListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple; - this.menuListBox.Size = new System.Drawing.Size(696, 650); + this.menuListBox.Size = new System.Drawing.Size(696, 624); this.menuListBox.TabIndex = 11; // // menuSaveButton @@ -287,7 +287,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.menuDisplayedOnListBox.FormattingEnabled = true; - this.menuDisplayedOnListBox.ItemHeight = 28; + this.menuDisplayedOnListBox.ItemHeight = 23; this.menuDisplayedOnListBox.Items.AddRange(new object[] { "Computer1", "Computer2", @@ -296,7 +296,7 @@ this.menuDisplayedOnListBox.Location = new System.Drawing.Point(183, 119); this.menuDisplayedOnListBox.Name = "menuDisplayedOnListBox"; this.menuDisplayedOnListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple; - this.menuDisplayedOnListBox.Size = new System.Drawing.Size(401, 256); + this.menuDisplayedOnListBox.Size = new System.Drawing.Size(401, 234); this.menuDisplayedOnListBox.Sorted = true; this.menuDisplayedOnListBox.TabIndex = 0; // @@ -380,7 +380,7 @@ this.itemsSaveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.itemsSaveButton.FontSize = MetroFramework.MetroButtonSize.Tall; this.itemsSaveButton.FontWeight = MetroFramework.MetroButtonWeight.Regular; - this.itemsSaveButton.Location = new System.Drawing.Point(1038, 713); + this.itemsSaveButton.Location = new System.Drawing.Point(1038, 715); this.itemsSaveButton.Name = "itemsSaveButton"; this.itemsSaveButton.Size = new System.Drawing.Size(298, 45); this.itemsSaveButton.TabIndex = 11; @@ -395,7 +395,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.menuItemListBox.Font = new System.Drawing.Font("Segoe UI Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.menuItemListBox.FormattingEnabled = true; - this.menuItemListBox.ItemHeight = 38; + this.menuItemListBox.ItemHeight = 31; this.menuItemListBox.Items.AddRange(new object[] { "Item1", "Item1", @@ -417,7 +417,7 @@ "Item3"}); this.menuItemListBox.Location = new System.Drawing.Point(7, 69); this.menuItemListBox.Name = "menuItemListBox"; - this.menuItemListBox.Size = new System.Drawing.Size(696, 650); + this.menuItemListBox.Size = new System.Drawing.Size(696, 624); this.menuItemListBox.TabIndex = 8; this.menuItemListBox.SelectedIndexChanged += new System.EventHandler(this.menuItemListBox_SelectedIndexChanged); // @@ -426,7 +426,7 @@ this.itemsRevertButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.itemsRevertButton.FontSize = MetroFramework.MetroButtonSize.Tall; this.itemsRevertButton.FontWeight = MetroFramework.MetroButtonWeight.Regular; - this.itemsRevertButton.Location = new System.Drawing.Point(741, 714); + this.itemsRevertButton.Location = new System.Drawing.Point(741, 716); this.itemsRevertButton.Name = "itemsRevertButton"; this.itemsRevertButton.Size = new System.Drawing.Size(291, 45); this.itemsRevertButton.TabIndex = 10; @@ -453,7 +453,7 @@ this.groupBox2.Location = new System.Drawing.Point(741, 237); this.groupBox2.Name = "groupBox2"; this.groupBox2.Padding = new System.Windows.Forms.Padding(8); - this.groupBox2.Size = new System.Drawing.Size(595, 471); + this.groupBox2.Size = new System.Drawing.Size(595, 473); this.groupBox2.TabIndex = 12; this.groupBox2.TabStop = false; this.groupBox2.Text = "Options"; @@ -509,7 +509,7 @@ this.itemPrice.DecimalPlaces = 2; this.itemPrice.Location = new System.Drawing.Point(166, 187); this.itemPrice.Name = "itemPrice"; - this.itemPrice.Size = new System.Drawing.Size(125, 34); + this.itemPrice.Size = new System.Drawing.Size(125, 30); this.itemPrice.TabIndex = 9; // // itemDescriptionTextbox @@ -569,13 +569,13 @@ this.itemPrintingListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.itemPrintingListBox.FormattingEnabled = true; - this.itemPrintingListBox.ItemHeight = 28; + this.itemPrintingListBox.ItemHeight = 23; this.itemPrintingListBox.Items.AddRange(new object[] { "Cold", "Hot"}); this.itemPrintingListBox.Location = new System.Drawing.Point(166, 399); this.itemPrintingListBox.Name = "itemPrintingListBox"; - this.itemPrintingListBox.Size = new System.Drawing.Size(418, 60); + this.itemPrintingListBox.Size = new System.Drawing.Size(418, 50); this.itemPrintingListBox.Sorted = true; this.itemPrintingListBox.TabIndex = 3; // @@ -600,7 +600,7 @@ this.itemCategoryListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.itemCategoryListBox.FormattingEnabled = true; - this.itemCategoryListBox.ItemHeight = 28; + this.itemCategoryListBox.ItemHeight = 23; this.itemCategoryListBox.Items.AddRange(new object[] { "Appitizer", "Entre", @@ -609,7 +609,7 @@ "Other"}); this.itemCategoryListBox.Location = new System.Drawing.Point(166, 236); this.itemCategoryListBox.Name = "itemCategoryListBox"; - this.itemCategoryListBox.Size = new System.Drawing.Size(418, 144); + this.itemCategoryListBox.Size = new System.Drawing.Size(418, 142); this.itemCategoryListBox.TabIndex = 0; // // groupBox3 @@ -678,9 +678,9 @@ this.employeeTab.HorizontalScrollbarBarColor = true; this.employeeTab.HorizontalScrollbarHighlightOnWheel = false; this.employeeTab.HorizontalScrollbarSize = 10; - this.employeeTab.Location = new System.Drawing.Point(4, 38); + this.employeeTab.Location = new System.Drawing.Point(4, 39); this.employeeTab.Name = "employeeTab"; - this.employeeTab.Size = new System.Drawing.Size(1360, 790); + this.employeeTab.Size = new System.Drawing.Size(1360, 789); this.employeeTab.TabIndex = 2; this.employeeTab.Text = "Edit Employees"; this.employeeTab.VerticalScrollbarBarColor = true; @@ -720,7 +720,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.employeeListBox.Font = new System.Drawing.Font("Segoe UI Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.employeeListBox.FormattingEnabled = true; - this.employeeListBox.ItemHeight = 38; + this.employeeListBox.ItemHeight = 31; this.employeeListBox.Items.AddRange(new object[] { "Item1", "Item1", @@ -742,7 +742,7 @@ "Item3"}); this.employeeListBox.Location = new System.Drawing.Point(7, 69); this.employeeListBox.Name = "employeeListBox"; - this.employeeListBox.Size = new System.Drawing.Size(696, 650); + this.employeeListBox.Size = new System.Drawing.Size(696, 624); this.employeeListBox.TabIndex = 16; this.employeeListBox.SelectedIndexChanged += new System.EventHandler(this.employeeListBox_SelectedIndexChanged); // @@ -867,7 +867,7 @@ 0, 0}); this.employeePinNumber.Name = "employeePinNumber"; - this.employeePinNumber.Size = new System.Drawing.Size(125, 34); + this.employeePinNumber.Size = new System.Drawing.Size(125, 30); this.employeePinNumber.TabIndex = 13; // // pin @@ -892,7 +892,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.employeeRoleListBox.FormattingEnabled = true; - this.employeeRoleListBox.ItemHeight = 28; + this.employeeRoleListBox.ItemHeight = 23; this.employeeRoleListBox.Items.AddRange(new object[] { "Admin", "Chef", @@ -901,7 +901,7 @@ this.employeeRoleListBox.Location = new System.Drawing.Point(166, 189); this.employeeRoleListBox.Name = "employeeRoleListBox"; this.employeeRoleListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple; - this.employeeRoleListBox.Size = new System.Drawing.Size(418, 116); + this.employeeRoleListBox.Size = new System.Drawing.Size(418, 96); this.employeeRoleListBox.TabIndex = 0; // // groupBox7 @@ -970,9 +970,9 @@ this.stationTab.HorizontalScrollbarBarColor = true; this.stationTab.HorizontalScrollbarHighlightOnWheel = false; this.stationTab.HorizontalScrollbarSize = 10; - this.stationTab.Location = new System.Drawing.Point(4, 38); + this.stationTab.Location = new System.Drawing.Point(4, 39); this.stationTab.Name = "stationTab"; - this.stationTab.Size = new System.Drawing.Size(1360, 790); + this.stationTab.Size = new System.Drawing.Size(1360, 789); this.stationTab.TabIndex = 3; this.stationTab.Text = "Edit Stations"; this.stationTab.VerticalScrollbarBarColor = true; @@ -1012,7 +1012,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.stationListBox.Font = new System.Drawing.Font("Segoe UI Light", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.stationListBox.FormattingEnabled = true; - this.stationListBox.ItemHeight = 38; + this.stationListBox.ItemHeight = 31; this.stationListBox.Items.AddRange(new object[] { "Item1", "Item1", @@ -1034,7 +1034,7 @@ "Item3"}); this.stationListBox.Location = new System.Drawing.Point(7, 69); this.stationListBox.Name = "stationListBox"; - this.stationListBox.Size = new System.Drawing.Size(696, 650); + this.stationListBox.Size = new System.Drawing.Size(696, 624); this.stationListBox.TabIndex = 10; this.stationListBox.SelectedIndexChanged += new System.EventHandler(this.stationListBox_SelectedIndexChanged); // @@ -1068,7 +1068,7 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.stationTypeListBox.FormattingEnabled = true; - this.stationTypeListBox.ItemHeight = 28; + this.stationTypeListBox.ItemHeight = 23; this.stationTypeListBox.Items.AddRange(new object[] { "Chef Station", "Waiter Station", @@ -1076,7 +1076,7 @@ "Admin Station"}); this.stationTypeListBox.Location = new System.Drawing.Point(183, 35); this.stationTypeListBox.Name = "stationTypeListBox"; - this.stationTypeListBox.Size = new System.Drawing.Size(401, 340); + this.stationTypeListBox.Size = new System.Drawing.Size(401, 326); this.stationTypeListBox.TabIndex = 0; // // groupBox5 diff --git a/Enigma/StationsGUI/ChefStationView.Designer.cs b/Enigma/StationsGUI/ChefStationView.Designer.cs new file mode 100644 index 0000000..4a75f43 --- /dev/null +++ b/Enigma/StationsGUI/ChefStationView.Designer.cs @@ -0,0 +1,95 @@ +namespace Enigma.StationsGUI +{ + partial class ChefStationView + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.orderListBox = new System.Windows.Forms.ListBox(); + this.checkOffOrderButton = new MetroFramework.Controls.MetroButton(); + this.queryTimer = new System.Windows.Forms.Timer(this.components); + this.SuspendLayout(); + // + // orderListBox + // + this.orderListBox.Font = new System.Drawing.Font("Segoe UI Light", 14F); + this.orderListBox.FormattingEnabled = true; + this.orderListBox.ItemHeight = 31; + this.orderListBox.Items.AddRange(new object[] { + "Order1", + "Order2", + "Order3", + "Order4", + "Order5", + "Order6", + "Order7", + "Order8", + "Order9", + "Order10"}); + this.orderListBox.Location = new System.Drawing.Point(31, 43); + this.orderListBox.Name = "orderListBox"; + this.orderListBox.Size = new System.Drawing.Size(665, 717); + this.orderListBox.TabIndex = 0; + // + // checkOffOrderButton + // + this.checkOffOrderButton.Location = new System.Drawing.Point(821, 65); + this.checkOffOrderButton.Name = "checkOffOrderButton"; + this.checkOffOrderButton.Size = new System.Drawing.Size(161, 144); + this.checkOffOrderButton.TabIndex = 2; + this.checkOffOrderButton.Text = "Check off order"; + this.checkOffOrderButton.UseSelectable = true; + this.checkOffOrderButton.Click += new System.EventHandler(this.checkOffOrderButton_Click); + // + // queryTimer + // + this.queryTimer.Interval = 5000; + this.queryTimer.Tick += new System.EventHandler(this.queryTimer_Tick); + // + // ChefStationView + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1134, 812); + this.Controls.Add(this.checkOffOrderButton); + this.Controls.Add(this.orderListBox); + this.DisplayHeader = false; + this.Name = "ChefStationView"; + this.Padding = new System.Windows.Forms.Padding(18, 30, 18, 16); + this.Style = MetroFramework.MetroColorStyle.Orange; + this.Text = "ChefStationView"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ListBox orderListBox; + private MetroFramework.Controls.MetroButton checkOffOrderButton; + private System.Windows.Forms.Timer queryTimer; + } +} \ No newline at end of file diff --git a/Enigma/StationsGUI/ChefStationView.cs b/Enigma/StationsGUI/ChefStationView.cs new file mode 100644 index 0000000..cd264d7 --- /dev/null +++ b/Enigma/StationsGUI/ChefStationView.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using MetroFramework.Forms; +using MetroFramework; +using EnigmaX; +using System.Data.SqlClient; +using MySql.Data.MySqlClient; +using Enigma.Popups; +using EnigmaX.Classes; + +namespace Enigma.StationsGUI +{ + public partial class ChefStationView : MetroForm + { + DBConnect db = new DBConnect(); + List orders = new List(); + + public ChefStationView() + { + InitializeComponent(); + } + + private void ChefStationView_Load(object sender, EventArgs e) + { + loadOrders(); + drawOrders(); + } + + private void loadOrders() + { + orders.Clear(); + db = new DBConnect(); + List> result = db.ReadCommand("SELECT * FROM Seating", "tableNumber", "tableOrder"); + foreach (Dictionary row in result) + { + Order order = new Order(Int32.Parse(row["tableNumber"]), row["tableOrder"]); + orders.Add(order); + } + } + + private void drawOrders() + { + orderListBox.Items.Clear(); + foreach (Order order in orders) + { + orderListBox.Items.Add(order); + } + } + + private void checkOffOrderButton_Click(object sender, EventArgs e) + { + + } + + private void queryTimer_Tick(object sender, EventArgs e) + { + try + { + for (int i = 0; i < orders.Count(); i++)//interate through all objects in the waitlist + { + db.getConnection().Open(); //open a channel + //update the initialWaitTime in the sql table + MySqlCommand cmd = new MySqlCommand("UPDATE Seating SET tableOrder = @tableOrder WHERE tableNumber = @tableNumber", db.getConnection()); + //parametrize the variables + cmd.Parameters.AddWithValue("@tableOrder", orders[i].getOrder()); + cmd.Parameters.AddWithValue("@tableNumber", orders[i].getTableNumber()); + cmd.ExecuteNonQuery(); //execute the update + db.getConnection().Close(); //close the channel + orderListBox.Refresh(); //check if works + + } + } + catch + { + + } + orderListBox.Refresh(); //check if works + } + } +} diff --git a/Enigma/StationsGUI/ChefStationView.resx b/Enigma/StationsGUI/ChefStationView.resx new file mode 100644 index 0000000..76987e9 --- /dev/null +++ b/Enigma/StationsGUI/ChefStationView.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/EnigmaX/Classes/Order.cs b/EnigmaX/Classes/Order.cs new file mode 100644 index 0000000..3f4536b --- /dev/null +++ b/EnigmaX/Classes/Order.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EnigmaX.Classes +{ + public class Order + { + private int _tableNumber; + private string _order; + + public Order(int tableNumber, string order) + { + _tableNumber = tableNumber; + _order = order; + } + + public int getTableNumber() + { + return _tableNumber; + } + + public string getOrder() + { + return _order; + } + } +} diff --git a/EnigmaX/EnigmaX.csproj b/EnigmaX/EnigmaX.csproj index 99db8d0..88a24ff 100644 --- a/EnigmaX/EnigmaX.csproj +++ b/EnigmaX/EnigmaX.csproj @@ -64,6 +64,7 @@ +