Beispiel #1
0
    protected void UpdateOrderTable()
    {
        DataTable orderTable = db.GetTable(MenuDbManager.Table.ORDERS);

        orderList.DataSource = orderTable;
        orderList.ShowHeader = true;
        orderList.DataBind();
    }
Beispiel #2
0
    protected void updateMenuItems()
    {
        DataTable menuTable = new DataTable();

        menuTable            = db.GetTable(MenuDbManager.Table.MENU);
        menuItems.DataSource = menuTable;
        menuItems.ShowHeader = true;
        menuItems.DataBind();
    }
Beispiel #3
0
    protected void updateServerTable()
    {
        DataTable serverTable = new DataTable();

        serverTable           = db.GetTable(MenuDbManager.Table.SERVER);
        serverList.DataSource = serverTable;
        serverList.ShowHeader = true;
        serverList.DataBind();
    }
Beispiel #4
0
    public void LoadOrders()
    {
        String        dbLocation = HostingEnvironment.MapPath(System.IO.Path.Combine("~/App_Data/", Constants.DB_NAME));
        MenuDbManager db         = new MenuDbManager(DBManager.defaultDbLocation);

        db.Connect();

        orderDataTable = db.GetTable(MenuDbManager.Table.ORDERS);
        // Load all MenuItems into Session Variable
        foreach (DataRow row in orderDataTable.Rows)
        {
            Order order = new Order();
            order.groupId  = Convert.ToInt16(row["GROUP_ID"]);
            order.serverId = Convert.ToInt16(row["SERVER_ID"]);
            order.mealType = row["MEAL_TYPE"].ToString();
            orderList.Add(order);
        }

        List <OrderItem> orderItems = new List <OrderItem>();

        orderItemDataTable = db.GetTable(MenuDbManager.Table.ORDER_ITEM);
        foreach (DataRow row in orderItemDataTable.Rows)
        {
            OrderItem item = new OrderItem();
            item.groupId = Convert.ToInt16(row["GROUP_ID"]);
            item.itemId  = Convert.ToInt16(row["ITEM_ID"]);
            item.amount  = Convert.ToInt16(row["AMOUNT"]);
            orderItems.Add(item);
        }

        foreach (Order o in this.orderList)
        {
            var results = orderItems.FindAll(i => i.groupId == o.groupId);
            o.orderItems = results;
        }
        db.Close();
    }
Beispiel #5
0
    public void LoadMenuItems()
    {
        MenuDbManager db = new MenuDbManager(DBManager.defaultDbLocation);

        db.Connect();

        dataTable = db.GetTable(MenuDbManager.Table.MENU);

        foreach (DataRow row in dataTable.Rows)
        {
            MenuItem item = new MenuItem();
            item.id       = Convert.ToInt16(row["ID"]);
            item.itemName = row["ITEM_NAME"].ToString();
            item.type     = row["TYPE"].ToString();
            item.price    = Convert.ToDouble(row["PRICE"]);
            item.cost     = Convert.ToDouble(row["COST"]);
            itemList.Add(item);
        }
        db.Close();
    }
Beispiel #6
0
    public void LoadServers()
    {
        MenuDbManager db = new MenuDbManager(DBManager.defaultDbLocation);

        db.Connect();
        dataTable = db.GetTable(MenuDbManager.Table.SERVER);
        // Load all Servers into Session Variable
        foreach (DataRow r in dataTable.Rows)
        {
            Server server = new Server();
            server.id        = Convert.ToInt16(r["ID"]);
            server.firstname = r["FIRST_NAME"].ToString();
            server.lastname  = r["LAST_NAME"].ToString();
            server.age       = Convert.ToInt16(r["AGE"]);
            server.sex       = Convert.ToChar(r["SEX"]);
            serverList.Add(server);
        }

        db.Close();
    }