//获得用户的未读留言7 OK public List<Message> GetUserUreadPublicMessages(String UserID) { List<Message> PublicMessagesList = new List<Message>(); //数据访存器 DatabaseAccess.DataClasses1DataContext DBAccessor = new DataClasses1DataContext(); try { ISingleResult<getUnreadPublicMessageByUserResult> resultList = DBAccessor.getUnreadPublicMessageByUser(UserID); //获得留言列表 foreach (getUnreadPublicMessageByUserResult result in resultList) { Message message = new Message(); message.ID = result.id; message.messageType = MessageType.publicMessage; message.content = result.content; message.state = MessageState.Unread; //发留言的用户的信息 message.userFrom.UserName = result.userfrom; //发留言户的信息 ISingleResult<getUserByUserNameResult> UserInfoList = DBAccessor.getUserByUserName(result.userfrom); foreach (getUserByUserNameResult UserInfo in UserInfoList) { message.userFrom.NickName = UserInfo.nickname; message.userFrom.Phone = UserInfo.phone; message.userFrom.Address = UserInfo.address; message.userFrom.Email = UserInfo.email; message.userFrom.City = UserInfo.city; message.userFrom.Portrait = UserInfo.portraitPath; } PublicMessagesList.Add(message); } } catch (Exception e) { } return PublicMessagesList; }