views:

43

answers:

2

In my asp.net MVC app, I'm planning a user notification system similar to SO's. Here's the table structure I'm thinking of:

Message table
--------------------------------
PK  MsgId     BigInt
FK  UserId    UniqueIdentifier
    Body      nvarchar(200)
    IsRead    TinyInt
    DateSent  DateTime

First, does this DB structure look ok? is there a better way?

A ribbon at the top will show the user has unread messages. The message automatically becomes read when the user visits that message's page (no need to click a "mark as read" button. [changes the IsRead field to 1]

Building the ribbon to always be visible when there is an unread message is easy. How do you build it to let the user hide the ribbon, even if they have unread messages - and then NOT load the ribbon on the next internal page the user visits?

+1  A: 

There are many jquery plugins that allow you to have this nice animated notification bar such as jGrowl and jBar. Just pick one of them, try it and if you have problems implementing it don't hesitate to ask.

Darin Dimitrov
Do jBar or jGrowl handle the issue of not showing the ribbon when the user closes it (even with unread messages)? Preventing the ribbon from popping up on every other page visit...
Chad
+2  A: 

I would add a flag something like "IsAcknowledged", so you can show the ribbon only if !IsRead && !IsAcknowledged then use AJAX to update the flag when the user clicks the "x", or whatever. that way the IsRead flag is maintained so when the user chooses to see his messages you still know which ones haven't been read.

also, not sure what DBMS you're using, but for boolean fields in MSSQL I like to use the bit type.

dave thieben
Oh ya, sorry... it would be a bit type - not sure why I wrote tinyint. ;D Good call on the IsAcknowledged field... I had a "duh!" moment just now. Thanks a ton.
Chad