示例#1
0
        public List <Room> getAllRoom()
        {
            DataTable   dtInput = rDB.getAll();
            List <Room> ansList = new List <Room>();
            DateTime    d       = DateTime.Now;

            foreach (DataRow dr in dtInput.Rows)
            {
                string ID = (dr["roomID"]).ToString();  // Beware of the possible conversion errors due to type mismatches
                Console.WriteLine(ID);
                int status;
                if (checkStatus(ID, d))
                {
                    status = 1;
                }
                else
                {
                    status = 0;
                }
                int    num  = (int)dr["numPerson"];
                string type = dr["roomtypeID"].ToString();

                ansList.Add(new Room(ID, status, num, type));
            }
            return(ansList);
        }