Ejemplo n.º 1
0
        public DisplayEmail(IMessage mail)
        {
            try
            {
                var recipients = new List<EmailAddress>();
                if (mail.ToRecipients != null)
                {
                    foreach (var r in mail.ToRecipients)
                        recipients.Add(new EmailAddress(r.EmailAddress));
                }

                if (mail.CcRecipients != null)
                {
                    foreach (var r in mail.CcRecipients)
                        recipients.Add(new EmailAddress(r.EmailAddress));
                }

                if (mail.Sender != null)
                {
                    Sender = new EmailAddress(mail.Sender.EmailAddress);
                }
                if (mail.SentDateTime != null)
                {
                    Sent = mail.SentDateTime.Value;
                }
                Subject = mail.Subject;
                Recepients = recipients;
            }
            catch { }
        }
Ejemplo n.º 2
0
        public DisplayEvent(Recipient organizer, bool? isOrganizer, string subject, ResponseStatus status, string start, string end, IList<Attendee> attendees)
        {
            if (organizer != null && organizer.EmailAddress != null) Organizer = new EmailAddress(organizer.EmailAddress);
            if (isOrganizer != null && isOrganizer.Value) IsOrganizer = isOrganizer.Value;
            Subject = subject;
            Start = DateTime.Parse(start);
            End = DateTime.Parse(end);
            Attendees = new List<string>();

            foreach (var attendee in attendees)
            {
                try
                {
                    //if (attendee.Status == ResponseStatus.Equals)   cannot use it as it's always null
                    Attendees.Add(attendee.EmailAddress.Address);
                }
                catch { }
            }

            try
            {
                DurationInMins = (int)Math.Round(Math.Abs((End - Start).TotalMinutes), 0);
            }
            catch { }

            ResponseStatus = status.Response;
        }