private void finishOrder_Click(object sender, RoutedEventArgs e) { try { orders oder = orderList.SelectedItems[0] as orders; string sql = "update orders set isFinished='1' where time='" + oder.time.Text + "'"; mysqlwrite(sql); orderListRefresh(); guestName.Clear(); address.Clear(); orderInfo.Items.Clear(); } catch { } menuRefresh(); }
private void orderListRefresh() { this.orderList.Items.Clear(); string sql = "select name,isEatHere,price,time from orders where isFinished='0' order by time desc"; MySqlDataReader get_order = getmysqlread(sql); while (get_order.Read()) { orders temp = new orders(); temp.name.Text = get_order["name"].ToString(); if (get_order["isEatHere"].ToString() == "1") { temp.option.Text = "堂吃"; } else { temp.option.Text = "外卖"; } temp.price.Text = "¥ " + get_order["price"].ToString(); DateTime dt = (DateTime)get_order["time"]; temp.time.Text = dt.Year.ToString() + "/" + dt.ToString(); this.orderList.Items.Add(temp); } }