コード例 #1
0
        //模糊查询餐桌信息
        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);
        }
コード例 #2
0
        /*
         * 通过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);
        }
コード例 #3
0
        /*
         * 通过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);
        }