internal UpdateBirthdayEventForContact(IBirthdayEvent birthdayEvent, IBirthdayContact birthdayContact, IBirthdayEvents scope) { this.Trace.TraceDebug((long)this.GetHashCode(), "UpdateBirthdayEventForContact:Constructor"); this.BirthdayContact = birthdayContact; this.BirthdayEvent = birthdayEvent; this.Scope = scope; }
public BirthdayEventCommandResult OnContactAdded(IBirthdayContact birthdayContact, IStoreSession storeSession) { ExTraceGlobals.BirthdayAssistantBusinessLogicTracer.TraceDebug((long)this.GetHashCode(), "OnContactAdded"); BirthdayEventCommandResult birthdayEventCommandResult = this.OnContactAdded(birthdayContact, new BirthdaysContainer(storeSession, null)); ExTraceGlobals.BirthdayAssistantBusinessLogicTracer.TraceDebug <BirthdayEventCommandResult>((long)this.GetHashCode(), "OnContactAdded: birthday event is <{0}>", birthdayEventCommandResult); return(birthdayEventCommandResult); }
public BirthdayEventCommandResult OnContactModified(IBirthdayContact birthdayContact, IStoreSession storeSession) { ExTraceGlobals.BirthdayAssistantBusinessLogicTracer.TraceDebug((long)this.GetHashCode(), "OnContactModified: started"); BirthdaysContainer birthdaysContainer = new BirthdaysContainer(storeSession, null); BirthdayEventCommandResult result = this.OnContactModified(birthdayContact, birthdaysContainer); ExTraceGlobals.BirthdayAssistantBusinessLogicTracer.TraceDebug((long)this.GetHashCode(), "OnContactModified: finished"); return(result); }
internal BirthdayEventCommandResult OnContactModified(IBirthdayContact birthdayContact, IBirthdaysContainer birthdaysContainer) { IBirthdayContactInternal birthdayContactInternal = birthdayContact as IBirthdayContactInternal; if (birthdayContactInternal == null) { throw new ArgumentException("Argument must implement IBirthdayContactInternal", "birthdayContact"); } IEnumerable <IBirthdayContact> linkedContacts = birthdaysContainer.Contacts.GetLinkedContacts(birthdayContactInternal.PersonId); return(birthdaysContainer.Events.UpdateBirthdaysForLinkedContacts(linkedContacts)); }
internal DeleteBirthdayEventForContact(IBirthdayContact contact, IBirthdayEvents scope) { this.Trace.TraceDebug((long)this.GetHashCode(), "DeleteBirthdayEventForContact:Constructor/contact"); IBirthdayContactInternal birthdayContactInternal = contact as IBirthdayContactInternal; if (birthdayContactInternal == null) { throw new ArgumentException("Contact has to implement IBirthdayContactInternal", "contact"); } this.ContactStoreObjectId = StoreId.GetStoreObjectId(birthdayContactInternal.StoreId); this.Scope = scope; }
private IBirthdayEvent FindBirthdayEventForContact(IBirthdayContact contact) { IEnumerable <BirthdayEvent> enumerable = this.Scope.BirthdayEventDataProvider.FindBirthdayEventsForContact(contact); IBirthdayEvent result = null; if (enumerable != null) { BirthdayEvent[] array = (enumerable as BirthdayEvent[]) ?? enumerable.ToArray <BirthdayEvent>(); if (array.Length > 1) { this.Trace.TraceError((long)this.GetHashCode(), "Found multiple birthday events for a single contact."); this.Scope.BirthdayEventDataProvider.DeleteBirthdayEvents(array); } else { result = array.FirstOrDefault <BirthdayEvent>(); } } return(result); }
private BirthdayEvent CreateNewBirthdayEventForContact(IBirthdayContact contact) { if (contact == null || contact.Birthday == null) { this.Trace.TraceDebug <IBirthdayContact>((long)this.GetHashCode(), "CreateBirthdayEventForContact::CreateNewBirthdayEvent: don't need to create a birthday for contact {0}", this.Contact); return(null); } ExDateTime value = contact.Birthday.Value; this.Trace.TraceDebug <ExDateTime, TimeSpan>((long)this.GetHashCode(), "CreateBirthdayEventForContact::CreateNewBirthdayEvent: birthday value is {0}, time zone bias is {1}", value, value.Bias); BirthdayEvent birthdayEvent = new BirthdayEvent { Birthday = value, Subject = contact.DisplayName, Attribution = contact.Attribution, IsWritable = contact.IsWritable }; IBirthdayEventInternal birthdayEventInternal = birthdayEvent; IBirthdayContactInternal birthdayContactInternal = (IBirthdayContactInternal)this.Contact; birthdayEventInternal.PersonId = birthdayContactInternal.PersonId; birthdayEventInternal.ContactId = StoreId.GetStoreObjectId(birthdayContactInternal.StoreId); return(this.Scope.BirthdayEventDataProvider.CreateBirthday(birthdayEvent)); }
internal BirthdayEventCommandResult OnContactAdded(IBirthdayContact birthdayContact, IBirthdaysContainer birthdaysContainer) { return(birthdaysContainer.Events.CreateBirthdayEventForContact(birthdayContact)); }
public BirthdayEventCommandResult UpdateBirthdayEventForContact(IBirthdayEvent birthdayEvent, IBirthdayContact birthdayContact) { return(new UpdateBirthdayEventForContact(birthdayEvent, birthdayContact, this).ExecuteAndGetResult()); }
public BirthdayEventCommandResult CreateBirthdayEventForContact(IBirthdayContact contact) { return(new CreateBirthdayEventForContact(contact, this).ExecuteAndGetResult()); }
public virtual IEnumerable <BirthdayEvent> FindBirthdayEventsForContact(IBirthdayContact contact) { StoreObjectId storeObjectId = StoreId.GetStoreObjectId(((IBirthdayContactInternal)contact).StoreId); return(this.FindBirthdayEventsForContactId(storeObjectId)); }