コード例 #1
0
        protected of.data.Contact Get_or_create_of_contact(crm.Contact crm_contact)
        {
            of.data.Contact of_contact = null;

            if (crm_contact.nrq_of_id.HasValue)
            {
                of_contact = _of_connection.Contact.Get(crm_contact.nrq_of_id.Value);
            }
            else
            {
                of_contact = new of.data.Contact();
                Mapping.Contact.To_of(crm_contact, of_contact);

                of.data.IdResponse response = _of_connection.Contact.Post(of_contact);

                crm.Contact update_crm_contact = new crm.Contact(_service, _tracingService)
                {
                    nrq_of_id = response.Id,
                    Id        = crm_contact.Id
                };
                update_crm_contact.Update();
            }

            return(of_contact);
        }
コード例 #2
0
        private void Update_contact_in_crm(crm.Contact crm_contact, of.data.Contact of_contact)
        {
            List <string> parameters_to_update = Mapping.Contact.Needs_update_in_crm(crm_contact, of_contact);

            if (parameters_to_update.Any() == false)
            {
                return;
            }

            Mapping.Contact.To_crm(crm_contact, of_contact, _tracingService);

            crm_contact.Update(parameters_to_update);
        }