// Token: 0x060000EF RID: 239 RVA: 0x00005A6C File Offset: 0x00003C6C
        private static void HandleContact(MapiEvent mapiEvent, MailboxSession mailboxSession, IStoreObject contactStoreObject, Trace tracer)
        {
            tracer.TraceDebug(0L, "BirthdayAssistant:HandleContact enter");
            BirthdayAssistantBusinessLogic birthdayAssistantBusinessLogic = new BirthdayAssistantBusinessLogic();

            if (Globals.IsStoreObjectDeleted(mapiEvent, mailboxSession, contactStoreObject))
            {
                tracer.TraceDebug(0L, "BirthdayAssistant:HandleContact: contact was deleted");
                StoreObjectId birthdayContactStoreObjectId = StoreObjectId.FromProviderSpecificId(mapiEvent.OldItemEntryId, StoreObjectType.Contact);
                birthdayAssistantBusinessLogic.OnContactDeleted(birthdayContactStoreObjectId, mailboxSession);
            }
            else if ((mapiEvent.EventMask & MapiEventTypeFlags.ObjectCreated) != (MapiEventTypeFlags)0)
            {
                tracer.TraceDebug(0L, "BirthdayAssistant:HandleContact: contact was created");
                BirthdayContact birthdayContact = BirthdayContactTranslator.Instance.ConvertToEntity(contactStoreObject as IContact);
                tracer.TraceDebug(0L, "BirthdayAssistant:HandleContact: converted contact to entity");
                birthdayAssistantBusinessLogic.OnContactAdded(birthdayContact, mailboxSession);
            }
            else if ((mapiEvent.EventMask & MapiEventTypeFlags.ObjectModified) != (MapiEventTypeFlags)0)
            {
                tracer.TraceDebug(0L, "BirthdayAssistant:HandleContact: contact was modified");
                BirthdayContact birthdayContact2 = BirthdayContactTranslator.Instance.ConvertToEntity(contactStoreObject as IContact);
                birthdayAssistantBusinessLogic.OnContactModified(birthdayContact2, mailboxSession);
            }
            else
            {
                tracer.TraceDebug <MapiEvent>(0L, "BirthdayAssistant:HandleContact: no-op for MAPI event {0}", mapiEvent);
            }
            tracer.TraceDebug(0L, "BirthdayAssistant:HandleContact exit");
        }
Exemplo n.º 2
0
 public PhoneContactViewModel(BirthdayContact contact)
     : base(contact)
 {
     _log              = KernelService.Kernel.Get <ILoggingService>();
     CallHomeCommand   = new RelayCommand(CallHome);
     CallMobileCommand = new RelayCommand(CallMobile);
     CallWorkCommand   = new RelayCommand(CallWork);
     SendSMSCommand    = new RelayCommand(SendSMS);
     SendEmailCommand  = new RelayCommand(SendEmail);
     ShareCommand      = new RelayCommand(Share);
 }
 public BirthdayTileFrontViewModel(BirthdayContact contact, byte[] picture)
 {
     if (contact != null)
     {
         Name      = contact.DisplayName;
         Birthdate = contact.Date.ToString("M");
         Age       = contact.Age;
     }
     if (picture != null)
     {
         ContactImage = picture;
     }
 }
Exemplo n.º 4
0
 public ContactViewModel(BirthdayContact contact)
 {
     _contact    = contact;
     FirstName   = contact.FirstName;
     LastName    = contact.LastName;
     DisplayName = contact.DisplayName;
     Date        = contact.Date;
     HomePhone   = contact.HomePhone;
     MobilePhone = contact.MobilePhone;
     WorkPhone   = contact.WorkPhone;
     Email       = contact.Email;
     DaysUntil   = contact.DaysUntil;
     DaysSince   = contact.DaysSince;
     Age         = contact.Age;
 }
        public static BirthdayContact GetBirthdayContact(this Contact item)
        {
            BirthdayContact c = new BirthdayContact();

            c.Date        = DateTime.SpecifyKind(item.Birthdays.FirstOrDefault(), DateTimeKind.Utc);
            c.DisplayName = item.DisplayName;
            c.Email       = item.EmailAddresses.FirstOrDefault() == null ? null : item.EmailAddresses.FirstOrDefault().EmailAddress;
            c.FirstName   = item.CompleteName != null && item.CompleteName.FirstName != null ? item.CompleteName.FirstName : "";
            c.LastName    = item.CompleteName != null && item.CompleteName.LastName != null ? item.CompleteName.LastName : "";
            c.MobilePhone = item.PhoneNumbers.Where(it => it.Kind == PhoneNumberKind.Mobile).Any() ? item.PhoneNumbers.Where(it => it.Kind == PhoneNumberKind.Mobile).FirstOrDefault().PhoneNumber : null;
            c.HomePhone   = item.PhoneNumbers.Where(it => it.Kind == PhoneNumberKind.Home).Any() ? item.PhoneNumbers.Where(it => it.Kind == PhoneNumberKind.Home).FirstOrDefault().PhoneNumber : null;
            c.WorkPhone   = item.PhoneNumbers.Where(it => it.Kind == PhoneNumberKind.Work).Any() ? item.PhoneNumbers.Where(it => it.Kind == PhoneNumberKind.Work).FirstOrDefault().PhoneNumber : null;

            return(c);
        }