コード例 #1
0
        /// <summary>
        /// 根据阅览室获取座位,不填默认不做条件判断
        /// </summary>
        /// <param name="roomNum">阅览室编号</param>
        /// <param name="lockstate">锁定状态</param>
        /// <param name="state">座位状态</param>
        /// <returns></returns>
        public List <Seat> GetSeatListByReadingRoom(string roomNum, bool lockstate)
        {
            StringBuilder strWhere = new StringBuilder();

            if (!string.IsNullOrEmpty(roomNum))
            {
                if (String.IsNullOrEmpty(strWhere.ToString()))
                {
                    strWhere.Append(string.Format(" readingRoomNo='{0}'", roomNum));
                }
                else
                {
                    strWhere.Append(string.Format(" and readingRoomNo='{0}'", roomNum));
                }
            }
            if (String.IsNullOrEmpty(strWhere.ToString()))
            {
                if (lockstate)
                {
                    strWhere.Append(" IsLock='1'");
                }
                else
                {
                    strWhere.Append(" IsLock='0'");
                }
            }
            else
            {
                if (lockstate)
                {
                    strWhere.Append(" and IsLock='1'");
                }
                else
                {
                    strWhere.Append(" and IsLock='0'");
                }
            }
            DataSet     ds = t_sm_seat.GetList(strWhere.ToString(), null);
            List <Seat> ls = new List <Seat>();

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    ls.Add(DataRowToSeatModel(dr));
                }
            }
            return(ls);
        }