Skip to content
Permalink
be94fdde9e
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
88 lines (78 sloc) 2.68 KB
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<Order> orders = new List<Order>();
List<EnigmaMenuItem> items = new List<EnigmaMenuItem>();
public ChefStationView()
{
InitializeComponent();
}
private void ChefStationView_Load(object sender, EventArgs e)
{
loadOrders();
drawOrders();
}
private void loadOrders()
{
orders.Clear();
db = new DBConnect();
List<Dictionary<string, string>> result = db.ReadCommand("SELECT * FROM Seating", "tableNumber", "tableOrder");
foreach (Dictionary<string, string> 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.getOrder());
}
}
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
}
}
}