For this I have used Login Stored Procedure..
The login stored procedure is run immediately after the user has logged on to SQL Server and opened a database and before Microsoft Dynamics NAV carries out any tasks including executing any C/AL triggers. The user must have successfully logged on to the server and have access to the database before the stored procedure is run.
You can find more details here
http://mibuso.com/blogs/mohana/2011/07/20/login-stored-procedure-on-the-sql-server-option/
Similarly we can use this stored procedure to send messages to users and check conditions and show error messages..
Thanks