コード例 #1
0
        //获得用户未读信息的数量4 Ok
        public Dictionary<MessageType, int> GetUserUreadMessagesNum(String UserID)
        {
            //存储用户信息数量的字典
            Dictionary<MessageType, int> MessageNumDictionary = new Dictionary<MessageType, int>();
            //数据访存器
            DatabaseAccess.DataClasses1DataContext DBAccessor = new DataClasses1DataContext();

            int PrivateMessageNum = 0;
            int PublicMessageNum = 0;
            int CommentNum = 0;

            try
            {
                PrivateMessageNum = DBAccessor.getNumPrivateMessageByUser(UserID);
                PublicMessageNum = DBAccessor.getNumPublicMessageByUserName(UserID);
                CommentNum = DBAccessor.getNumCommentByUser(UserID);
            }
            catch (Exception e)
            {

            }

            MessageNumDictionary.Add(MessageType.PrivateMessage, PrivateMessageNum);
            MessageNumDictionary.Add(MessageType.publicMessage, PublicMessageNum);
            MessageNumDictionary.Add(MessageType.comment, CommentNum);

            return MessageNumDictionary;
        }