Exemple #1
0
        /// <summary>
        /// Loads the room with the specified unique identifier from the database
        /// </summary>
        /// <param name="conn">Open connection to the database</param>
        /// <param name="roomId">Unique identifier of the room</param>
        /// <returns>Room with the specified unique identifier, loaded from the database</returns>
        internal static Business.Room GetRoomById(SqlConnection conn, Int32 roomId)
        {
            try
            {
                sql.SqlCommand cmd = new sql.SqlCommand("GetRoomById", conn);
                cmd.Parameters.AddWithValue("RoomId", DbType.Int32, roomId);

                return(cmd.ExecuteMappedSingleReader <Business.Room, Int32>());
            }
            catch (System.Exception e)
            {
                throw new SpecifiedSqlDbObjectNotFoundException("Could not load room.", e);
            }
        }
        /// <summary>
        /// Loads the invite with the specified unique identifier from the database
        /// </summary>
        /// <param name="conn">Open connection to the database</param>
        /// <param name="inviteId">Unique identifier of the invite</param>
        /// <returns>Invite with the specified unique identifier, loaded from the database</returns>
        public static Business.Invite GetInviteById(SqlConnection conn, Int32 inviteId)
        {
            try
            {
                sql.SqlCommand cmd = new sql.SqlCommand("GetInviteById", conn);
                cmd.Parameters.AddWithValue("InviteId", DbType.Int32, inviteId);

                return(cmd.ExecuteMappedSingleReader <Business.Invite, Int32>());
            }
            catch (System.Exception e)
            {
                throw new SpecifiedSqlDbObjectNotFoundException("Could not load invite", e);
            }
        }
Exemple #3
0
        /// <summary>
        /// Loads a video from the database
        /// </summary>
        /// <param name="conn">Open connection to the database</param>
        /// <param name="videoId">Unique identifier of the video being loaded</param>
        /// <returns>Video object loaded from the database</returns>
        public static Business.Video GetVideoById(SqlConnection conn, Int64 videoId)
        {
            try
            {
                sql.SqlCommand cmd = new sql.SqlCommand("GetVideoById", conn);
                cmd.Parameters.AddWithValue("VideoId", DbType.Int64, videoId);

                return(cmd.ExecuteMappedSingleReader <Business.Video>(row => Business.MediaItem.FromDataRow(conn, row) as Business.Video));
            }
            catch (System.Exception e)
            {
                throw new SpecifiedSqlDbObjectNotFoundException("Could not load specified video", e);
            }
        }