예제 #1
0
        public static PrivateMessageComplexViewData Create(PrivateMessage privateMessage)
        {
            var incomeMessage = privateMessage as IncomePrivateMessage;

            if (incomeMessage != null)
            {
                return new PrivateMessageComplexViewData
                       {
                           IncomeMessageData = IncomePrivateMessageViewData.Create(incomeMessage)
                       }
            }
            ;
            var sentMessage = privateMessage as SentPrivateMessage;

            if (sentMessage != null)
            {
                return new PrivateMessageComplexViewData
                       {
                           SentMessageData = SentPrivateMessageViewData.Create(sentMessage)
                       }
            }
            ;
            throw new ChalkableException("Not supported private message type.");
        }
    }
}
예제 #2
0
        public static SentPrivateMessageViewData Create(SentPrivateMessage message)
        {
            var res = new SentPrivateMessageViewData(message)
            {
                DeletedBySender = message.DeletedBySender,
                AllRecipients   = ShortPersonViewData.Create(message.RecipientPersons)
            };

            if (message.RecipientClass != null)
            {
                res.RecipientClass = ShortClassViewData.Create(message.RecipientClass);
            }
            if (message.RecipientPersons.Count == 1)
            {
                res.RecipientPerson = ShortPersonViewData.Create(message.RecipientPersons[0]);
            }
            return(res);
        }