Beispiel #1
0
        public static List<MessageWithRecipient> GetMessageByAccountID(Int64 AccountID, Int32 PageNumber, MessageFolders Folder)
        {
            var query = (from r in MessageRecipient.All()
                         join m in Messages.All() on r.MessageID equals m.MessageID
                         join a in Account.All() on m.SentByAccountID equals a.AccountID
                         where r.AccountID == AccountID && r.MessageFolderID == (int)Folder
                         orderby m.CreateDate descending
                         select new
                         {
                             Sender = a,
                             Message = m,
                             MessageRecipient = r
                         }).Skip((PageNumber - 1) * 10).Take(10);

            List<MessageWithRecipient> list = new List<MessageWithRecipient>();
            foreach (var item in query)
            {
                MessageWithRecipient m = new MessageWithRecipient();
                m.Sender = item.Sender;
                m.Message = item.Message;
                m.MessageRecipient = item.MessageRecipient;
                list.Add(m);
            }
            return list;
        }
Beispiel #2
0
        public static MessageWithRecipient GetMessageByMessageID(Int32 MessageID, Int32 RecipientAccountID)
        {


            var message = (from r in MessageRecipient.All()
                           join m in All() on r.MessageID equals m.MessageID
                           join a in Account.All() on m.SentByAccountID equals a.AccountID
                           where r.AccountID == RecipientAccountID &&
                           m.MessageID == MessageID
                           where r.AccountID == RecipientAccountID && m.MessageID == MessageID
                           select new
                           {
                               Sender = a,
                               Message = m,
                               MessageRecipient = r
                           }).FirstOrDefault();

            MessageWithRecipient mr = new MessageWithRecipient();
            mr.Sender = message.Sender;
            mr.Message = message.Message;
            mr.MessageRecipient = message.MessageRecipient;

            return mr;
        }
Beispiel #3
0
 public void LoadReply(MessageWithRecipient message)
 {
     txtSubject.Text = "RE: " + message.Message.Subject;
     txtTo.Text = message.Sender.Username;
     txtMessage.Value = "<BR><BR><HR>Gửi từ ngày: " + message.Message.CreateDate.ToString() + "<BR>Tiêu đề: " + message.Message.Subject + "<BR>Nội dung: " + message.Message.Body;
 }