コード例 #1
0
ファイル: ManualLink.cs プロジェクト: YHZX2013/exchange_diff
 public void RejectSuggestion(MailboxSession session, PersonId personId, PersonId suggestionPersonId)
 {
     Util.ThrowOnNullArgument(session, "session");
     Util.ThrowOnNullArgument(personId, "personId");
     Util.ThrowOnNullArgument(suggestionPersonId, "suggestionPersonId");
     base.PerformanceTracker.Start();
     try
     {
         if (personId.Equals(suggestionPersonId))
         {
             throw new InvalidParamException(ServerStrings.RejectedSuggestionPersonIdSameAsPersonId);
         }
         base.LogEvent(new SchemaBasedLogEvent <ContactLinkingLogSchema.RejectSuggestion>
         {
             {
                 ContactLinkingLogSchema.RejectSuggestion.PersonId,
                 personId
             },
             {
                 ContactLinkingLogSchema.RejectSuggestion.SuggestionPersonId,
                 suggestionPersonId
             }
         });
         IList <ContactInfoForLinking> list  = this.QueryPersonContacts(session, personId);
         IList <ContactInfoForLinking> list2 = this.QueryPersonContacts(session, suggestionPersonId);
         this.RejectSuggestion(personId, list, suggestionPersonId, list2);
         base.Commit(list);
         base.Commit(list2);
     }
     finally
     {
         base.PerformanceTracker.Stop();
         base.LogEvent(base.PerformanceTracker.GetLogEvent());
     }
 }
コード例 #2
0
 public override void ContactAddedToPerson(PersonId personId, ContactInfoForLinking contact)
 {
     Util.ThrowOnNullArgument(personId, "personId");
     Util.ThrowOnNullArgument(contact, "contact");
     if (!personId.Equals(contact.PersonId))
     {
         ContactStoreForBulkContactLinking.Tracer.TraceDebug <PersonId, PersonId>((long)this.GetHashCode(), "ContactStoreForBulkContactLinking.ContactAddedToPerson: PersonId of the contact is not properly set. Found {0}. Expected {1}", contact.PersonId, personId);
         throw new InvalidOperationException("ContactStoreForBulkContactLinking.ContactAddedToPerson: PersonId of the contact is not properly set.");
     }
     if (contact is ContactInfoForLinkingFromCoreObject)
     {
         ContactStoreForBulkContactLinking.Tracer.TraceDebug <VersionedId, PersonId>((long)this.GetHashCode(), "ContactStoreForBulkContactLinking.ContactAddedToPerson: contact not added to contactsByPersonId as it is object being saved. ItemId {0}, PersonId {1}", contact.ItemId, contact.PersonId);
         return;
     }
     if (!this.initializedWorkingSet)
     {
         this.InitializeWorkingSet();
     }
     this.AddToContactsByPersonId(contact);
 }
コード例 #3
0
ファイル: ManualLink.cs プロジェクト: YHZX2013/exchange_diff
 public void Link(MailboxSession session, PersonId linkingPersonId, PersonId linkToPersonId)
 {
     Util.ThrowOnNullArgument(session, "session");
     Util.ThrowOnNullArgument(linkingPersonId, "linkingPersonId");
     Util.ThrowOnNullArgument(linkToPersonId, "linkToPersonId");
     base.PerformanceTracker.Start();
     try
     {
         if (linkingPersonId.Equals(linkToPersonId))
         {
             ContactLink.Tracer.TraceDebug <PersonId>((long)this.GetHashCode(), "ManualLink.Link: ignoring link operation because linkingPersonId and linkToPerson are the same person: {0}", linkToPersonId);
         }
         else
         {
             IList <ContactInfoForLinking> list = this.QueryPersonContacts(session, linkingPersonId);
             if (list.Count == 0)
             {
                 ContactLink.Tracer.TraceError <PersonId>((long)this.GetHashCode(), "ManualLink.Link: no contacts for PersonId={0} can be found", linkingPersonId);
                 throw new ObjectNotFoundException(ServerStrings.ExItemNotFound);
             }
             IList <ContactInfoForLinking> list2 = this.QueryPersonContacts(session, linkToPersonId);
             if (list2.Count == 0)
             {
                 ContactLink.Tracer.TraceError <PersonId>((long)this.GetHashCode(), "ManualLink.Link: no contacts for PersonId={0} can be found", linkToPersonId);
                 throw new ObjectNotFoundException(ServerStrings.ExItemNotFound);
             }
             if (list.Count + list2.Count > AutomaticLink.MaximumNumberOfContactsPerPerson.Value)
             {
                 ContactLink.Tracer.TraceError((long)this.GetHashCode(), "ManualLink.Link: Can't link Personas as their aggregated contact count exceeds maximum allowed. Persona {0}: {1}. Persona {2}: {3}", new object[]
                 {
                     linkingPersonId,
                     list.Count,
                     linkToPersonId,
                     list2.Count
                 });
                 throw new InvalidOperationException(ServerStrings.ContactLinkingMaximumNumberOfContactsPerPersonError);
             }
             bool flag  = ManualLink.IsGALLinked(list);
             bool flag2 = ManualLink.IsGALLinked(list2);
             if (flag && flag2 && list[0].GALLinkID != list2[0].GALLinkID)
             {
                 throw new InvalidOperationException(ServerStrings.PersonIsAlreadyLinkedWithGALContact);
             }
             base.LogEvent(new SchemaBasedLogEvent <ContactLinkingLogSchema.ContactLinking>
             {
                 {
                     ContactLinkingLogSchema.ContactLinking.LinkOperation,
                     ContactLinkingOperation.ManualLinking
                 },
                 {
                     ContactLinkingLogSchema.ContactLinking.LinkingPersonId,
                     linkingPersonId
                 },
                 {
                     ContactLinkingLogSchema.ContactLinking.LinkToPersonId,
                     linkToPersonId
                 }
             });
             ContactInfoForLinking galContact = flag ? list[0] : (flag2 ? list2[0] : null);
             this.LinkContacts(list, list2, galContact);
             base.Commit(list);
             base.Commit(list2);
         }
     }
     finally
     {
         base.PerformanceTracker.Stop();
         base.LogEvent(base.PerformanceTracker.GetLogEvent());
     }
 }