Click here to Skip to main content
15,908,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Code Project

I'm creating a system that has a mailbox function in it. Users can send a message it is then saved in the database. I have columns specifying who sent the message and who it is for. Now I'm looking to add that when a user logs in he/she will be notified of how many new message they have received since the last log on. Im using a tab container for my compose mail, inbox, sent and draft. my website is coded in C# and using SQL Server 2008 R2

Your help will be highly appreciated.

Regards
Sibongiseni Khumalo
Posted

1.Have a time stamp for the incomming emails

2.Have a time log for the last time they have logged off

3.When the user logs in next time, you can retrive the new emails received since the last log off.

Hope this helps and post your code, if you needs any specific help highlighting which line of your code is causing problem.
 
Share this answer
 
The implementation of this is specific to your program and will have to make it.
But to retrieve the number of new messages since the last login you can use a query which would look something like
SQL
SELECT COUNT(*) FROM <email table> WHERE DATEDIFF(minute,<datereceived>,<datelastlogon>) > 0

This supposes that you both store the last login time for a user and the time a message is received.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900