Beispiel #1
0
        public string setDeallocationClient(string dni)
        {
            int tableID = SqlProcessor.selectTable(dni).Id;

            setDeallocation(dni, tableID);
            return(XmlProcessor.xmlTablesStatusBuilder(SqlProcessor.selectAllTables()));
        }
Beispiel #2
0
        public string setDeallocationTable(int tableID)
        {
            string client = SqlProcessor.selectTable(tableID).Client;

            setDeallocation(client, tableID);
            return(XmlProcessor.xmlTablesStatusBuilder(SqlProcessor.selectAllTables()));
        }
Beispiel #3
0
        public string setAllocationTable(string dni, int tableID, int guests)
        {
            int appearances = SqlProcessor.selectClient(dni).Appearances;

            SqlProcessor.updateClient(dni, 1, ++appearances);  // status (cliente) == 1 (sentado)
            SqlProcessor.updateTable(tableID, 0, dni, guests); // status (mesa) == 0 (ocupada)
            return(XmlProcessor.xmlTablesStatusBuilder(SqlProcessor.selectAllTables()));
        }
Beispiel #4
0
        public string addNewOrder(string xml)
        {
            List <Order> orders = XmlProcessor.xmlOrdersDecoder(xml);

            foreach (Order order in orders)
            {
                SqlProcessor.insertOrder(order);
            }
            recalculateTablesStatus();  // recalcula el nuevo estado de las mesas del restaurante
            return(XmlProcessor.xmlTablesStatusBuilder(SqlProcessor.selectAllTables()));
        }
Beispiel #5
0
        public string payBill(int billID, int type)
        {
            int    tableID = SqlProcessor.selectTableBill(billID);
            string client  = SqlProcessor.selectTable(tableID).Client;

            foreach (Order o in SqlProcessor.selectTableOrders(tableID, false))
            {
                SqlProcessor.updateOrder(o.Id, -3, 3, -3);
            }
            SqlProcessor.updateClient(client, 2, -3);
            SqlProcessor.updateTable(tableID, 3, "", -3);
            SqlProcessor.updateBillStatus(billID, type);
            return(XmlProcessor.xmlTablesStatusBuilder(SqlProcessor.selectAllTables()));
        }
Beispiel #6
0
 public string getTablesStatus()
 {
     return(XmlProcessor.xmlTablesStatusBuilder(SqlProcessor.selectAllTables()));
 }
Beispiel #7
0
 public string setOrderTable(int orderID, int tableID)
 {
     SqlProcessor.updateOrder(orderID, -3, -3, tableID); // -3 no modifica el argumento
     recalculateTablesStatus();                          // recalcula el nuevo estado de las mesas del restaurante
     return(XmlProcessor.xmlTablesStatusBuilder(SqlProcessor.selectAllTables()));
 }