Пример #1
0
        private async void undoClick(object sender, EventArgs e)
        {
            if (lastChanged != null)
            {
                await Firebase.UpdateAsync <Order>("Orders", Helper.GetOrderKey(lastChanged.OrderNum), lastChanged);

                lastChanged        = null;
                undoButton.Enabled = false;
            }
        }
Пример #2
0
        private async void undoClick(object sender, EventArgs e)
        {
            if (lastChanged != null)
            {
                await Firebase.UpdateAsync <Table>("Tables", Helper.GetTableKey(lastChanged.TableNumber), lastChanged);

                lastChanged        = null;
                lastClicked        = null;
                undoButton.Enabled = false;
            }
            sendDumbyFocus();
        }
Пример #3
0
        private async void resetClick(object sender, EventArgs e)
        {
            for (int i = 1; i <= 8; i++)
            {
                var temp = new Table()
                {
                    AssignedWaiter = "",
                    Status         = "clean",
                    TableNumber    = i
                };

                await Firebase.UpdateAsync <Table>("Tables", "Table_" + i.ToString(), temp);
            }
        }
Пример #4
0
        internal static async Task <Table> SetTableStatus(int table_num, string status, string waiter)
        {
            var old = await Firebase.GetAsync <Table>("Tables", "Table_" + table_num.ToString());

            var temp = new Table()
            {
                AssignedWaiter = waiter,
                Status         = status,
                TableNumber    = old.TableNumber
            };
            await Firebase.UpdateAsync <Table>("Tables", "Table_" + table_num.ToString(), temp);

            return(old);
        }
Пример #5
0
        private async void readyClick(object sender, EventArgs e)
        {
            if (lastSelected != null)
            {
                var temp  = lastSelected.Replace(" ", "_");
                var order = await Firebase.GetAsync <Order>("Orders", temp);

                lastChanged  = order;
                order.Status = "ready";
                await Firebase.UpdateAsync <Order>("Orders", temp, order);

                orderList.SelectedItem = null;
                lastSelected           = null;
                undoButton.Enabled     = true;
            }
        }
Пример #6
0
        private async void backgroundDoWork(object sender, DoWorkEventArgs e)
        {
            try {
                while (!backgroundWorker.CancellationPending)
                {
                    var    tempTables = (await Firebase.GetAsync <TableDatabaseReturn>()).Tables;
                    Button b;

                    foreach (var table in tempTables)
                    {
                        b = Helper.GetButton(LayoutPanel, table.Value.TableNumber);
                        if (table.Value.AssignedWaiter == user.username)
                        {
                            b.BackColor = Color.Green;
                            b.ForeColor = Color.White;
                        }
                        else
                        {
                            b.BackColor = Color.Red;
                            b.ForeColor = Color.White;
                        }
                    }

                    var tempOrders = (await Firebase.GetAsync <OrderDatabaseReturn>()).Orders;

                    foreach (var item in tempOrders)
                    {
                        if (item.Value.Waiter == user.username && item.Value.Status == "ready")
                        {
                            MessageBox.Show("Food ready for table " + item.Value.TableNum.ToString());
                            Order order = new Order()
                            {
                                OrderNum    = item.Value.OrderNum,
                                Status      = "complete",
                                TableNum    = item.Value.TableNum,
                                Waiter      = item.Value.Waiter,
                                OrderString = item.Value.OrderString
                            };
                            await Firebase.UpdateAsync <Order>("Orders", item.Key, order);
                        }
                    }

                    Thread.Sleep(TimeSpan.FromSeconds(2));
                }
            } catch (Exception) { }
        }
Пример #7
0
        internal static async Task <Table> SetTableStatus(int table_num, string status)
        {
            var old = await Firebase.GetAsync <Table>("Tables", "Table_" + table_num.ToString());

            var temp = new Table()
            {
                AssignedWaiter = old.AssignedWaiter,
                Status         = status,
                TableNumber    = old.TableNumber
            };

            if (status != "occupied" && temp.AssignedWaiter != "")
            {
                temp.AssignedWaiter = "";
            }
            await Firebase.UpdateAsync <Table>("Tables", "Table_" + table_num.ToString(), temp);

            return(old);
        }