diff --git a/Enigma/Popups/chequePrintPopup.Designer.cs b/Enigma/Popups/chequePrintPopup.Designer.cs index 6501cba..29b8428 100644 --- a/Enigma/Popups/chequePrintPopup.Designer.cs +++ b/Enigma/Popups/chequePrintPopup.Designer.cs @@ -30,9 +30,10 @@ private void InitializeComponent() { this.cancel = new MetroFramework.Controls.MetroButton(); this.printConfirm = new MetroFramework.Controls.MetroButton(); - this.metroListView1 = new MetroFramework.Controls.MetroListView(); this.metroLabel1 = new MetroFramework.Controls.MetroLabel(); this.metroLabel2 = new MetroFramework.Controls.MetroLabel(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.metroLabel3 = new MetroFramework.Controls.MetroLabel(); this.SuspendLayout(); // // cancel @@ -53,18 +54,6 @@ private void InitializeComponent() this.printConfirm.Text = "Print"; this.printConfirm.UseSelectable = true; // - // metroListView1 - // - this.metroListView1.Font = new System.Drawing.Font("Segoe UI", 12F); - this.metroListView1.FullRowSelect = true; - this.metroListView1.Location = new System.Drawing.Point(11, 10); - this.metroListView1.Name = "metroListView1"; - this.metroListView1.OwnerDraw = true; - this.metroListView1.Size = new System.Drawing.Size(330, 229); - this.metroListView1.TabIndex = 2; - this.metroListView1.UseCompatibleStateImageBehavior = false; - this.metroListView1.UseSelectable = true; - // // metroLabel1 // this.metroLabel1.AutoSize = true; @@ -83,14 +72,33 @@ private void InitializeComponent() this.metroLabel2.TabIndex = 4; this.metroLabel2.Text = "Tax:"; // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.ItemHeight = 16; + this.listBox1.Location = new System.Drawing.Point(11, 15); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(328, 228); + this.listBox1.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"; + // // 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.metroLabel3); + this.Controls.Add(this.listBox1); this.Controls.Add(this.metroLabel2); this.Controls.Add(this.metroLabel1); - this.Controls.Add(this.metroListView1); this.Controls.Add(this.printConfirm); this.Controls.Add(this.cancel); this.DisplayHeader = false; @@ -107,8 +115,9 @@ private void InitializeComponent() private MetroFramework.Controls.MetroButton cancel; private MetroFramework.Controls.MetroButton printConfirm; - private MetroFramework.Controls.MetroListView metroListView1; private MetroFramework.Controls.MetroLabel metroLabel1; private MetroFramework.Controls.MetroLabel metroLabel2; + private System.Windows.Forms.ListBox listBox1; + private MetroFramework.Controls.MetroLabel metroLabel3; } } \ No newline at end of file diff --git a/Enigma/Popups/chequePrintPopup.cs b/Enigma/Popups/chequePrintPopup.cs index a20ac98..5716dab 100644 --- a/Enigma/Popups/chequePrintPopup.cs +++ b/Enigma/Popups/chequePrintPopup.cs @@ -8,19 +8,54 @@ 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 { - public chequePrintPopup() + WaiterStationView wsv = new WaiterStationView(); + List tableOrderList = new List(); + DBConnect db = new DBConnect(); + public chequePrintPopup(WaiterStationView waiterStation) { InitializeComponent(); + wsv = waiterStation; + importTableOrder(); } 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 + { + + } + + } } } diff --git a/Enigma/Popups/tableOrder.Designer.cs b/Enigma/Popups/tableOrder.Designer.cs index 377f300..698e303 100644 --- a/Enigma/Popups/tableOrder.Designer.cs +++ b/Enigma/Popups/tableOrder.Designer.cs @@ -39,6 +39,7 @@ private void InitializeComponent() 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(); // // itemType @@ -61,7 +62,7 @@ private void InitializeComponent() // 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; @@ -70,7 +71,7 @@ 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; @@ -79,7 +80,7 @@ private void InitializeComponent() // metroLabel1 // this.metroLabel1.AutoSize = true; - this.metroLabel1.Location = new System.Drawing.Point(34, 109); + 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; @@ -128,7 +129,7 @@ private void InitializeComponent() // metroLabel2 // this.metroLabel2.AutoSize = true; - this.metroLabel2.Location = new System.Drawing.Point(613, 183); + 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; @@ -154,11 +155,22 @@ private void InitializeComponent() 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); @@ -170,8 +182,10 @@ private void InitializeComponent() this.Controls.Add(this.order); this.Controls.Add(this.Menu); 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); this.ResumeLayout(false); @@ -192,5 +206,6 @@ private void InitializeComponent() 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 ddbb7b7..56b2549 100644 --- a/Enigma/Popups/tableOrder.cs +++ b/Enigma/Popups/tableOrder.cs @@ -26,7 +26,8 @@ public tableOrder(WaiterStationView waiterStation) InitializeComponent(); loadMenuItems(); wsv = waiterStation; - metroLabel2.Text.Equals(wsv._tableNumber.ToString()); + //metroLabel2.Text.Equals(wsv._tableNumber.ToString()); + tableNumberLabel.Text = "Table #" + wsv._tableNumber.ToString(); } private void tableOrder_Load(object sender, EventArgs e) @@ -122,6 +123,7 @@ private string orderItemsToString() foreach(EnigmaMenuItem item in orderedItems) { + x = x + item.Id.ToString() + '|'; } return x; diff --git a/Enigma/StationsGUI/WaiterStationView.Designer.cs b/Enigma/StationsGUI/WaiterStationView.Designer.cs index 28bf460..2119d2c 100644 --- a/Enigma/StationsGUI/WaiterStationView.Designer.cs +++ b/Enigma/StationsGUI/WaiterStationView.Designer.cs @@ -111,6 +111,7 @@ private void InitializeComponent() this.Name = "WaiterStationView"; 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(); diff --git a/Enigma/StationsGUI/WaiterStationView.cs b/Enigma/StationsGUI/WaiterStationView.cs index cda224a..03e3f47 100644 --- a/Enigma/StationsGUI/WaiterStationView.cs +++ b/Enigma/StationsGUI/WaiterStationView.cs @@ -40,7 +40,8 @@ private void numericUpDown1_ValueChanged(object sender, EventArgs e) private void printCheque_Click(object sender, EventArgs e) { - + chequePrintPopup printCheque = new chequePrintPopup(this); + printCheque.Show(); } private void setTableNumber(int tableNum) diff --git a/EnigmaX/Classes/EnigmaMenu.cs b/EnigmaX/Classes/EnigmaMenu.cs index b4fb8e3..e85444e 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; @@ -50,6 +53,7 @@ public List Items public static List stringToItemList(string items) { List itemList = new List(); foreach (string item in items.Split('|')) { + itemList.Add(EnigmaMenuItem.idToMenuItem(Convert.ToInt32(item))); } return itemList; diff --git a/EnigmaX/Classes/EnigmaMenuItem.cs b/EnigmaX/Classes/EnigmaMenuItem.cs index 00f21f0..e784be8 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 { @@ -54,10 +55,12 @@ public int getItemType() 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()); List> result = db.ReadCommand(conn, "title", "title", "description", "price", "category", "printingStation"); + if (result.Count > 0) { return new EnigmaMenuItem(id, result[0]["title"], result[0]["description"], float.Parse(result[0]["price"]), (MenuItemType)Enum.Parse(typeof(MenuItemType), result[0]["category"]), (PrintingStationType)Enum.Parse(typeof(PrintingStationType), result[0]["printingStation"]));