diff --git a/Enigma/Enigma.csproj b/Enigma/Enigma.csproj index 458d4d1..06de531 100644 --- a/Enigma/Enigma.csproj +++ b/Enigma/Enigma.csproj @@ -68,6 +68,18 @@ AddPopup.cs + + Form + + + checkoutTablePopup.cs + + + Form + + + chequePrintPopup.cs + Form @@ -128,6 +140,12 @@ + + checkoutTablePopup.cs + + + chequePrintPopup.cs + AddPopup.cs @@ -191,6 +209,9 @@ + + + diff --git a/Enigma/EnigmaMain.Designer.cs b/Enigma/EnigmaMain.Designer.cs index 60c5535..54d7630 100644 --- a/Enigma/EnigmaMain.Designer.cs +++ b/Enigma/EnigmaMain.Designer.cs @@ -38,9 +38,10 @@ private void InitializeComponent() // // hostButton // - this.hostButton.Location = new System.Drawing.Point(32, 93); + this.hostButton.Location = new System.Drawing.Point(28, 74); + this.hostButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.hostButton.Name = "hostButton"; - this.hostButton.Size = new System.Drawing.Size(165, 99); + this.hostButton.Size = new System.Drawing.Size(147, 79); this.hostButton.TabIndex = 0; this.hostButton.Text = "Start Host Station"; this.hostButton.UseSelectable = true; @@ -48,27 +49,31 @@ private void InitializeComponent() // // waiterbutton // - this.waiterbutton.Location = new System.Drawing.Point(203, 93); + this.waiterbutton.Location = new System.Drawing.Point(180, 74); + this.waiterbutton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.waiterbutton.Name = "waiterbutton"; - this.waiterbutton.Size = new System.Drawing.Size(165, 99); + this.waiterbutton.Size = new System.Drawing.Size(147, 79); this.waiterbutton.TabIndex = 1; this.waiterbutton.Text = "Start Waiter Station"; this.waiterbutton.UseSelectable = true; + this.waiterbutton.Click += new System.EventHandler(this.waiterbutton_Click); // // chefButton // - this.chefButton.Location = new System.Drawing.Point(374, 93); + this.chefButton.Location = new System.Drawing.Point(332, 74); + this.chefButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.chefButton.Name = "chefButton"; - this.chefButton.Size = new System.Drawing.Size(165, 99); + this.chefButton.Size = new System.Drawing.Size(147, 79); this.chefButton.TabIndex = 2; this.chefButton.Text = "Start Chef Station"; this.chefButton.UseSelectable = true; // // adminButton // - this.adminButton.Location = new System.Drawing.Point(545, 93); + this.adminButton.Location = new System.Drawing.Point(484, 74); + this.adminButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.adminButton.Name = "adminButton"; - this.adminButton.Size = new System.Drawing.Size(165, 99); + this.adminButton.Size = new System.Drawing.Size(147, 79); this.adminButton.TabIndex = 3; this.adminButton.Text = "Start Admin Station"; this.adminButton.UseSelectable = true; @@ -76,9 +81,10 @@ private void InitializeComponent() // // debugButton // - this.debugButton.Location = new System.Drawing.Point(32, 198); + this.debugButton.Location = new System.Drawing.Point(28, 158); + this.debugButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.debugButton.Name = "debugButton"; - this.debugButton.Size = new System.Drawing.Size(165, 45); + this.debugButton.Size = new System.Drawing.Size(147, 36); this.debugButton.TabIndex = 4; this.debugButton.Text = "Start Debug Station"; this.debugButton.UseSelectable = true; @@ -86,9 +92,10 @@ private void InitializeComponent() // // metroButton1 // - this.metroButton1.Location = new System.Drawing.Point(203, 198); + this.metroButton1.Location = new System.Drawing.Point(180, 158); + this.metroButton1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.metroButton1.Name = "metroButton1"; - this.metroButton1.Size = new System.Drawing.Size(165, 45); + this.metroButton1.Size = new System.Drawing.Size(147, 36); this.metroButton1.TabIndex = 5; this.metroButton1.Text = "Start Pin Station"; this.metroButton1.UseSelectable = true; @@ -96,16 +103,18 @@ private void InitializeComponent() // // EnigmaMain // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(740, 286); + this.ClientSize = new System.Drawing.Size(658, 229); this.Controls.Add(this.metroButton1); this.Controls.Add(this.debugButton); this.Controls.Add(this.adminButton); this.Controls.Add(this.chefButton); this.Controls.Add(this.waiterbutton); this.Controls.Add(this.hostButton); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "EnigmaMain"; + this.Padding = new System.Windows.Forms.Padding(18, 48, 18, 16); this.Text = "Enigma Main Control Panel"; this.Load += new System.EventHandler(this.EnigmaMain_Load); this.ResumeLayout(false); diff --git a/Enigma/EnigmaMain.cs b/Enigma/EnigmaMain.cs index d8b2d47..f54c0b2 100644 --- a/Enigma/EnigmaMain.cs +++ b/Enigma/EnigmaMain.cs @@ -54,6 +54,7 @@ private void hostButton_Click(object sender, EventArgs e) station.showView(); } + private void debugButton_Click(object sender, EventArgs e) { DebugStation station = new DebugStation(EnigmaX.Classes.StationTypeDef.host, "debug"); @@ -73,5 +74,12 @@ private void adminButton_Click(object sender, EventArgs e) loadedStations.Add(station); station.showView(); } + + private void waiterbutton_Click(object sender, EventArgs e) + { + WaiterStation station = new WaiterStation("debugwaiter"); + loadedStations.Add(station); + station.showView(); + } } } diff --git a/Enigma/Popups/TableAssign.Designer.cs b/Enigma/Popups/TableAssign.Designer.cs index 985186b..f599b87 100644 --- a/Enigma/Popups/TableAssign.Designer.cs +++ b/Enigma/Popups/TableAssign.Designer.cs @@ -145,6 +145,7 @@ private void InitializeComponent() this.DisplayHeader = false; this.Name = "TableAssign"; this.Padding = new System.Windows.Forms.Padding(20, 30, 20, 20); + this.Style = MetroFramework.MetroColorStyle.Green; this.Text = "TableAssign"; this.Load += new System.EventHandler(this.TableAssign_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); diff --git a/Enigma/Popups/checkoutTablePopup.Designer.cs b/Enigma/Popups/checkoutTablePopup.Designer.cs new file mode 100644 index 0000000..feb013d --- /dev/null +++ b/Enigma/Popups/checkoutTablePopup.Designer.cs @@ -0,0 +1,90 @@ +namespace Enigma.Popups +{ + partial class checkoutTablePopup + { + /// + /// 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.metroLabel1 = new MetroFramework.Controls.MetroLabel(); + this.cancel = new MetroFramework.Controls.MetroButton(); + this.confirm = new MetroFramework.Controls.MetroButton(); + this.SuspendLayout(); + // + // metroLabel1 + // + this.metroLabel1.AutoSize = true; + this.metroLabel1.FontSize = MetroFramework.MetroLabelSize.Tall; + this.metroLabel1.Location = new System.Drawing.Point(9, 71); + this.metroLabel1.Name = "metroLabel1"; + this.metroLabel1.Size = new System.Drawing.Size(250, 25); + this.metroLabel1.TabIndex = 0; + this.metroLabel1.Text = "CREDIT OR CASH CHECKOUT"; + // + // cancel + // + this.cancel.Location = new System.Drawing.Point(9, 164); + this.cancel.Name = "cancel"; + this.cancel.Size = new System.Drawing.Size(125, 74); + this.cancel.TabIndex = 1; + this.cancel.Text = "Cancel"; + this.cancel.UseSelectable = true; + // + // confirm + // + this.confirm.Location = new System.Drawing.Point(150, 164); + this.confirm.Name = "confirm"; + this.confirm.Size = new System.Drawing.Size(125, 74); + this.confirm.TabIndex = 2; + this.confirm.Text = "Ok"; + this.confirm.UseSelectable = true; + this.confirm.Click += new System.EventHandler(this.confirm_Click); + // + // checkoutTablePopup + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(282, 253); + this.Controls.Add(this.confirm); + this.Controls.Add(this.cancel); + this.Controls.Add(this.metroLabel1); + this.DisplayHeader = false; + this.Name = "checkoutTablePopup"; + this.Padding = new System.Windows.Forms.Padding(20, 30, 20, 20); + this.Style = MetroFramework.MetroColorStyle.Red; + this.Text = "checkoutTablePopup"; + this.Load += new System.EventHandler(this.checkoutTablePopup_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private MetroFramework.Controls.MetroLabel metroLabel1; + private MetroFramework.Controls.MetroButton cancel; + private MetroFramework.Controls.MetroButton confirm; + } +} \ No newline at end of file diff --git a/Enigma/Popups/checkoutTablePopup.cs b/Enigma/Popups/checkoutTablePopup.cs new file mode 100644 index 0000000..a0a3ead --- /dev/null +++ b/Enigma/Popups/checkoutTablePopup.cs @@ -0,0 +1,50 @@ +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 EnigmaX; +using EnigmaX.Classes; +using Enigma.StationsGUI; +using MySql.Data.MySqlClient; + +namespace Enigma.Popups +{ + public partial class checkoutTablePopup : MetroForm + { + WaiterStationView wsv = new WaiterStationView(); + public checkoutTablePopup(WaiterStationView waiterStation) + { + InitializeComponent(); + wsv = waiterStation; + } + + private void checkoutTablePopup_Load(object sender, EventArgs e) + { + + } + + private void confirm_Click(object sender, EventArgs e) + { + DBConnect db = new DBConnect(); + db.getConnection().Open(); + MySqlCommand cmd = new MySqlCommand("UPDATE Seating SET status = @status WHERE tableNumber = @tableNumber", db.getConnection()); + //parametrize the variables + cmd.Parameters.AddWithValue("@status", 1); + cmd.Parameters.AddWithValue("@tableNumber", wsv._tableNumber); + cmd.ExecuteNonQuery(); + + cmd = new MySqlCommand("UPDATE Seating SET tableOrder = @tableOrder WHERE tableNumber = @tableNumber", db.getConnection()); + cmd.Parameters.AddWithValue("@tableOrder", null); + cmd.Parameters.AddWithValue("@tableNumber", wsv._tableNumber); + cmd.ExecuteNonQuery(); + + db.getConnection().Close(); + } + } +} diff --git a/Enigma/Popups/checkoutTablePopup.resx b/Enigma/Popups/checkoutTablePopup.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Enigma/Popups/checkoutTablePopup.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/Enigma/Popups/chequePrintPopup.Designer.cs b/Enigma/Popups/chequePrintPopup.Designer.cs new file mode 100644 index 0000000..46b4ae5 --- /dev/null +++ b/Enigma/Popups/chequePrintPopup.Designer.cs @@ -0,0 +1,151 @@ +namespace Enigma.Popups +{ + partial class chequePrintPopup + { + /// + /// 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.cancel = new MetroFramework.Controls.MetroButton(); + this.printConfirm = new MetroFramework.Controls.MetroButton(); + this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); + this.metroLabel2 = new MetroFramework.Controls.MetroLabel(); + this.ticketItems = new System.Windows.Forms.ListBox(); + this.metroLabel3 = new MetroFramework.Controls.MetroLabel(); + this.ticketTotalCost = new MetroFramework.Controls.MetroLabel(); + this.ticketTax = new MetroFramework.Controls.MetroLabel(); + this.SuspendLayout(); + // + // cancel + // + this.cancel.Location = new System.Drawing.Point(280, 317); + this.cancel.Name = "cancel"; + this.cancel.Size = new System.Drawing.Size(86, 26); + this.cancel.TabIndex = 0; + this.cancel.Text = "Cancel"; + this.cancel.UseSelectable = true; + this.cancel.Click += new System.EventHandler(this.cancel_Click); + // + // printConfirm + // + this.printConfirm.Location = new System.Drawing.Point(372, 317); + this.printConfirm.Name = "printConfirm"; + this.printConfirm.Size = new System.Drawing.Size(86, 26); + this.printConfirm.TabIndex = 1; + this.printConfirm.Text = "Print"; + this.printConfirm.UseSelectable = true; + this.printConfirm.Click += new System.EventHandler(this.printConfirm_Click); + // + // metroLabel1 + // + this.metroLabel1.AutoSize = true; + this.metroLabel1.Location = new System.Drawing.Point(11, 280); + this.metroLabel1.Name = "metroLabel1"; + this.metroLabel1.Size = new System.Drawing.Size(71, 20); + this.metroLabel1.TabIndex = 3; + this.metroLabel1.Text = "Total Cost:"; + // + // metroLabel2 + // + this.metroLabel2.AutoSize = true; + this.metroLabel2.Location = new System.Drawing.Point(11, 251); + this.metroLabel2.Name = "metroLabel2"; + this.metroLabel2.Size = new System.Drawing.Size(31, 20); + this.metroLabel2.TabIndex = 4; + this.metroLabel2.Text = "Tax:"; + // + // ticketItems + // + this.ticketItems.Font = new System.Drawing.Font("Segoe UI Light", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.ticketItems.FormattingEnabled = true; + this.ticketItems.ItemHeight = 31; + this.ticketItems.Location = new System.Drawing.Point(11, 15); + this.ticketItems.Name = "ticketItems"; + this.ticketItems.Size = new System.Drawing.Size(328, 221); + this.ticketItems.TabIndex = 5; + // + // metroLabel3 + // + this.metroLabel3.AutoSize = true; + this.metroLabel3.Location = new System.Drawing.Point(251, 263); + this.metroLabel3.Name = "metroLabel3"; + this.metroLabel3.Size = new System.Drawing.Size(87, 20); + this.metroLabel3.TabIndex = 6; + this.metroLabel3.Text = "metroLabel3"; + // + // ticketTotalCost + // + this.ticketTotalCost.AutoSize = true; + this.ticketTotalCost.Location = new System.Drawing.Point(89, 280); + this.ticketTotalCost.Name = "ticketTotalCost"; + this.ticketTotalCost.Size = new System.Drawing.Size(87, 20); + this.ticketTotalCost.TabIndex = 7; + this.ticketTotalCost.Text = "metroLabel4"; + // + // ticketTax + // + this.ticketTax.AutoSize = true; + this.ticketTax.Location = new System.Drawing.Point(89, 250); + this.ticketTax.Name = "ticketTax"; + this.ticketTax.Size = new System.Drawing.Size(87, 20); + this.ticketTax.TabIndex = 8; + this.ticketTax.Text = "metroLabel4"; + // + // chequePrintPopup + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(468, 352); + this.Controls.Add(this.ticketTax); + this.Controls.Add(this.ticketTotalCost); + this.Controls.Add(this.metroLabel3); + this.Controls.Add(this.ticketItems); + this.Controls.Add(this.metroLabel2); + this.Controls.Add(this.metroLabel1); + this.Controls.Add(this.printConfirm); + this.Controls.Add(this.cancel); + this.DisplayHeader = false; + this.Name = "chequePrintPopup"; + this.Padding = new System.Windows.Forms.Padding(20, 30, 20, 20); + this.Style = MetroFramework.MetroColorStyle.Red; + this.Text = "chequePrintPopup"; + this.Load += new System.EventHandler(this.chequePrintCheck_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private MetroFramework.Controls.MetroButton cancel; + private MetroFramework.Controls.MetroButton printConfirm; + private MetroFramework.Controls.MetroLabel metroLabel1; + private MetroFramework.Controls.MetroLabel metroLabel2; + private System.Windows.Forms.ListBox ticketItems; + private MetroFramework.Controls.MetroLabel metroLabel3; + private MetroFramework.Controls.MetroLabel ticketTotalCost; + private MetroFramework.Controls.MetroLabel ticketTax; + } +} \ No newline at end of file diff --git a/Enigma/Popups/chequePrintPopup.cs b/Enigma/Popups/chequePrintPopup.cs new file mode 100644 index 0000000..9be4633 --- /dev/null +++ b/Enigma/Popups/chequePrintPopup.cs @@ -0,0 +1,107 @@ +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 EnigmaX; +using EnigmaX.Classes; +using Enigma.StationsGUI; +using MySql.Data.MySqlClient; +using MetroFramework; + +namespace Enigma.Popups +{ + public partial class chequePrintPopup : MetroForm + { + WaiterStationView wsv = new WaiterStationView(); + List tableOrderList = new List(); + DBConnect db = new DBConnect(); + public chequePrintPopup(WaiterStationView waiterStation) + { + InitializeComponent(); + wsv = waiterStation; + importTableOrder(); + drawOrderedItems(); + + } + + private void chequePrintCheck_Load(object sender, EventArgs e) + { + + } + + private void importTableOrder() + { + //db.getConnection().Open(); + /* MySqlCommand cmd = new MySqlCommand("SELECT tableOrder FROM Seating WHERE tableNumber = @tableNumber", db.getConnection()); + cmd.Parameters.AddWithValue("@tableNumber", wsv._tableNumber); + cmd.ExecuteNonQuery(); + db.getConnection().Close();*/ + MySqlCommand cmd = new MySqlCommand("SELECT * FROM Seating WHERE tableNumber = @tableNumber", db.getConnection()); + cmd.Parameters.AddWithValue("@tableNumber", wsv._tableNumber); + List> result = db.ReadCommand(cmd, "tableOrder"); + if (result.Count > 0) + { + string tableOrder = result[0]["tableOrder"]; + metroLabel3.Text = tableOrder; + //EnigmaMenu menu = new EnigmaMenu(1, "tableOrder", EnigmaMenu.stringToItemList(tableOrder)); + tableOrderList = EnigmaMenu.stringToItemList(tableOrder); + //tableOrderList = menu.Items; + } + else + { + + } + + } + + private void drawOrderedItems() + { + ticketItems.Items.Clear(); + foreach (EnigmaMenuItem item in tableOrderList) + { + ticketItems.Items.Add(item); + } + costCalculator(); //cost info updated + } + + private void costCalculator() + { + float preTaxTotal = 0; + float tax = 0; + float postTaxTotal = 0; + foreach(EnigmaMenuItem item in tableOrderList) + { + preTaxTotal += item.Price; + } + tax = preTaxTotal * (float)0.0635; + postTaxTotal = preTaxTotal + tax; + + ticketTax.Text = String.Format("{0:0.00}", tax); + ticketTotalCost.Text= String.Format("{0:0.00}", postTaxTotal); + } + + private void cancel_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void printConfirm_Click(object sender, EventArgs e) + { + DBConnect db = new DBConnect(); + db.getConnection().Open(); + MySqlCommand cmd = new MySqlCommand("UPDATE Seating SET status = @status WHERE tableNumber = @tableNumber", db.getConnection()); + //parametrize the variables + cmd.Parameters.AddWithValue("@status", 5); + cmd.Parameters.AddWithValue("@tableNumber", wsv._tableNumber); + cmd.ExecuteNonQuery(); + db.getConnection().Close(); + this.Close(); + } + } +} diff --git a/Enigma/Popups/chequePrintPopup.resx b/Enigma/Popups/chequePrintPopup.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Enigma/Popups/chequePrintPopup.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/Enigma/Popups/resAdd.Designer.cs b/Enigma/Popups/resAdd.Designer.cs index dbac701..350e1ca 100644 --- a/Enigma/Popups/resAdd.Designer.cs +++ b/Enigma/Popups/resAdd.Designer.cs @@ -158,6 +158,7 @@ private void InitializeComponent() this.DisplayHeader = false; this.Name = "resAdd"; this.Padding = new System.Windows.Forms.Padding(20, 30, 20, 20); + this.Style = MetroFramework.MetroColorStyle.Green; this.Text = "resAdd"; this.Load += new System.EventHandler(this.resAdd_Load); ((System.ComponentModel.ISupportInitialize)(this.sizeInput)).EndInit(); diff --git a/Enigma/Popups/tableOrder.Designer.cs b/Enigma/Popups/tableOrder.Designer.cs index 3964d31..698e303 100644 --- a/Enigma/Popups/tableOrder.Designer.cs +++ b/Enigma/Popups/tableOrder.Designer.cs @@ -28,53 +28,41 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { - this.metroComboBox1 = new MetroFramework.Controls.MetroComboBox(); - this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.dataGridView2 = new System.Windows.Forms.DataGridView(); + this.itemType = new MetroFramework.Controls.MetroComboBox(); this.Menu = new MetroFramework.Controls.MetroLabel(); this.order = new MetroFramework.Controls.MetroLabel(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit(); + this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); + this.addItem = new MetroFramework.Controls.MetroButton(); + this.removeItem = new MetroFramework.Controls.MetroButton(); + this.menuItems = new System.Windows.Forms.ListBox(); + this.orderItems = new System.Windows.Forms.ListBox(); + this.metroLabel2 = new MetroFramework.Controls.MetroLabel(); + this.submit = new MetroFramework.Controls.MetroButton(); + this.metroButton1 = new MetroFramework.Controls.MetroButton(); + this.tableNumberLabel = new MetroFramework.Controls.MetroLabel(); this.SuspendLayout(); // - // metroComboBox1 - // - this.metroComboBox1.FormattingEnabled = true; - this.metroComboBox1.ItemHeight = 24; - this.metroComboBox1.Location = new System.Drawing.Point(34, 108); - this.metroComboBox1.Name = "metroComboBox1"; - this.metroComboBox1.Size = new System.Drawing.Size(121, 30); - this.metroComboBox1.TabIndex = 0; - this.metroComboBox1.UseSelectable = true; - // - // dataGridView1 - // - this.dataGridView1.AllowUserToAddRows = false; - this.dataGridView1.AllowUserToDeleteRows = false; - this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView1.Location = new System.Drawing.Point(34, 166); - this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.ReadOnly = true; - this.dataGridView1.RowTemplate.Height = 24; - this.dataGridView1.Size = new System.Drawing.Size(531, 605); - this.dataGridView1.TabIndex = 1; - // - // dataGridView2 - // - this.dataGridView2.AllowUserToAddRows = false; - this.dataGridView2.AllowUserToDeleteRows = false; - this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView2.Location = new System.Drawing.Point(769, 166); - this.dataGridView2.Name = "dataGridView2"; - this.dataGridView2.ReadOnly = true; - this.dataGridView2.RowTemplate.Height = 24; - this.dataGridView2.Size = new System.Drawing.Size(531, 605); - this.dataGridView2.TabIndex = 2; + // itemType + // + this.itemType.FormattingEnabled = true; + this.itemType.ItemHeight = 24; + this.itemType.Items.AddRange(new object[] { + "appetizer", + "entree", + "desert", + "drink", + "other"}); + this.itemType.Location = new System.Drawing.Point(159, 108); + this.itemType.Name = "itemType"; + this.itemType.Size = new System.Drawing.Size(121, 30); + this.itemType.TabIndex = 0; + this.itemType.UseSelectable = true; + this.itemType.SelectedIndexChanged += new System.EventHandler(this.itemType_SelectedIndexChanged); // // Menu // this.Menu.AutoSize = true; - this.Menu.Location = new System.Drawing.Point(34, 71); + this.Menu.Location = new System.Drawing.Point(44, 78); this.Menu.Name = "Menu"; this.Menu.Size = new System.Drawing.Size(45, 20); this.Menu.TabIndex = 3; @@ -83,28 +71,123 @@ private void InitializeComponent() // order // this.order.AutoSize = true; - this.order.Location = new System.Drawing.Point(769, 108); + this.order.Location = new System.Drawing.Point(769, 78); this.order.Name = "order"; this.order.Size = new System.Drawing.Size(46, 20); this.order.TabIndex = 4; this.order.Text = "Order"; // + // metroLabel1 + // + this.metroLabel1.AutoSize = true; + this.metroLabel1.Location = new System.Drawing.Point(44, 118); + this.metroLabel1.Name = "metroLabel1"; + this.metroLabel1.Size = new System.Drawing.Size(77, 20); + this.metroLabel1.TabIndex = 6; + this.metroLabel1.Text = "Food Type:"; + // + // addItem + // + this.addItem.Location = new System.Drawing.Point(579, 242); + this.addItem.Name = "addItem"; + this.addItem.Size = new System.Drawing.Size(155, 59); + this.addItem.TabIndex = 8; + this.addItem.Text = "Add -->"; + this.addItem.UseSelectable = true; + this.addItem.Click += new System.EventHandler(this.addItem_Click); + // + // removeItem + // + this.removeItem.Location = new System.Drawing.Point(579, 334); + this.removeItem.Name = "removeItem"; + this.removeItem.Size = new System.Drawing.Size(155, 59); + this.removeItem.TabIndex = 9; + this.removeItem.Text = "<-- Remove"; + this.removeItem.UseSelectable = true; + this.removeItem.Click += new System.EventHandler(this.removeItem_Click); + // + // menuItems + // + this.menuItems.Font = new System.Drawing.Font("Segoe UI Light", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.menuItems.FormattingEnabled = true; + this.menuItems.ItemHeight = 31; + this.menuItems.Location = new System.Drawing.Point(34, 156); + this.menuItems.Name = "menuItems"; + this.menuItems.Size = new System.Drawing.Size(514, 345); + this.menuItems.TabIndex = 10; + // + // orderItems + // + this.orderItems.Font = new System.Drawing.Font("Segoe UI Light", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.orderItems.FormattingEnabled = true; + this.orderItems.ItemHeight = 31; + this.orderItems.Location = new System.Drawing.Point(769, 156); + this.orderItems.Name = "orderItems"; + this.orderItems.Size = new System.Drawing.Size(514, 345); + this.orderItems.TabIndex = 11; + // + // metroLabel2 + // + this.metroLabel2.AutoSize = true; + this.metroLabel2.Location = new System.Drawing.Point(613, 153); + this.metroLabel2.Name = "metroLabel2"; + this.metroLabel2.Size = new System.Drawing.Size(87, 20); + this.metroLabel2.TabIndex = 12; + this.metroLabel2.Text = "metroLabel2"; + // + // submit + // + this.submit.Location = new System.Drawing.Point(1117, 14); + this.submit.Name = "submit"; + this.submit.Size = new System.Drawing.Size(220, 66); + this.submit.TabIndex = 13; + this.submit.Text = "Submit Order"; + this.submit.UseSelectable = true; + this.submit.Click += new System.EventHandler(this.submit_Click); + // + // metroButton1 + // + this.metroButton1.Location = new System.Drawing.Point(840, 56); + this.metroButton1.Name = "metroButton1"; + this.metroButton1.Size = new System.Drawing.Size(75, 23); + this.metroButton1.TabIndex = 14; + this.metroButton1.Text = "metroButton1"; + this.metroButton1.UseSelectable = true; + this.metroButton1.Click += new System.EventHandler(this.metroButton1_Click); + // + // tableNumberLabel + // + this.tableNumberLabel.AutoSize = true; + this.tableNumberLabel.FontSize = MetroFramework.MetroLabelSize.Tall; + this.tableNumberLabel.Location = new System.Drawing.Point(44, 30); + this.tableNumberLabel.Name = "tableNumberLabel"; + this.tableNumberLabel.Size = new System.Drawing.Size(114, 25); + this.tableNumberLabel.TabIndex = 15; + this.tableNumberLabel.Text = "metroLabel3"; + // // tableOrder // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1386, 810); + this.Controls.Add(this.tableNumberLabel); + this.Controls.Add(this.metroButton1); + this.Controls.Add(this.submit); + this.Controls.Add(this.metroLabel2); + this.Controls.Add(this.orderItems); + this.Controls.Add(this.menuItems); + this.Controls.Add(this.removeItem); + this.Controls.Add(this.addItem); + this.Controls.Add(this.metroLabel1); this.Controls.Add(this.order); this.Controls.Add(this.Menu); - this.Controls.Add(this.dataGridView2); - this.Controls.Add(this.dataGridView1); - this.Controls.Add(this.metroComboBox1); + this.Controls.Add(this.itemType); + this.DisplayHeader = false; this.Name = "tableOrder"; - this.Style = MetroFramework.MetroColorStyle.Orange; + this.Padding = new System.Windows.Forms.Padding(20, 30, 20, 20); + this.Style = MetroFramework.MetroColorStyle.Red; this.Text = "tableOrder"; this.Load += new System.EventHandler(this.tableOrder_Load); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -112,10 +195,17 @@ private void InitializeComponent() #endregion - private MetroFramework.Controls.MetroComboBox metroComboBox1; - private System.Windows.Forms.DataGridView dataGridView1; - private System.Windows.Forms.DataGridView dataGridView2; + private MetroFramework.Controls.MetroComboBox itemType; private MetroFramework.Controls.MetroLabel Menu; private MetroFramework.Controls.MetroLabel order; + private MetroFramework.Controls.MetroLabel metroLabel1; + private MetroFramework.Controls.MetroButton addItem; + private MetroFramework.Controls.MetroButton removeItem; + private System.Windows.Forms.ListBox menuItems; + private System.Windows.Forms.ListBox orderItems; + private MetroFramework.Controls.MetroLabel metroLabel2; + private MetroFramework.Controls.MetroButton submit; + private MetroFramework.Controls.MetroButton metroButton1; + private MetroFramework.Controls.MetroLabel tableNumberLabel; } } \ No newline at end of file diff --git a/Enigma/Popups/tableOrder.cs b/Enigma/Popups/tableOrder.cs index f5dc938..56b2549 100644 --- a/Enigma/Popups/tableOrder.cs +++ b/Enigma/Popups/tableOrder.cs @@ -8,19 +8,145 @@ using System.Threading.Tasks; using System.Windows.Forms; using MetroFramework.Forms; +using EnigmaX.Classes; +using EnigmaX; +using Enigma.StationsGUI; +using MySql.Data.MySqlClient; namespace Enigma.Popups { public partial class tableOrder : MetroForm { - public tableOrder() + private List enigmaMenuItems = new List(); + private List orderedItems = new List(); + WaiterStationView wsv = new WaiterStationView(); + + public tableOrder(WaiterStationView waiterStation) { InitializeComponent(); + loadMenuItems(); + wsv = waiterStation; + //metroLabel2.Text.Equals(wsv._tableNumber.ToString()); + tableNumberLabel.Text = "Table #" + wsv._tableNumber.ToString(); } private void tableOrder_Load(object sender, EventArgs e) { + + } + + private void loadMenuItems() + { + DBConnect db = new DBConnect(); + List> result = db.ReadCommand("SELECT * FROM MenuItems", "id", "title", "description", "price", "category", "printingStation"); + foreach (Dictionary row in result) + { + EnigmaMenuItem menuItem = new EnigmaMenuItem(Convert.ToInt32(row["id"]), row["title"], row["description"], float.Parse(row["price"]), (MenuItemType)Enum.Parse(typeof(MenuItemType), row["category"]), (PrintingStationType)Enum.Parse(typeof(PrintingStationType), row["printingStation"])); + enigmaMenuItems.Add(menuItem); + } + } + + private void drawMenuItems(int type) + { + menuItems.Items.Clear(); + foreach (EnigmaMenuItem item in enigmaMenuItems) + { + if (item.getItemType() == type) + { + menuItems.Items.Add(item); + } + + } + } + + private void drawOrderedItems() + { + orderItems.Items.Clear(); + foreach (EnigmaMenuItem item in orderedItems) + { + orderItems.Items.Add(item); + } + } + + private void itemType_SelectedIndexChanged(object sender, EventArgs e) + { + if (itemType.Text.Equals("appetizer")){ + drawMenuItems(1); + } + else if (itemType.Text.Equals("entree")) + { + drawMenuItems(2); + } + else if (itemType.Text.Equals("desert")) + { + drawMenuItems(3); + } + else if (itemType.Text.Equals("drink")) + { + drawMenuItems(4); + }else if (itemType.Text.Equals("other")) + { + drawMenuItems(5); + } + } + + private void menuItems_SelectedIndexChanged(object sender, EventArgs e) + { } + + private void addItem_Click(object sender, EventArgs e) + { + // menuItems.SelectedItems.Add(orderedItems); + EnigmaMenuItem item = (EnigmaMenuItem)menuItems.SelectedItem; + if (item==null) { } + else + { + orderedItems.Add(item); + } + metroLabel2.Text = orderedItems.Count().ToString(); + //metroLabel2.Text = orderItemsToString(); + drawOrderedItems(); + } + + private void removeItem_Click(object sender, EventArgs e) + { + EnigmaMenuItem item = (EnigmaMenuItem)orderItems.SelectedItem; + orderedItems.Remove(item); + metroLabel2.Text = orderedItems.Count().ToString(); + drawOrderedItems(); + } + + private string orderItemsToString() + { + string x = null; + + foreach(EnigmaMenuItem item in orderedItems) + { + + x = x + item.Id.ToString() + '|'; + } + return x; + } + + private void submit_Click(object sender, EventArgs e) + { + string delimitedOrder = orderItemsToString(); + DBConnect db = new DBConnect(); + db.getConnection().Open(); + //MySqlCommand cmd = new MySqlCommand("UPDATE Seating SET Order = @Order WHERE tableNumber = @tableNumber", db.getConnection()); + MySqlCommand cmd = new MySqlCommand("UPDATE Seating SET tableOrder = @tableOrder WHERE tableNumber = @tableNumber", db.getConnection()); + cmd.Parameters.AddWithValue("@tableOrder", delimitedOrder); + cmd.Parameters.AddWithValue("@tableNumber",wsv._tableNumber); + cmd.ExecuteNonQuery(); + db.getConnection().Close(); + this.Close(); + + } + + private void metroButton1_Click(object sender, EventArgs e) + { + metroLabel2.Text = orderItemsToString() + " " + wsv._tableNumber.ToString(); + } } } diff --git a/Enigma/Popups/waitListAdd.Designer.cs b/Enigma/Popups/waitListAdd.Designer.cs index c5df775..5a60ba0 100644 --- a/Enigma/Popups/waitListAdd.Designer.cs +++ b/Enigma/Popups/waitListAdd.Designer.cs @@ -135,6 +135,7 @@ private void InitializeComponent() this.Controls.Add(this.metroLabel1); this.Controls.Add(this.inputName); this.Name = "waitListAdd"; + this.Style = MetroFramework.MetroColorStyle.Green; this.Text = "Form1"; this.Load += new System.EventHandler(this.waitListAdd_Load); ((System.ComponentModel.ISupportInitialize)(this.sizeInput)).EndInit(); diff --git a/Enigma/Properties/Resources.Designer.cs b/Enigma/Properties/Resources.Designer.cs index 0d544c1..8814cdb 100644 --- a/Enigma/Properties/Resources.Designer.cs +++ b/Enigma/Properties/Resources.Designer.cs @@ -60,6 +60,16 @@ internal Resources() { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap gradient_background_26046_26731_hd_wallpapers_jpg { + get { + object obj = ResourceManager.GetObject("gradient-background-26046-26731-hd-wallpapers.jpg", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/Enigma/Properties/Resources.resx b/Enigma/Properties/Resources.resx index 92579d3..f95635c 100644 --- a/Enigma/Properties/Resources.resx +++ b/Enigma/Properties/Resources.resx @@ -124,4 +124,7 @@ ..\Resources\ring-alt.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\gradient-background-26046-26731-hd-wallpapers.jpg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Enigma/Resources/gradient-background-26046-26731-hd-wallpapers.jpg.png b/Enigma/Resources/gradient-background-26046-26731-hd-wallpapers.jpg.png new file mode 100644 index 0000000..c26e80b Binary files /dev/null and b/Enigma/Resources/gradient-background-26046-26731-hd-wallpapers.jpg.png differ diff --git a/Enigma/Stations/WaiterStation.cs b/Enigma/Stations/WaiterStation.cs index 08a930b..05943ce 100644 --- a/Enigma/Stations/WaiterStation.cs +++ b/Enigma/Stations/WaiterStation.cs @@ -14,6 +14,10 @@ public WaiterStation(string stationid) : base(StationTypeDef.host, stationid) view = new StationsGUI.WaiterStationView(); } - + + public override void showView() + { + view.Show(); + } } } diff --git a/Enigma/StationsGUI/HostStationView.Designer.cs b/Enigma/StationsGUI/HostStationView.Designer.cs index 7d7137d..9423cef 100644 --- a/Enigma/StationsGUI/HostStationView.Designer.cs +++ b/Enigma/StationsGUI/HostStationView.Designer.cs @@ -126,6 +126,7 @@ private void InitializeComponent() this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "HostStationView"; this.Padding = new System.Windows.Forms.Padding(18, 30, 18, 16); + this.Style = MetroFramework.MetroColorStyle.Green; this.Text = "HostStationView"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.HostStationView_FormClosed); this.Load += new System.EventHandler(this.HostStationView_Load); diff --git a/Enigma/StationsGUI/WaiterStationView.Designer.cs b/Enigma/StationsGUI/WaiterStationView.Designer.cs index a478952..01b6ff2 100644 --- a/Enigma/StationsGUI/WaiterStationView.Designer.cs +++ b/Enigma/StationsGUI/WaiterStationView.Designer.cs @@ -29,95 +29,93 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { this.tableNumber = new MetroFramework.Controls.MetroLabel(); - this.tableNumInput = new MetroFramework.Controls.MetroTextBox(); this.orderSelect = new MetroFramework.Controls.MetroButton(); this.checkoutTable = new MetroFramework.Controls.MetroButton(); this.printCheque = new MetroFramework.Controls.MetroButton(); + this.table = new System.Windows.Forms.NumericUpDown(); + this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); + ((System.ComponentModel.ISupportInitialize)(this.table)).BeginInit(); this.SuspendLayout(); // // tableNumber // this.tableNumber.AutoSize = true; - this.tableNumber.Location = new System.Drawing.Point(22, 74); + this.tableNumber.Location = new System.Drawing.Point(513, 176); this.tableNumber.Name = "tableNumber"; this.tableNumber.Size = new System.Drawing.Size(101, 20); this.tableNumber.TabIndex = 0; this.tableNumber.Text = "Table Number:"; // - // tableNumInput - // - // - // - // - this.tableNumInput.CustomButton.Image = null; - this.tableNumInput.CustomButton.Location = new System.Drawing.Point(67, 1); - this.tableNumInput.CustomButton.Name = ""; - this.tableNumInput.CustomButton.Size = new System.Drawing.Size(21, 21); - this.tableNumInput.CustomButton.Style = MetroFramework.MetroColorStyle.Blue; - this.tableNumInput.CustomButton.TabIndex = 1; - this.tableNumInput.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light; - this.tableNumInput.CustomButton.UseSelectable = true; - this.tableNumInput.CustomButton.Visible = false; - this.tableNumInput.Lines = new string[] { - "metroTextBox1"}; - this.tableNumInput.Location = new System.Drawing.Point(130, 74); - this.tableNumInput.MaxLength = 32767; - this.tableNumInput.Name = "tableNumInput"; - this.tableNumInput.PasswordChar = '\0'; - this.tableNumInput.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.tableNumInput.SelectedText = ""; - this.tableNumInput.SelectionLength = 0; - this.tableNumInput.SelectionStart = 0; - this.tableNumInput.ShortcutsEnabled = true; - this.tableNumInput.Size = new System.Drawing.Size(89, 23); - this.tableNumInput.TabIndex = 1; - this.tableNumInput.Text = "metroTextBox1"; - this.tableNumInput.UseSelectable = true; - this.tableNumInput.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109))))); - this.tableNumInput.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel); - // // orderSelect // - this.orderSelect.Location = new System.Drawing.Point(22, 117); + this.orderSelect.Location = new System.Drawing.Point(514, 219); this.orderSelect.Name = "orderSelect"; this.orderSelect.Size = new System.Drawing.Size(197, 65); this.orderSelect.TabIndex = 2; this.orderSelect.Text = "Enter Table Order"; this.orderSelect.UseSelectable = true; + this.orderSelect.Click += new System.EventHandler(this.orderSelect_Click); // // checkoutTable // - this.checkoutTable.Location = new System.Drawing.Point(21, 282); + this.checkoutTable.Location = new System.Drawing.Point(513, 384); this.checkoutTable.Name = "checkoutTable"; this.checkoutTable.Size = new System.Drawing.Size(197, 65); this.checkoutTable.TabIndex = 3; this.checkoutTable.Text = "Checkout Table"; this.checkoutTable.UseSelectable = true; + this.checkoutTable.Click += new System.EventHandler(this.checkoutTable_Click); // // printCheque // - this.printCheque.Location = new System.Drawing.Point(22, 198); + this.printCheque.Location = new System.Drawing.Point(514, 300); this.printCheque.Name = "printCheque"; this.printCheque.Size = new System.Drawing.Size(197, 65); this.printCheque.TabIndex = 4; this.printCheque.Text = "Print Cheque"; this.printCheque.UseSelectable = true; + this.printCheque.Click += new System.EventHandler(this.printCheque_Click); + // + // table + // + this.table.Location = new System.Drawing.Point(638, 174); + this.table.Name = "table"; + this.table.Size = new System.Drawing.Size(73, 22); + this.table.TabIndex = 5; + this.table.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); + // + // metroLabel1 + // + this.metroLabel1.AutoSize = true; + this.metroLabel1.Location = new System.Drawing.Point(825, 219); + this.metroLabel1.Name = "metroLabel1"; + this.metroLabel1.Size = new System.Drawing.Size(84, 20); + this.metroLabel1.TabIndex = 6; + this.metroLabel1.Text = "metroLabel1"; // // WaiterStationView // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(248, 380); + this.BackgroundImage = global::Enigma.Properties.Resources.gradient_background_26046_26731_hd_wallpapers_jpg; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.ClientSize = new System.Drawing.Size(1257, 734); + this.Controls.Add(this.metroLabel1); + this.Controls.Add(this.table); this.Controls.Add(this.printCheque); this.Controls.Add(this.checkoutTable); this.Controls.Add(this.orderSelect); - this.Controls.Add(this.tableNumInput); this.Controls.Add(this.tableNumber); + this.DisplayHeader = false; + this.ForeColor = System.Drawing.Color.Transparent; this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "WaiterStationView"; - this.Padding = new System.Windows.Forms.Padding(18, 60, 18, 16); + this.Padding = new System.Windows.Forms.Padding(18, 30, 18, 16); + this.Resizable = false; + this.Style = MetroFramework.MetroColorStyle.Red; this.Text = "Waiter Station"; this.Load += new System.EventHandler(this.WaiterStationView_Load); + ((System.ComponentModel.ISupportInitialize)(this.table)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -126,9 +124,10 @@ private void InitializeComponent() #endregion private MetroFramework.Controls.MetroLabel tableNumber; - private MetroFramework.Controls.MetroTextBox tableNumInput; private MetroFramework.Controls.MetroButton orderSelect; private MetroFramework.Controls.MetroButton checkoutTable; private MetroFramework.Controls.MetroButton printCheque; + private System.Windows.Forms.NumericUpDown table; + private MetroFramework.Controls.MetroLabel metroLabel1; } } \ No newline at end of file diff --git a/Enigma/StationsGUI/WaiterStationView.cs b/Enigma/StationsGUI/WaiterStationView.cs index 007e705..171aa33 100644 --- a/Enigma/StationsGUI/WaiterStationView.cs +++ b/Enigma/StationsGUI/WaiterStationView.cs @@ -9,11 +9,13 @@ using System.Windows.Forms; using EnigmaX.Classes; using MetroFramework.Forms; +using Enigma.Popups; namespace Enigma.StationsGUI { public partial class WaiterStationView : MetroForm { + public int _tableNumber; public WaiterStationView() { InitializeComponent(); @@ -23,5 +25,34 @@ private void WaiterStationView_Load(object sender, EventArgs e) { } + + private void orderSelect_Click(object sender, EventArgs e) + { + tableOrder order = new tableOrder(this); + order.Show(); + } + + private void numericUpDown1_ValueChanged(object sender, EventArgs e) + { + setTableNumber((int)table.Value); + metroLabel1.Text = _tableNumber.ToString(); + } + + private void printCheque_Click(object sender, EventArgs e) + { + chequePrintPopup printCheque = new chequePrintPopup(this); + printCheque.Show(); + } + + private void setTableNumber(int tableNum) + { + _tableNumber = tableNum; + } + + private void checkoutTable_Click(object sender, EventArgs e) + { + checkoutTablePopup checkout = new checkoutTablePopup(this); + checkout.Show(); + } } } diff --git a/EnigmaX/Classes/EnigmaMenu.cs b/EnigmaX/Classes/EnigmaMenu.cs index fb361ab..2d9d976 100644 --- a/EnigmaX/Classes/EnigmaMenu.cs +++ b/EnigmaX/Classes/EnigmaMenu.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace EnigmaX.Classes { @@ -13,6 +14,8 @@ public class EnigmaMenu private string _title; private List _items; + public EnigmaMenu() { } + public EnigmaMenu(int id, string title, List items) { _id = id; _title = title; diff --git a/EnigmaX/Classes/EnigmaMenuItem.cs b/EnigmaX/Classes/EnigmaMenuItem.cs index bbb139e..82025aa 100644 --- a/EnigmaX/Classes/EnigmaMenuItem.cs +++ b/EnigmaX/Classes/EnigmaMenuItem.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace EnigmaX.Classes { @@ -84,8 +85,22 @@ public string Title { } } + public int getItemType() + { + return (int)_itemType + 1; + } + + public float Price + { + get + { + return _price; + } + } + public static EnigmaMenuItem idToMenuItem(int id) { + DBConnect db = new DBConnect(); MySqlCommand conn = new MySqlCommand("SELECT * FROM MenuItems WHERE id = @id LIMIT 1"); conn.Parameters.AddWithValue("@id", id.ToString()); @@ -104,5 +119,6 @@ public override string ToString() { return _id + ": " + _title; } + } }