Exemple #1
0
        public void Update(
            ILogger logger,
            ContactPerson sourcePowerofficeContactPerson,
            long sourcePowerofficeCustomerId,
            int webcrmOrganisationId,
            PowerofficeConfiguration configuration)
        {
            PersonDirectPhone      = sourcePowerofficeContactPerson.PhoneNumber;
            PersonEmail            = sourcePowerofficeContactPerson.EmailAddress;
            PersonFirstName        = sourcePowerofficeContactPerson.FirstName;
            PersonAdjustedLastName = sourcePowerofficeContactPerson.LastName;

            // It is not allowed to change the organisation ID of a person.
            if (PersonOrganisationId == null)
            {
                PersonOrganisationId = webcrmOrganisationId;
            }
            else if (PersonOrganisationId != webcrmOrganisationId)
            {
                logger.LogWarning($"The PowerOffice contact person with ID '{sourcePowerofficeContactPerson.Id}' has changed webCRM organisation from '{PersonOrganisationId}' to '{webcrmOrganisationId}'. We cannot change the organisation ID through the API, so this is not synchronised.");
            }

            var personKey = new PowerofficePersonKey(sourcePowerofficeCustomerId, sourcePowerofficeContactPerson.Id);

            SetPowerofficePersonKey(configuration.PersonIdFieldName, personKey);

            MarkAsPrimaryContact(configuration.PrimaryContactCheckboxFieldName);
        }
Exemple #2
0
        public PowerofficePersonKey GetPowerofficePersonKey(
            ILogger logger,
            string personIdFieldName)
        {
            string personKeyString = this.GetPropertyValue(personIdFieldName);

            if (string.IsNullOrWhiteSpace(personKeyString))
            {
                return(null);
            }

            return(PowerofficePersonKey.Create(logger, personKeyString));
        }
Exemple #3
0
 public void SetPowerofficePersonKey(
     string personIdFieldName,
     PowerofficePersonKey personKey)
 {
     this.SetPropertyValue(personIdFieldName, personKey.ToString());
 }