Skip to content

Commit

Permalink
Print Check popup added
Browse files Browse the repository at this point in the history
  • Loading branch information
rrk12005 committed Apr 4, 2017
1 parent 8508962 commit 3449371
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 23 deletions.
39 changes: 24 additions & 15 deletions Enigma/Popups/chequePrintPopup.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 36 additions & 1 deletion Enigma/Popups/chequePrintPopup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<EnigmaMenuItem> tableOrderList = new List<EnigmaMenuItem>();
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<Dictionary<string, string>> 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
{

}

}
}
}
25 changes: 20 additions & 5 deletions Enigma/Popups/tableOrder.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Enigma/Popups/tableOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -122,6 +123,7 @@ private string orderItemsToString()

foreach(EnigmaMenuItem item in orderedItems)
{

x = x + item.Id.ToString() + '|';
}
return x;
Expand Down
1 change: 1 addition & 0 deletions Enigma/StationsGUI/WaiterStationView.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Enigma/StationsGUI/WaiterStationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions EnigmaX/Classes/EnigmaMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace EnigmaX.Classes
{
Expand All @@ -13,6 +14,8 @@ public class EnigmaMenu
private string _title;
private List<EnigmaMenuItem> _items;

public EnigmaMenu() { }

public EnigmaMenu(int id, string title, List<EnigmaMenuItem> items) {
_id = id;
_title = title;
Expand Down Expand Up @@ -50,6 +53,7 @@ public List<EnigmaMenuItem> Items
public static List<EnigmaMenuItem> stringToItemList(string items) {
List<EnigmaMenuItem> itemList = new List<EnigmaMenuItem>();
foreach (string item in items.Split('|')) {

itemList.Add(EnigmaMenuItem.idToMenuItem(Convert.ToInt32(item)));
}
return itemList;
Expand Down
3 changes: 3 additions & 0 deletions EnigmaX/Classes/EnigmaMenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace EnigmaX.Classes
{
Expand Down Expand Up @@ -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<Dictionary<string, string>> 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"]));
Expand Down

0 comments on commit 3449371

Please sign in to comment.