//模糊查询餐桌信息
        public static List <TableInfoData> GetTableInfoDatas(String TTitle, int HId)
        {
            String          connectStr = ConnectorInfo.connectStr;
            MySqlConnection conn       = new MySqlConnection(connectStr);

            conn.Open();

            List <TableInfoData> tableInfoDatas = new List <TableInfoData>();

            String sql = "select * from tableinfo where TTitle like '" + TTitle + "%'" +
                         (HId == 0 ? "" : ("and HId=" + HId));
            MySqlCommand    mySqlCommand    = new MySqlCommand(sql, conn);
            MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();

            while (mySqlDataReader.Read())
            {
                TableInfoData tableInfoData = new TableInfoData(mySqlDataReader.GetInt32("TId"),
                                                                mySqlDataReader.GetString("TTitle"),
                                                                HallInfoConnector.GetHallInfoDataByHId(mySqlDataReader.GetInt32("HId")),
                                                                mySqlDataReader.GetInt16("TIsFree"));
                tableInfoDatas.Add(tableInfoData);
            }

            return(tableInfoDatas);
        }
 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;
 }
        /*
         * 通过TId返回餐桌信息
         * */
        public static TableInfoData GetTable(int TId)
        {
            String          connectStr = ConnectorInfo.connectStr;
            MySqlConnection conn       = new MySqlConnection(connectStr);

            conn.Open();
            String          sql             = "select * from tableinfo where TId='" + TId + "'";
            MySqlCommand    mySqlCommand    = new MySqlCommand(sql, conn);
            MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();

            mySqlDataReader.Read();
            TableInfoData tableInfo = new TableInfoData(mySqlDataReader.GetInt32("TId"),
                                                        mySqlDataReader.GetString("TTitle"),
                                                        HallInfoConnector.GetHallInfoDataByHId(mySqlDataReader.GetInt32("HId")),
                                                        mySqlDataReader.GetInt16("TIsFree"));

            return(tableInfo);
        }
        /*
         * 通过HId返回该房间内的所有餐桌信息
         * */
        public static List <TableInfoData> GetTableInfoDatas(int HId)
        {
            List <TableInfoData> tableInfoDatas = new List <TableInfoData>();
            TableInfoData        tableInfoData;
            String          connectStr = ConnectorInfo.connectStr;
            MySqlConnection conn       = new MySqlConnection(connectStr);

            conn.Open();
            String          sql             = "select * from tableinfo where HId='" + HId + "'";
            MySqlCommand    mySqlCommand    = new MySqlCommand(sql, conn);
            MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();

            while (mySqlDataReader.Read())
            {
                tableInfoData = new TableInfoData(mySqlDataReader.GetInt32("TId"),
                                                  mySqlDataReader.GetString("TTitle"),
                                                  HallInfoConnector.GetHallInfoDataByHId(HId),
                                                  mySqlDataReader.GetInt16("TIsFree"));
                tableInfoDatas.Add(tableInfoData);
            }
            return(tableInfoDatas);
        }