예제 #1
0
        /// <summary>
        /// Updates the ECA system's social media data with the given updated social media.
        /// </summary>
        /// <param name="updatedSocialMedia">The updated social media.</param>
        public void Update(UpdatedSocialMediaPresence updatedSocialMedia)
        {
            var socialMedia = Context.SocialMedias.Find(updatedSocialMedia.Id);
            ParticipantPersonSevisDTO participant = null;

            if (socialMedia != null && socialMedia.PersonId.HasValue)
            {
                participant = GetParticipantByPersonId((int)socialMedia.PersonId);
            }
            DoUpdate(updatedSocialMedia, socialMedia, participant);
        }
예제 #2
0
        /// <summary>
        /// Updates the ECA system's social media data with the given updated social media.
        /// </summary>
        /// <param name="updatedSocialMedia">The updated social media.</param>
        public async Task UpdateAsync(UpdatedSocialMediaPresence updatedSocialMedia)
        {
            var socialMedia = await Context.SocialMedias.FindAsync(updatedSocialMedia.Id);

            ParticipantPersonSevisDTO participant = null;

            if (socialMedia != null && socialMedia.PersonId.HasValue)
            {
                participant = await GetParticipantByPersonIdAsync((int)socialMedia.PersonId);
            }
            DoUpdate(updatedSocialMedia, socialMedia, participant);
        }
예제 #3
0
        /// <summary>
        /// Updates the ECA system's social email address with the given updated email address.
        /// </summary>
        /// <param name="updatedEmailAddress">The updated email address.</param>
        public void Update(UpdatedEmailAddress updatedEmailAddress)
        {
            var emailAddress = Context.EmailAddresses.Find(updatedEmailAddress.Id);
            ParticipantPersonSevisDTO participant = null;

            if (emailAddress != null && emailAddress.PersonId.HasValue)
            {
                participant = GetParticipantByPersonId((int)emailAddress.PersonId);
            }
            List <EmailAddress> existingEmailAddresses = new List <EmailAddress>();

            if (emailAddress != null && updatedEmailAddress.IsPrimary)
            {
                existingEmailAddresses = CreateGetOtherEmailAddressesQuery(emailAddress).ToList();
            }
            DoUpdate(updatedEmailAddress, emailAddress, existingEmailAddresses, participant);
        }
예제 #4
0
        /// <summary>
        /// Updates the ECA system's phone number with the given updated phone number.
        /// </summary>
        /// <param name="updatedPhoneNumber">The updated phone number.</param>
        public void Update(UpdatedPhoneNumber updatedPhoneNumber)
        {
            var phoneNumber = Context.PhoneNumbers.Find(updatedPhoneNumber.Id);
            ParticipantPersonSevisDTO participant = null;

            if (phoneNumber != null && phoneNumber.PersonId.HasValue)
            {
                participant = GetParticipantByPersonId((int)phoneNumber.PersonId);
            }
            List <PhoneNumber> existingPhoneNumbers = new List <PhoneNumber>();

            if (phoneNumber != null && updatedPhoneNumber.IsPrimary)
            {
                existingPhoneNumbers = CreateGetOtherPhoneNumbersQuery(phoneNumber).ToList();
            }
            DoUpdate(updatedPhoneNumber, phoneNumber, existingPhoneNumbers, participant);
        }
예제 #5
0
 private void DoUpdate(UpdatedEmailAddress updatedEmailAddress, EmailAddress modelToUpdate,
                       List <EmailAddress> otherEmailAddresses, ParticipantPersonSevisDTO participant)
 {
     Contract.Requires(updatedEmailAddress != null, "The updatedEmailAddress must not be null.");
     throwIfEmailAddressNotFound(modelToUpdate, updatedEmailAddress.Id);
     if (participant != null)
     {
         throwValidationErrorIfParticipantSevisInfoIsLocked(participant);
     }
     modelToUpdate.EmailAddressTypeId = updatedEmailAddress.EmailAddressTypeId;
     modelToUpdate.Address            = updatedEmailAddress.Address;
     modelToUpdate.IsPrimary          = updatedEmailAddress.IsPrimary;
     updatedEmailAddress.Audit.SetHistory(modelToUpdate);
     if (updatedEmailAddress.IsPrimary)
     {
         otherEmailAddresses.ForEach(x => x.IsPrimary = false);
     }
 }
예제 #6
0
        /// <summary>
        /// Updates the ECA system's email address data with the given updated email address.
        /// </summary>
        /// <param name="updatedEmailAddress">The updated email address.</param>
        public async Task UpdateAsync(UpdatedEmailAddress updatedEmailAddress)
        {
            var emailAddress = await Context.EmailAddresses.FindAsync(updatedEmailAddress.Id);

            ParticipantPersonSevisDTO participant = null;

            if (emailAddress != null && emailAddress.PersonId.HasValue)
            {
                participant = await GetParticipantByPersonIdAsync((int)emailAddress.PersonId);
            }
            List <EmailAddress> existingEmailAddresses = new List <EmailAddress>();

            if (emailAddress != null && updatedEmailAddress.IsPrimary)
            {
                existingEmailAddresses = await CreateGetOtherEmailAddressesQuery(emailAddress).ToListAsync();
            }
            DoUpdate(updatedEmailAddress, emailAddress, existingEmailAddresses, participant);
        }
예제 #7
0
        /// <summary>
        /// Updates the ECA system's phone number data with the given updated phone number.
        /// </summary>
        /// <param name="updatedPhoneNumber">The updated phone number.</param>
        public async Task UpdateAsync(UpdatedPhoneNumber updatedPhoneNumber)
        {
            var phoneNumber = await Context.PhoneNumbers.FindAsync(updatedPhoneNumber.Id);

            ParticipantPersonSevisDTO participant = null;

            if (phoneNumber != null && phoneNumber.PersonId.HasValue)
            {
                participant = await GetParticipantByPersonIdAsync((int)phoneNumber.PersonId);
            }
            List <PhoneNumber> existingPhoneNumbers = new List <PhoneNumber>();

            if (phoneNumber != null && updatedPhoneNumber.IsPrimary)
            {
                existingPhoneNumbers = await CreateGetOtherPhoneNumbersQuery(phoneNumber).ToListAsync();
            }
            DoUpdate(updatedPhoneNumber, phoneNumber, existingPhoneNumbers, participant);
        }
예제 #8
0
 private void DoUpdate(UpdatedPhoneNumber updatedPhoneNumber, PhoneNumber modelToUpdate,
                       List <PhoneNumber> existingPhoneNumbers, ParticipantPersonSevisDTO participant)
 {
     Contract.Requires(updatedPhoneNumber != null, "The updatedPhoneNumber must not be null.");
     throwIfPhoneNumberNotFound(modelToUpdate, updatedPhoneNumber.Id);
     if (participant != null)
     {
         throwValidationErrorIfParticipantSevisInfoIsLocked(participant);
     }
     modelToUpdate.PhoneNumberTypeId = updatedPhoneNumber.PhoneNumberTypeId;
     modelToUpdate.Number            = updatedPhoneNumber.Number;
     modelToUpdate.Extension         = updatedPhoneNumber.Extension;
     modelToUpdate.IsPrimary         = updatedPhoneNumber.IsPrimary;
     updatedPhoneNumber.Audit.SetHistory(modelToUpdate);
     if (updatedPhoneNumber.IsPrimary)
     {
         existingPhoneNumbers.ForEach(x => x.IsPrimary = false);
     }
 }
예제 #9
0
 private void DoUpdate(UpdatedSocialMediaPresence updatedSocialMedia, SocialMedia modelToUpdate, ParticipantPersonSevisDTO participant)
 {
     Contract.Requires(updatedSocialMedia != null, "The updatedSocialMedia must not be null.");
     throwIfSocialMediaNotFound(modelToUpdate, updatedSocialMedia.Id);
     if (participant != null)
     {
         throwValidationErrorIfParticipantSevisInfoIsLocked(participant);
     }
     modelToUpdate.SocialMediaTypeId = updatedSocialMedia.SocialMediaTypeId;
     modelToUpdate.SocialMediaValue  = updatedSocialMedia.Value;
     updatedSocialMedia.Update.SetHistory(modelToUpdate);
 }