Example #1
0
        private void TGenerateRoomTypesFromReader <T>(SqlDataReader returnData, ref List <RoomTypes> roomTypes)
        {
            RoomTypes roomType = new RoomTypes();

            while (returnData.Read())
            {
                roomType.RoomType_ID      = returnData["RoomType_ID"] != DBNull.Value ? SqlInt32.Parse(returnData["roomType_ID"].ToString()) : 0;
                roomType.CreatedUser      = returnData["CreatedUser"] != DBNull.Value ? SqlInt32.Parse(returnData["CreatedUser"].ToString()) :0;
                roomType.LastModifiedUser = returnData["LastModifiedUser"] != DBNull.Value ? SqlInt32.Parse(returnData["LastModifiedUser"].ToString()) : 0;
                roomType.Description      = returnData["Description"] != DBNull.Value ? returnData["Description"].ToString() : string.Empty;
                roomType.CreatedDate      = returnData["CreatedDate"] != DBNull.Value ? SqlDateTime.Parse(returnData["CreatedDate"].ToString()) : DateTime.Today;
                roomType.LastModifiedDate = returnData["LastModifiedDate"] != DBNull.Value ? SqlDateTime.Parse(returnData["LastModifiedDate"].ToString()) : DateTime.Today;
                roomTypes.Add(roomType);
            }
        }