Hie, I understood about the problem with this chat system. Kindly follow the following steps. Before that let me mention that you don't need to award me this project and you can trust on the following mechanism. I can't code this for you because i am not perfect at C#, I have just basic knowledge, but whatever i will be mentioning here will give you complete working solution if you can implement in C#. Ok as follows -
For Database ( Backend )
1) Create Table
users
(Uid, Username etc., Time Zone [important])
messages
(Message_ID, Sender_Uid, Reciever_Uid, Timestamp)
message-content
(Message_ID, Message_content)
2) To List Users the person has chatted use following query
Select DISTINCT Reciever_Uid FROM messages WHERE Sender_Uid = id_of_user
Also Include
Select DISTINCT Sender_Uid FROM messages WHERE Reciever_Uid = id_of_user
Merge Them and show in List Box, Id or name
3) To list all chat date wise
Select Message_ID from messages where Sender_Uid = id_of_user or Reciever_uid = id_of_user ORDER BY Timestamp ASC LIMIT put_limit_of_message
Further optimizations can be made after some trail error by simulating load on server or if scenario is understood properly.
Regards,
Darpan
(Do Invite for any big project if you feel)