예제 #1
0
        public T RetrieveByRoomNumber <T>(Room room)
        {
            var roomMapper = new RoomMapper();

            try
            {
                var instance  = SqlDao.GetInstance();
                var operation = roomMapper.GetRetrieveByRoomNumberStatement(room.IdHotel, room.RoomNumber);
                var lstResult = instance.ExecuteQueryProcedure(operation);

                if (lstResult.Count <= 0)
                {
                    return(default(T));
                }

                var objs = EntityObjectMapper.BuildObjects(lstResult);

                return(objs.Cast <T>().ToList()[0]);
            }
            catch (Exception e)
            {
                ManageException(e);
            }

            return(default(T));
        }