/** * 结账按钮的实现,提交到数据库 * 1. 改变账号余额 * 2. 改变桌子状态为空闲 * 3. 删除该桌子的订单 * */ private void SubmitButton_Click(object sender, RoutedEventArgs e) { if (MemberInfo != null) { MemberInfoConnector.ModifyMoney(MemberInfo.MbId, leftMoney); } TableInfoConnector.ModifyStatus(TId, 1); OrderInfoConnector.DeleteOrderByTId(TId); MessageBox.Show("结账完成!"); MainMenuWindow mainMenuWindow = new MainMenuWindow(loginType); mainMenuWindow.Show(); Close(); }
/** * 提交按钮事件 * 提交数据库,修改桌号的状态 * */ private void Button_Click_1(object sender, RoutedEventArgs e) { int submit = OrderInfoConnector.SubmitOrder(TId, addOrders); int modify = TableInfoConnector.ModifyStatus(TId, 0); if (submit == 0 && modify == 1) { MessageBox.Show("提交成功!"); } else if (submit == 0 && modify != 1) { MessageBox.Show("修改餐桌状态失败!"); return; } else { MessageBox.Show("提交失败"); return; } MainMenuWindow mainMenuWindow = new MainMenuWindow(LoginType); mainMenuWindow.Show(); Close(); }