Skip to content

Commit

Permalink
Waiter Station Core and Secondary Functions Completed
Browse files Browse the repository at this point in the history
  • Loading branch information
rrk12005 committed Apr 4, 2017
1 parent ebe2a8c commit 41e4ab7
Show file tree
Hide file tree
Showing 11 changed files with 129 additions and 11 deletions.
1 change: 1 addition & 0 deletions Enigma/Popups/TableAssign.Designer.cs

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

2 changes: 2 additions & 0 deletions Enigma/Popups/checkoutTablePopup.Designer.cs

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

26 changes: 25 additions & 1 deletion Enigma/Popups/checkoutTablePopup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,43 @@
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
{
public checkoutTablePopup()
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();
}
}
}
48 changes: 38 additions & 10 deletions Enigma/Popups/chequePrintPopup.Designer.cs

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

46 changes: 46 additions & 0 deletions Enigma/Popups/chequePrintPopup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public chequePrintPopup(WaiterStationView waiterStation)
InitializeComponent();
wsv = waiterStation;
importTableOrder();
drawOrderedItems();

}

private void chequePrintCheck_Load(object sender, EventArgs e)
Expand Down Expand Up @@ -57,5 +59,49 @@ private void importTableOrder()
}

}

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();
}
}
}
1 change: 1 addition & 0 deletions Enigma/Popups/resAdd.Designer.cs

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

1 change: 1 addition & 0 deletions Enigma/Popups/waitListAdd.Designer.cs

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

1 change: 1 addition & 0 deletions Enigma/StationsGUI/HostStationView.Designer.cs

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

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.

6 changes: 6 additions & 0 deletions Enigma/StationsGUI/WaiterStationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,11 @@ private void setTableNumber(int tableNum)
{
_tableNumber = tableNum;
}

private void checkoutTable_Click(object sender, EventArgs e)
{
checkoutTablePopup checkout = new checkoutTablePopup(this);
checkout.Show();
}
}
}
7 changes: 7 additions & 0 deletions EnigmaX/Classes/EnigmaMenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ public int getItemType()
return (int)_itemType + 1;
}

public float Price
{
get
{
return _price;
}
}

public static EnigmaMenuItem idToMenuItem(int id)
{
Expand Down

0 comments on commit 41e4ab7

Please sign in to comment.