Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CrmAttributeCollectionAdapter"/> class.
        /// </summary>
        /// <param name="entityAdapter">The entity adapter.</param>
        /// <param name="dynamicEntity">The dynamic entity.</param>
        public CrmAttributeCollectionAdapter(CrmEntityAdapter entityAdapter, DynamicEntity dynamicEntity)
            : base(dynamicEntity)
        {
            this.attributeAdapterFactory = new CrmAttributeAdapterFactory(this);

            this.entityAdapter = entityAdapter;

            if (this.Adaptee.Properties == null)
            {
                this.Adaptee.Properties = new Property[] { };
            }
        }
Example #2
0
        public override void Update(ICrmEntity crmEntity)
        {
            CrmEntityAdapter adapter = crmEntity as CrmEntityAdapter;

            if (adapter != null)
            {
                KeyValuePair <string, object>[] attributes = adapter.AttributeCollectionAdapter.StripSystem();
                this._organizationService.Update(adapter.Adaptee);
                adapter.AttributeCollectionAdapter.AddRange(attributes);
                if (adapter.IsStateChanged || adapter.IsStatusChanged)
                {
                    this.UpdateStateStatus(adapter.LogicalName, adapter.Id, adapter.State, adapter.Status);
                }
            }
        }
Example #3
0
        public override Guid Insert(ICrmEntity crmEntity)
        {
            CrmEntityAdapter adapter = crmEntity as CrmEntityAdapter;

            if (adapter == null)
            {
                return(Guid.Empty);
            }
            KeyValuePair <string, object>[] attributes = adapter.AttributeCollectionAdapter.StripSystem();
            Guid id = adapter.Id = this._organizationService.Create(adapter.Adaptee);

            adapter.AttributeCollectionAdapter.AddRange(attributes);
            if (adapter.IsStateChanged || adapter.IsStatusChanged)
            {
                this.UpdateStateStatus(adapter.LogicalName, id, adapter.State, adapter.Status);
            }
            return(id);
        }
Example #4
0
 public CrmAttributeCollectionAdapter(CrmEntityAdapter entityAdapter, AttributeCollection attributeCollection) : base(attributeCollection)
 {
     this.systemNames   = new string[] { "statecode", "statuscode" };
     this.entityAdapter = entityAdapter;
     this.crmAttributeAdapterFactory = new CrmNamingAttributeAdapterFactory(this);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CrmAttributeCollectionAdapter" /> class.
 /// </summary>
 /// <param name="entityAdapter">The entity adapter.</param>
 /// <param name="attributeCollection">The attribute collection.</param>
 public CrmAttributeCollectionAdapter(CrmEntityAdapter entityAdapter, AttributeCollection attributeCollection)
     : base(attributeCollection)
 {
     this.entityAdapter = entityAdapter;
     this.crmAttributeAdapterFactory = new CrmNamingAttributeAdapterFactory(this);
 }