Ejemplo n.º 1
0
        /// <summary>
        /// Gets the number of unread messages that belong to the invite with the specified unique identifier
        /// </summary>
        /// <param name="conn">Open connection to the database</param>
        /// <param name="inviteId">Unique identifier of the invite</param>
        /// <param name="isRequesterAdmin">Value determining whether or not the invite requesting the messages is an admin user</param>
        /// <returns>Number of unread messages that belong to the invite with the specified unique identifier</returns>
        internal static Int32 GetInviteUnreadMessageCount(SqlConnection conn, Int32 inviteId, Boolean isRequesterAdmin)
        {
            sql.SqlCommand cmd = new sql.SqlCommand("GetInviteUnreadMessageCount", conn);
            cmd.Parameters.AddWithValue("InviteId", DbType.Int32, inviteId);
            cmd.Parameters.AddWithValue("IsRequesterAdmin", DbType.Boolean, isRequesterAdmin);

            return(cmd.ExecuteScalar <Int32>());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a guest to the database
        /// </summary>
        /// <param name="conn">Open connection to the database</param>
        /// <param name="inviteId">Unique identifier of the invite the guest is a member of</param>
        /// <param name="guest">Guest being added to the database</param>
        /// <returns>Unique identifier of the guest, generated by the database</returns>
        public static Int32 AddGuest(SqlConnection conn, Int32 inviteId, Business.Guest guest)
        {
            try
            {
                sql.SqlCommand cmd = new sql.SqlCommand("AddGuest", conn);
                cmd.Parameters.AddRange(guest.GetParametersForStoredProcedure(inviteId, false));

                return(cmd.ExecuteScalar <Int32>());
            }
            catch (System.Exception e)
            {
                throw new AddSqlDbObjectException("Could not add guest", e);
            }
        }