Ejemplo n.º 1
0
        /*
         * 删除餐桌
         * 1. 查看选中状态
         * 2. 查看餐桌空闲状态,空闲则可删
         * 3. 删除
         * */
        private void DeleteTableButton_Click(object sender, RoutedEventArgs e)
        {
            if (TableList.SelectedIndex == -1)
            {
                MessageBox.Show("未选中餐桌");
                return;
            }

            if (((InformationTable3)TableList.SelectedItem).Right_TB.Text == "是")
            {
                int DeleteResult =
                    TableInfoConnector.DeleteTable(((InformationTable3)TableList.SelectedItem).Left_TB.Text,
                                                   HallInfoConnector.GetHallInfoData(((InformationTable3)TableList.SelectedItem).Mid_TB.Text).HId);
                if (DeleteResult == 1)
                {
                    MessageBox.Show("删除成功");
                    ModifyTableName.Text          = "";
                    ModifyHallCombo.SelectedIndex = 0;
                    LoadAllTables();
                }
            }
            else
            {
                MessageBox.Show("非空闲的餐桌无法删除");
                return;
            }
        }
Ejemplo n.º 2
0
        /*
         * 修改事件,只可以对餐桌状态进行改变
         * */
        private void ModifyTableButton_Click(object sender, RoutedEventArgs e)
        {
            if (ModifyTableName.Text == "")
            {
                MessageBox.Show("未填写餐桌名");
                return;
            }

            if (FreeRadio.IsChecked == false && NonFreeRadio.IsChecked == false)
            {
                MessageBox.Show("未选择状态");
                return;
            }

            int TIsFree      = FreeRadio.IsChecked == true ? 1 : 0;
            int ModifyResult =
                TableInfoConnector.ModifyTableStatus(ModifyTableName.Text, ModifyHallCombo.SelectedIndex + 1, TIsFree);

            if (ModifyResult == -1)
            {
                MessageBox.Show("不存在的餐桌");
            }
            if (ModifyResult == 1)
            {
                MessageBox.Show("修改成功");
                ModifyTableName.Text          = "";
                ModifyHallCombo.SelectedIndex = 0;
                LoadAllTables();
            }
            else
            {
                MessageBox.Show("修改失败");
            }
        }
Ejemplo n.º 3
0
 public OrderPay(int TId, int LoginType)
 {
     //显示在屏幕中间
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     this.TId = TId;
     InitializeComponent();
     LoadOrderList();
     TableNumber.Content = TableInfoConnector.GetTable(TId).hall.HName + TableInfoConnector.GetTable(TId).TTitle + "桌";
     this.loginType      = LoginType;
 }
Ejemplo n.º 4
0
        /**
         * 结账按钮的实现,提交到数据库
         * 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();
        }
Ejemplo n.º 5
0
 public OrderDishWindow(int TId, int type)
 {
     //显示在屏幕中间
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     this.TId  = TId;
     LoginType = type;
     addOrders = new List <AddOrderTmp>();
     InitializeComponent();
     tableInfo = TableInfoConnector.GetTable(TId);
     LoadExistOrder();
     TableNameTextBlock.Text = tableInfo.hall.HName + tableInfo.TTitle + "桌";
     AddDishTypeList();
     DishTypeList.SelectedIndex = 1;
 }
Ejemplo n.º 6
0
        /*
         * 加载餐桌信息
         * */
        private void LoadAllTables()
        {
            int count = TableList.Items.Count;

            for (int i = 0; i < count; i++)
            {
                TableList.Items.RemoveAt(0);
            }
            tableInfoDatas = TableInfoConnector.GetTableInfoDatas();
            foreach (TableInfoData table in tableInfoDatas)
            {
                InformationTable3 informationTable3 = new InformationTable3();
                informationTable3.Left_TB.Text  = table.TTitle;
                informationTable3.Mid_TB.Text   = table.hall.HName;
                informationTable3.Right_TB.Text = table.TIsFree == 1 ? "是" : "否";
                TableList.Items.Add(informationTable3);
            }
        }
Ejemplo n.º 7
0
        /**
         * 模糊查询餐桌信息
         * */
        private void FindSimTable()
        {
            List <TableInfoData> tableInfoDatas =
                TableInfoConnector.GetTableInfoDatas(SearchTableName.Text, SearchHallCombo.SelectedIndex);
            int count = TableList.Items.Count;

            for (int i = 0; i < count; i++)
            {
                TableList.Items.RemoveAt(0);
            }
            foreach (TableInfoData table in tableInfoDatas)
            {
                InformationTable3 informationTable3 = new InformationTable3();
                informationTable3.Left_TB.Text  = table.TTitle;
                informationTable3.Mid_TB.Text   = table.hall.HName;
                informationTable3.Right_TB.Text = table.TIsFree == 1 ? "是" : "否";
                TableList.Items.Add(informationTable3);
            }
        }
Ejemplo n.º 8
0
        /*
         * 显示ListBox,将自定义的控件对象放进ListBox中
         * 传进来的参数是上一个ListBox的selectedIndex,是从零开始的,所以在使用的时候先+1
         * */
        private void LoadListBox(int HId)
        {
            HId = HId + 1;
            List <TableInfoData> tableInfoDatas = TableInfoConnector.GetTableInfoDatas(HId);
            List <ListBoxItem>   listBoxItems   = new List <ListBoxItem>();
            TableStatus          tableStatus;

            foreach (var item in tableInfoDatas)
            {
                tableStatus = new TableStatus();
                tableStatus.TableName.Content = item.TTitle;
                tableStatus.tableStatus       = item.TIsFree;
                tableStatus.tableNumber       = item.TId;
                tableStatus.LockStatus.Source = tableStatus.tableStatus == 1 ? tableStatus.unlockImage : tableStatus.lockImage;
                ListBoxItem listBoxItem = new ListBoxItem();
                listBoxItem.Content           = tableStatus;
                listBoxItem.MouseDoubleClick += ListBox_MouseDoubleClick;
                listBoxItems.Add(listBoxItem);
            }
            tableList.ItemsSource = listBoxItems;
        }
Ejemplo n.º 9
0
        /*
         * 添加餐桌
         * 1. 餐桌名不能是空
         * 2. 同餐厅下餐桌名不能重复
         * 3. 未选择状态,默认空闲
         * */
        private void AddTableButton_Click(object sender, RoutedEventArgs e)
        {
            if (ModifyTableName.Text == "")
            {
                MessageBox.Show("未填写餐桌名");
                return;
            }
            int TIsFree;

            if (FreeRadio.IsChecked == true || (FreeRadio.IsChecked == false && NonFreeRadio.IsChecked == false))
            {
                TIsFree = 1;
            }
            else
            {
                TIsFree = 0;
            }
            int InsertResult = TableInfoConnector.InsertTable(ModifyTableName.Text, ModifyHallCombo.SelectedIndex + 1, TIsFree);

            if (InsertResult == -1)
            {
                MessageBox.Show("已存在的餐桌");
                return;
            }
            if (InsertResult == 1)
            {
                MessageBox.Show("插入成功");
                ModifyTableName.Text          = "";
                ModifyHallCombo.SelectedIndex = 0;
                LoadAllTables();
            }
            else
            {
                MessageBox.Show("插入失败");
            }
        }
Ejemplo n.º 10
0
        /**
         * 提交按钮事件
         * 提交数据库,修改桌号的状态
         * */
        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();
        }