/// <summary>
        /// Patch CatalogBase type
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this LineItemEntity source, LineItemEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }


            var patchInjectionPolicy = new PatchInjection <LineItemEntity>(x => x.BasePrice, x => x.Price,
                                                                           x => x.Quantity, x => x.DiscountAmount, x => x.Tax, x => x.Height, x => x.Length,
                                                                           x => x.Width, x => x.MeasureUnit, x => x.WeightUnit, x => x.Weight, x => x.TaxType, x => x.IsCancelled, x => x.CancelledDate, x => x.CancelReason);

            target.InjectFrom(patchInjectionPolicy, source);


            if (!source.Discounts.IsNullCollection())
            {
                source.Discounts.Patch(target.Discounts, new DiscountComparer(), (sourceDiscount, targetDiscount) => sourceDiscount.Patch(targetDiscount));
            }

            if (!source.TaxDetails.IsNullCollection())
            {
                var taxDetailComparer = AnonymousComparer.Create((TaxDetailEntity x) => x.Name);
                source.TaxDetails.Patch(target.TaxDetails, taxDetailComparer, (sourceTaxDetail, targetTaxDetail) => sourceTaxDetail.Patch(targetTaxDetail));
            }
        }
        /// <summary>
        /// Patch CatalogBase type
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.Catalog source, dataModel.Catalog target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjectionPolicy = new PatchInjection <dataModel.Catalog>(x => x.Name, x => x.DefaultLanguage);

            target.InjectFrom(patchInjectionPolicy, source);

            //Languages patch
            var sourceCatalog = source as dataModel.Catalog;
            var targetCatalog = target as dataModel.Catalog;

            if (sourceCatalog != null && targetCatalog != null && !sourceCatalog.CatalogLanguages.IsNullCollection())
            {
                var languageComparer = AnonymousComparer.Create((dataModel.CatalogLanguage x) => x.Language);
                sourceCatalog.CatalogLanguages.Patch(targetCatalog.CatalogLanguages, languageComparer,
                                                     (sourceLang, targetlang) => sourceLang.Patch(targetlang));
            }

            //Property values
            if (sourceCatalog != null && !sourceCatalog.CatalogPropertyValues.IsNullCollection())
            {
                sourceCatalog.CatalogPropertyValues.Patch(targetCatalog.CatalogPropertyValues, (sourcePropValue, targetPropValue) => sourcePropValue.Patch(targetPropValue));
            }
        }
		/// <summary>
		/// Patch CatalogBase type
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this ShipmentEntity source, ShipmentEntity target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			var patchInjection = new PatchInjection<ShipmentEntity>(x => x.ShippingPrice, x => x.TaxTotal,
																		   x => x.TaxIncluded, x => x.Currency,
																		   x => x.WeightUnit, x => x.WeightValue,
																		   x => x.DimensionHeight, x => x.DimensionLength, x => x.DimensionUnit,
																		   x => x.DimensionWidth, x => x.TaxType);
			target.InjectFrom(patchInjection, source);

		
			if (!source.Addresses.IsNullCollection())
			{
				source.Addresses.Patch(target.Addresses, new AddressComparer(), (sourceAddress, targetAddress) => sourceAddress.Patch(targetAddress));
			}

			if (source.Items != null)
			{
				source.Items.Patch(target.Items, (sourceItem, targetItem) => sourceItem.Patch(targetItem));
			}
			if (!source.TaxDetails.IsNullCollection())
			{
				var taxDetailComparer = AnonymousComparer.Create((TaxDetailEntity x) => x.Name);
				source.TaxDetails.Patch(target.TaxDetails, taxDetailComparer, (sourceTaxDetail, targetTaxDetail) => sourceTaxDetail.Patch(targetTaxDetail));
			}

		}
Beispiel #4
0
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.Property source, dataModel.Property target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjectionPolicy = new PatchInjection <dataModel.Property>(x => x.PropertyValueType, x => x.IsEnum, x => x.IsMultiValue, x => x.IsLocaleDependant,
                                                                               x => x.IsRequired, x => x.TargetType, x => x.Name);

            target.InjectFrom(patchInjectionPolicy, source);


            //Attributes patch
            if (!source.PropertyAttributes.IsNullCollection())
            {
                var attributeComparer = AnonymousComparer.Create((dataModel.PropertyAttribute x) => x.IsTransient() ?  x.PropertyAttributeName : x.Id);
                source.PropertyAttributes.Patch(target.PropertyAttributes, attributeComparer, (sourceAsset, targetAsset) => sourceAsset.Patch(targetAsset));
            }
            //Property dict values
            if (!source.DictionaryValues.IsNullCollection())
            {
                source.DictionaryValues.Patch(target.DictionaryValues, (sourcePropValue, targetPropValue) => sourcePropValue.Patch(targetPropValue));
            }
        }
        /// <summary>
        /// Patch CatalogBase type
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this ShipmentEntity source, ShipmentEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjection = new PatchInjection <ShipmentEntity>(x => x.ShipmentMethodCode, x => x.Total,
                                                                     x => x.ShippingPrice, x => x.DiscountTotal, x => x.TaxTotal,
                                                                     x => x.TaxIncluded, x => x.Currency,
                                                                     x => x.WeightUnit, x => x.WeightValue,
                                                                     x => x.DimensionHeight, x => x.DimensionLength, x => x.DimensionUnit,
                                                                     x => x.DimensionWidth, x => x.TaxType);

            target.InjectFrom(patchInjection, source);


            if (!source.Addresses.IsNullCollection())
            {
                source.Addresses.Patch(target.Addresses, new AddressComparer(), (sourceAddress, targetAddress) => sourceAddress.Patch(targetAddress));
            }
            if (source.Items != null)
            {
                source.Items.Patch(target.Items, (sourceItem, targetItem) => sourceItem.Patch(targetItem));
            }
            if (!source.TaxDetails.IsNullCollection())
            {
                var taxDetailComparer = AnonymousComparer.Create((TaxDetailEntity x) => x.Name);
                source.TaxDetails.Patch(target.TaxDetails, taxDetailComparer, (sourceTaxDetail, targetTaxDetail) => sourceTaxDetail.Patch(targetTaxDetail));
            }
            if (!source.Discounts.IsNullCollection())
            {
                source.Discounts.Patch(target.Discounts, new DiscountComparer(), (sourceDiscount, targetDiscount) => sourceDiscount.Patch(targetDiscount));
            }
        }
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.QuoteRequestEntity source, dataModel.QuoteRequestEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            target.Tag = source.Tag;
            var patchInjection = new PatchInjection <dataModel.QuoteRequestEntity>(x => x.CancelledDate, x => x.CancelReason, x => x.ChannelId, x => x.Comment, x => x.InnerComment,
                                                                                   x => x.IsLocked, x => x.IsCancelled, x => x.LanguageCode, x => x.OrganizationId, x => x.OrganizationName, x => x.ReminderDate,
                                                                                   x => x.Status, x => x.StoreId, x => x.StoreName, x => x.ShipmentMethodCode, x => x.ShipmentMethodOption, x => x.EmployeeId, x => x.EmployeeName,
                                                                                   x => x.Currency, x => x.ManualShippingTotal, x => x.ManualRelDiscountAmount, x => x.ManualSubTotal, x => x.IsSubmitted, x => x.CustomerId, x => x.CustomerName);

            target.InjectFrom(patchInjection, source);

            if (!source.Addresses.IsNullCollection())
            {
                source.Addresses.Patch(target.Addresses, (sourceAddress, targetAddress) => { return; });
            }
            if (!source.Attachments.IsNullCollection())
            {
                source.Attachments.Patch(target.Attachments, (sourceAttachment, targetAttachment) => { return; });
            }
            if (!source.Items.IsNullCollection())
            {
                source.Items.Patch(target.Items, (sourceItem, targetItem) => sourceItem.Patch(targetItem));
            }
        }
Beispiel #7
0
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.CategoryBase source, dataModel.CategoryBase target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var dbSource = source as dataModel.Category;
            var dbTarget = target as dataModel.Category;

            if (dbSource != null && dbTarget != null)
            {
                var patchInjectionPolicy = new PatchInjection <dataModel.Category>(x => x.Code, x => x.Name, x => x.IsActive);
                target.InjectFrom(patchInjectionPolicy, source);

                if (!dbSource.CategoryPropertyValues.IsNullCollection())
                {
                    dbSource.CategoryPropertyValues.Patch(dbTarget.CategoryPropertyValues, (sourcePropValue, targetPropValue) => sourcePropValue.Patch(targetPropValue));
                }

                if (!dbSource.OutgoingLinks.IsNullCollection())
                {
                    dbSource.OutgoingLinks.Patch(dbTarget.OutgoingLinks, new LinkedCategoryComparer(), (sourceLink, targetLink) => sourceLink.Patch(targetLink));
                }
            }
        }
 /// <summary>
 /// Patch 
 /// </summary>
 /// <param name="source"></param>
 /// <param name="target"></param>
 public static void Patch(this dataModel.ContactPropertyValue source, dataModel.ContactPropertyValue target)
 {
     var patchInjectionPolicy = new PatchInjection<dataModel.ContactPropertyValue>(x => x.BooleanValue, x => x.DateTimeValue,
                                                                                   x => x.DecimalValue, x => x.IntegerValue,
                                                                                   x => x.ShortTextValue, x => x.LongTextValue, x => x.ValueType);
     target.InjectFrom(patchInjectionPolicy, source);
 }
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.Organization source, dataModel.Organization target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            var patchInjection = new PatchInjection <dataModel.Organization>(x => x.Name, x => x.Description,
                                                                             x => x.OwnerId, x => x.OrgType,
                                                                             x => x.BusinessCategory);

            target.InjectFrom(patchInjection, source);

            if (!source.Phones.IsNullCollection())
            {
                var phoneComparer = AnonymousComparer.Create((dataModel.Phone x) => x.Number);
                source.Phones.Patch(target.Phones, phoneComparer, (sourcePhone, targetPhone) => targetPhone.Number = sourcePhone.Number);
            }
            if (!source.Emails.IsNullCollection())
            {
                var addressComparer = AnonymousComparer.Create((dataModel.Email x) => x.Address);
                source.Emails.Patch(target.Emails, addressComparer, (sourceEmail, targetEmail) => targetEmail.Address = sourceEmail.Address);
            }
            if (!source.Addresses.IsNullCollection())
            {
                source.Addresses.Patch(target.Addresses, new AddressComparer(), (sourceAddress, targetAddress) => sourceAddress.Patch(targetAddress));
            }
            if (!source.Notes.IsNullCollection())
            {
                var noteComparer = AnonymousComparer.Create((dataModel.Note x) => x.Id);
                source.Notes.Patch(target.Notes, noteComparer, (sourceNote, targetNote) => sourceNote.Patch(targetNote));
            }
        }
Beispiel #10
0
        public virtual void Patch(MemberDataEntity target)
        {
            var patchInjection = new PatchInjection <MemberDataEntity>(x => x.Name);

            target.InjectFrom(patchInjection, this);

            if (!this.Phones.IsNullCollection())
            {
                var phoneComparer = AnonymousComparer.Create((PhoneDataEntity x) => x.Number);
                this.Phones.Patch(target.Phones, phoneComparer, (sourcePhone, targetPhone) => targetPhone.Number = sourcePhone.Number);
            }

            if (!this.Emails.IsNullCollection())
            {
                var addressComparer = AnonymousComparer.Create((EmailDataEntity x) => x.Address);
                this.Emails.Patch(target.Emails, addressComparer, (sourceEmail, targetEmail) => targetEmail.Address = sourceEmail.Address);
            }

            if (!this.Addresses.IsNullCollection())
            {
                this.Addresses.Patch(target.Addresses, new AddressDataEntityComparer(), (sourceAddress, targetAddress) => sourceAddress.Patch(targetAddress));
            }

            if (!this.Notes.IsNullCollection())
            {
                var noteComparer = AnonymousComparer.Create((NoteDataEntity x) => x.Id ?? x.Body);
                this.Notes.Patch(target.Notes, noteComparer, (sourceNote, targetNote) => sourceNote.Patch(targetNote));
            }

            if (!this.MemberRelations.IsNullCollection())
            {
                var relationComparer = AnonymousComparer.Create((MemberRelationDataEntity x) => x.AncestorId);
                this.MemberRelations.Patch(target.MemberRelations, relationComparer, (sourceRel, targetRel) => { /*Nothing todo*/ });
            }
        }
		/// <summary>
		/// Patch CatalogLanguage type
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.PropertyAttribute source, dataModel.PropertyAttribute target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			var patchInjectionPolicy = new PatchInjection<dataModel.PropertyAttribute>(x => x.PropertyAttributeName, x => x.PropertyAttributeValue);
			target.InjectFrom(patchInjectionPolicy, source);
		}
		public static void Patch(this OperationLogEntity source, OperationLogEntity target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			var patchInjection = new PatchInjection<OperationLogEntity>(x => x.ModifiedBy, x => x.ModifiedDate, x=>x.Detail);
			target.InjectFrom(patchInjection, source);
		}
Beispiel #13
0
        /// <summary>
        /// Patch
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.ContactPropertyValue source, dataModel.ContactPropertyValue target)
        {
            var patchInjectionPolicy = new PatchInjection <dataModel.ContactPropertyValue>(x => x.BooleanValue, x => x.DateTimeValue,
                                                                                           x => x.DecimalValue, x => x.IntegerValue,
                                                                                           x => x.ShortTextValue, x => x.LongTextValue, x => x.ValueType);

            target.InjectFrom(patchInjectionPolicy, source);
        }
 /// <summary>
 /// Patch changes
 /// </summary>
 /// <param name="source"></param>
 /// <param name="target"></param>
 public static void Patch(this dataModel.Price source, dataModel.Price target)
 {
     if (target == null)
         throw new ArgumentNullException("target");
     var patchInjection = new PatchInjection<dataModel.Price>(x => x.ProductId, x => x.List,
                                                                    x => x.MinQuantity, x => x.Sale);
     target.InjectFrom(patchInjection, source);
 }
        public static void Patch(this dataModel.PermissionEntity source, dataModel.PermissionEntity target)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            var patchInjection = new PatchInjection<dataModel.PermissionEntity>(x => x.Name, x => x.Description);
            target.InjectFrom(patchInjection, source);
        }
		public static void Patch(this NotificationTemplateEntity source, NotificationTemplateEntity target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			var patchInjection = new PatchInjection<NotificationTemplateEntity>(x => x.Subject, x => x.Body, x => x.IsDefault);
			target.InjectFrom(patchInjection, source);
		}
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.ApiAccountEntity source, dataModel.ApiAccountEntity target)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            var patchInjection = new PatchInjection<dataModel.ApiAccountEntity>(x => x.Name, x => x.ApiAccountType, x => x.IsActive, x => x.SecretKey, x => x.AppId);
            target.InjectFrom(patchInjection, source);
        }
Beispiel #18
0
        public override void Patch(MemberDataEntity target)
        {
            var patchInjection = new PatchInjection <VendorDataEntity>(x => x.SiteUrl, x => x.LogoUrl, x => x.GroupName, x => x.Description);

            target.InjectFrom(patchInjection, this);

            base.Patch(target);
        }
		/// <summary>
		/// Patch changes
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.StoreShippingMethod source, dataModel.StoreShippingMethod target)
		{
			if (target == null)
				throw new ArgumentNullException("target");
			var patchInjectionPolicy = new PatchInjection<dataModel.StoreShippingMethod>(x => x.LogoUrl, x => x.Name,
																		   x => x.Description, x => x.Priority,
																		   x => x.IsActive);
			target.InjectFrom(patchInjectionPolicy, source);
		}
		/// <summary>
		/// Patch changes
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.SeoUrlKeyword source, dataModel.SeoUrlKeyword target)
		{
			if (target == null)
				throw new ArgumentNullException("target");
			var patchInjection = new PatchInjection<dataModel.SeoUrlKeyword>(x => x.ImageAltDescription, x => x.IsActive,
																			   x => x.Keyword,  x => x.Language,
																			   x => x.MetaDescription, x => x.MetaKeywords, x => x.Title);
			target.InjectFrom(patchInjection, source);
		}
 /// <summary>
 /// Patch changes
 /// </summary>
 /// <param name="source"></param>
 /// <param name="target"></param>
 public static void Patch(this dataModel.Currency source, dataModel.Currency target)
 {
     if (target == null)
         throw new ArgumentNullException("target");
     var patchInjection = new PatchInjection<dataModel.Currency>(x => x.Name,
                                                                 x => x.Symbol, x => x.ExchangeRate, x => x.IsPrimary,
                                                                 x => x.CustomFormatting);
     target.InjectFrom(patchInjection, source);
 }
		/// <summary>
		/// Patch changes
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.DynamicContentFolder source, dataModel.DynamicContentFolder target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			var patchInjection = new PatchInjection<dataModel.DynamicContentFolder>(x => x.Name, x => x.Description, x => x.ImageUrl);

			target.InjectFrom(patchInjection, source);
		}
        public override void Patch(MemberDataEntity target)
        {
            var patchInjection = new PatchInjection<OrganizationDataEntity>(x => x.Name, x => x.Description,
                                                                       x => x.OwnerId, x => x.OrgType,
                                                                       x => x.BusinessCategory);
            target.InjectFrom(patchInjection, this);

            base.Patch(target);
        }
        public static void Patch(this dataModel.RoleAssignmentEntity source, dataModel.RoleAssignmentEntity target)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            var patchInjection = new PatchInjection<dataModel.RoleAssignmentEntity>(x => x.RoleId, x => x.AccountId);
            target.InjectFrom(patchInjection, source);

        }
		/// <summary>
		/// Patch CatalogLanguage type
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.CatalogLanguage source, dataModel.CatalogLanguage target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			var patchInjectionPolicy = new PatchInjection<dataModel.CatalogLanguage>(x => x.Language);
			target.InjectFrom(patchInjectionPolicy, source);

		}
		/// <summary>
		/// Patch changes
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.EditorialReview source, dataModel.EditorialReview target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			var patchInjectionPolicy = new PatchInjection<dataModel.EditorialReview>(x => x.Content, x => x.Locale, x=>x.Source);
			target.InjectFrom(patchInjectionPolicy, source);

		}
		/// <summary>
		/// Patch changes
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.PricelistAssignment source, dataModel.PricelistAssignment target)
		{
			if (target == null)
				throw new ArgumentNullException("target");
			var patchInjection = new PatchInjection<dataModel.PricelistAssignment>(x => x.Name, x => x.Description,
																						 x => x.StartDate, x => x.EndDate, x => x.CatalogId,
																						 x => x.PricelistId, x => x.Priority, x => x.ConditionExpression);
			target.InjectFrom(patchInjection, source);
		}
		/// <summary>
		/// Patch CatalogBase type
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this ShipmentItemEntity source, ShipmentItemEntity target)
		{
			if (target == null)
				throw new ArgumentNullException("target");


			var patchInjectionPolicy = new PatchInjection<ShipmentItemEntity>(x => x.BarCode, x => x.ShipmentId, x=>x.Quantity);
			target.InjectFrom(patchInjectionPolicy, source);
		}
Beispiel #29
0
		/// <summary>
		/// Patch changes
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.ItemAsset source, dataModel.ItemAsset target)
		{
			if (target == null)
				throw new ArgumentNullException("target");
			
			var patchInjectionPolicy = new PatchInjection<dataModel.ItemAsset>(x => x.AssetType, x=> x.SortOrder );
			target.InjectFrom(patchInjectionPolicy, source);

		}
        public override void Patch(MemberDataEntity target)
        {
            var patchInjection = new PatchInjection <EmployeeDataEntity>(x => x.FirstName, x => x.MiddleName, x => x.LastName, x => x.BirthDate, x => x.DefaultLanguage,
                                                                         x => x.FullName, x => x.IsActive, x => x.Type, x => x.TimeZone);

            target.InjectFrom(patchInjection, this);

            base.Patch(target);
        }
			/// <summary>
		/// Patch CatalogBase type
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this TaxDetailEntity source, TaxDetailEntity target)
		{
			if (target == null)
				throw new ArgumentNullException("target");


			var patchInjectionPolicy = new PatchInjection<TaxDetailEntity>(x => x.Rate, x => x.Amount);
			target.InjectFrom(patchInjectionPolicy, source);

		}
        public override void Patch(MemberDataEntity target)
        {
            var patchInjection = new PatchInjection <OrganizationDataEntity>(x => x.Name, x => x.Description,
                                                                             x => x.OwnerId, x => x.OrgType,
                                                                             x => x.BusinessCategory);

            target.InjectFrom(patchInjection, this);

            base.Patch(target);
        }
Beispiel #33
0
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.DynamicContentPlace source, dataModel.DynamicContentPlace target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjection = new PatchInjection <dataModel.DynamicContentPlace>(x => x.Name, x => x.Description, x => x.FolderId, x => x.ImageUrl);

            target.InjectFrom(patchInjection, source);
        }
		/// <summary>
		/// Patch changes
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.Inventory source, dataModel.Inventory target)
		{
			if (target == null)
				throw new ArgumentNullException("target");
			var patchInjection = new PatchInjection<dataModel.Inventory>(x => x.Sku, x => x.Status,
																			   x => x.AllowBackorder, x => x.AllowPreorder,
																			   x => x.BackorderAvailabilityDate, x => x.BackorderQuantity,
																			   x => x.FulfillmentCenterId, x => x.InStockQuantity, x => x.PreorderAvailabilityDate,
																			   x => x.PreorderQuantity, x => x.ReorderMinQuantity, x => x.ReservedQuantity);
			target.InjectFrom(patchInjection, source);
		}
Beispiel #35
0
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.ApiAccountEntity source, dataModel.ApiAccountEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjection = new PatchInjection <dataModel.ApiAccountEntity>(x => x.Name, x => x.ApiAccountType, x => x.IsActive, x => x.SecretKey, x => x.AppId);

            target.InjectFrom(patchInjection, source);
        }
Beispiel #36
0
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.Price source, dataModel.Price target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            var patchInjection = new PatchInjection <dataModel.Price>(x => x.ProductId, x => x.List,
                                                                      x => x.MinQuantity, x => x.Sale);

            target.InjectFrom(patchInjection, source);
        }
Beispiel #37
0
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.Store source, dataModel.Store target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            var patchInjectionPolicy = new PatchInjection <dataModel.Store>(x => x.FulfillmentCenterId, x => x.ReturnsFulfillmentCenterId,
                                                                            x => x.AdminEmail, x => x.Catalog,
                                                                            x => x.Country, x => x.CreditCardSavePolicy,
                                                                            x => x.DefaultCurrency, x => x.DefaultLanguage,
                                                                            x => x.Description, x => x.DisplayOutOfStock,
                                                                            x => x.Email, x => x.Name, x => x.Region, x => x.SecureUrl,
                                                                            x => x.TimeZone, x => x.Url, x => x.StoreState);

            target.InjectFrom(patchInjectionPolicy, source);


            if (!source.Languages.IsNullCollection())
            {
                var languageComparer = AnonymousComparer.Create((dataModel.StoreLanguage x) => x.LanguageCode);
                source.Languages.Patch(target.Languages, languageComparer,
                                       (sourceLang, targetLang) => targetLang.LanguageCode = sourceLang.LanguageCode);
            }
            if (!source.Currencies.IsNullCollection())
            {
                var currencyComparer = AnonymousComparer.Create((dataModel.StoreCurrency x) => x.CurrencyCode);
                source.Currencies.Patch(target.Currencies, currencyComparer,
                                        (sourceCurrency, targetCurrency) => targetCurrency.CurrencyCode = sourceCurrency.CurrencyCode);
            }
            if (!source.TrustedGroups.IsNullCollection())
            {
                var trustedGroupComparer = AnonymousComparer.Create((dataModel.StoreTrustedGroup x) => x.GroupName);
                source.TrustedGroups.Patch(target.TrustedGroups, trustedGroupComparer,
                                           (sourceGroup, targetGroup) => sourceGroup.GroupName = targetGroup.GroupName);
            }
            if (!source.PaymentMethods.IsNullCollection())
            {
                var paymentComparer = AnonymousComparer.Create((dataModel.StorePaymentMethod x) => x.Code);
                source.PaymentMethods.Patch(target.PaymentMethods, paymentComparer,
                                            (sourceMethod, targetMethod) => sourceMethod.Patch(targetMethod));
            }
            if (!source.ShippingMethods.IsNullCollection())
            {
                var shippingComparer = AnonymousComparer.Create((dataModel.StoreShippingMethod x) => x.Code);
                source.ShippingMethods.Patch(target.ShippingMethods, shippingComparer,
                                             (sourceMethod, targetMethod) => sourceMethod.Patch(targetMethod));
            }
            if (!source.TaxProviders.IsNullCollection())
            {
                var shippingComparer = AnonymousComparer.Create((dataModel.StoreTaxProvider x) => x.Code);
                source.TaxProviders.Patch(target.TaxProviders, shippingComparer,
                                          (sourceProvider, targetProvider) => sourceProvider.Patch(targetProvider));
            }
        }
		/// <summary>
		/// Patch changes
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.FulfillmentCenter source, dataModel.FulfillmentCenter target)
		{
			if (target == null)
				throw new ArgumentNullException("target");
			var patchInjection = new PatchInjection<dataModel.FulfillmentCenter>(x => x.City, x => x.CountryCode,
																			   x => x.CountryName, x => x.DaytimePhoneNumber,
																			   x => x.Description, x => x.Line1,
																			   x => x.Line2, x => x.MaxReleasesPerPickBatch, x => x.Name,
																			   x => x.PickDelay, x => x.PostalCode, x => x.StateProvince);
			target.InjectFrom(patchInjection, source);
		}
        /// <summary>
        /// Patch CatalogLanguage type
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.PropertyAttribute source, dataModel.PropertyAttribute target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjectionPolicy = new PatchInjection <dataModel.PropertyAttribute>(x => x.PropertyAttributeName, x => x.PropertyAttributeValue);

            target.InjectFrom(patchInjectionPolicy, source);
        }
        public virtual void Patch(AddressDataEntity target)
        {
            var patchInjectionPolicy = new PatchInjection <AddressDataEntity>(x => x.City, x => x.CountryCode,
                                                                              x => x.CountryName, x => x.DaytimePhoneNumber,
                                                                              x => x.Email, x => x.EveningPhoneNumber, x => x.FaxNumber,
                                                                              x => x.FirstName, x => x.LastName, x => x.Line1,
                                                                              x => x.Line2, x => x.Name, x => x.Organization, x => x.PostalCode,
                                                                              x => x.RegionName, x => x.RegionId, x => x.StateProvince, x => x.Type);

            target.InjectFrom(patchInjectionPolicy, this);
        }
Beispiel #41
0
        public static void Patch(this OperationLogEntity source, OperationLogEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjection = new PatchInjection <OperationLogEntity>(x => x.ModifiedBy, x => x.ModifiedDate, x => x.Detail);

            target.InjectFrom(patchInjection, source);
        }
        public static void Patch(this NotificationTemplateEntity source, NotificationTemplateEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjection = new PatchInjection <NotificationTemplateEntity>(x => x.Subject, x => x.Body, x => x.IsDefault);

            target.InjectFrom(patchInjection, source);
        }
        public virtual void Patch(ThumbnailTaskOptionEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            var patchInjection = new PatchInjection <ThumbnailTaskOptionEntity>(x => x.ThumbnailOptionId, x => x.ThumbnailTaskId);

            target.InjectFrom(patchInjection, this);
        }
Beispiel #44
0
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.ItemAsset source, dataModel.ItemAsset target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjectionPolicy = new PatchInjection <dataModel.ItemAsset>(x => x.AssetType, x => x.SortOrder);

            target.InjectFrom(patchInjectionPolicy, source);
        }
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.EditorialReview source, dataModel.EditorialReview target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjectionPolicy = new PatchInjection <dataModel.EditorialReview>(x => x.Content, x => x.Locale, x => x.Source);

            target.InjectFrom(patchInjectionPolicy, source);
        }
Beispiel #46
0
        /// <summary>
        /// Patch CatalogLanguage type
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.CatalogLanguage source, dataModel.CatalogLanguage target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjectionPolicy = new PatchInjection <dataModel.CatalogLanguage>(x => x.Language);

            target.InjectFrom(patchInjectionPolicy, source);
        }
Beispiel #47
0
        /// <summary>
        /// Patch
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.Address source, dataModel.Address target)
        {
            var patchInjectionPolicy = new PatchInjection <dataModel.Address>(x => x.City, x => x.CountryCode,
                                                                              x => x.CountryName, x => x.DaytimePhoneNumber,
                                                                              x => x.Email, x => x.EveningPhoneNumber, x => x.FaxNumber,
                                                                              x => x.FirstName, x => x.LastName, x => x.Line1,
                                                                              x => x.Line2, x => x.Name, x => x.Organization, x => x.PostalCode,
                                                                              x => x.RegionName, x => x.RegionId, x => x.StateProvince, x => x.Type);

            target.InjectFrom(patchInjectionPolicy, source);
        }
Beispiel #48
0
        public static void Patch(this RoleAssignmentEntity source, RoleAssignmentEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjection = new PatchInjection <RoleAssignmentEntity>(x => x.RoleId, x => x.AccountId);

            target.InjectFrom(patchInjection, source);
        }
Beispiel #49
0
        public static void Patch(this PermissionEntity source, PermissionEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjection = new PatchInjection <PermissionEntity>(x => x.Name, x => x.Description);

            target.InjectFrom(patchInjection, source);
        }
Beispiel #50
0
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.SeoUrlKeyword source, dataModel.SeoUrlKeyword target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            var patchInjection = new PatchInjection <dataModel.SeoUrlKeyword>(x => x.ImageAltDescription, x => x.IsActive,
                                                                              x => x.Keyword, x => x.Language, x => x.StoreId,
                                                                              x => x.MetaDescription, x => x.MetaKeywords, x => x.Title);

            target.InjectFrom(patchInjection, source);
        }
Beispiel #51
0
        /// <summary>
        /// Patch CatalogBase type
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this TaxDetailEntity source, TaxDetailEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }


            var patchInjectionPolicy = new PatchInjection <TaxDetailEntity>(x => x.Rate, x => x.Amount);

            target.InjectFrom(patchInjectionPolicy, source);
        }
		/// <summary>
		/// Patch changes
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.OperationPropertyEntity source, dataModel.OperationPropertyEntity target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			var patchInjectionPolicy = new PatchInjection<dataModel.OperationPropertyEntity>(x => x.BooleanValue, x => x.DateTimeValue,
																					   x => x.DecimalValue, x => x.IntegerValue,
																					   x => x.Locale, x => x.LongTextValue, x => x.ShortTextValue,
																					   x => x.ValueType);
			target.InjectFrom(patchInjectionPolicy, source);

		}
		/// <summary>
		/// Patch CatalogBase type
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this OperationEntity source, OperationEntity target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			var patchInjectionPolicy = new PatchInjection<OperationEntity>(x => x.Comment, x => x.Currency,
																			   x => x.Number, x => x.Status, x => x.IsCancelled,
																			   x => x.CancelledDate, x => x.CancelReason, x => x.Tax,
																			   x => x.TaxIncluded, x => x.IsApproved, x => x.Sum);
			target.InjectFrom(patchInjectionPolicy, source);

		}
Beispiel #54
0
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.Contact source, dataModel.Contact target)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            var patchInjection = new PatchInjection<dataModel.Contact>(x => x.FirstName, x => x.MiddleName, x => x.LastName, x=> x.BirthDate, x => x.DefaultLanguage,
                                                                           x => x.FullName, x => x.Salutation,
                                                                           x => x.TimeZone);
            target.InjectFrom(patchInjection, source);
            //Path base type properties
            ((dataModel.Member)source).Patch(target);
        }
		/// <summary>
		/// Patch AssociationGroup type
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.AssociationGroup source, dataModel.AssociationGroup target)
		{
			var patchInjectionPolicy = new PatchInjection<dataModel.AssociationGroup>(x => x.Name, x => x.Description);
			target.InjectFrom(patchInjectionPolicy, source);

			if (!source.Associations.IsNullCollection())
			{
				var associationComparer = AnonymousComparer.Create((dataModel.Association x) => x.ItemId);
				source.Associations.Patch(target.Associations, associationComparer,
										 (sourceAssociation, targetAssociation) => sourceAssociation.Patch(targetAssociation));
			}
		}
Beispiel #56
0
        /// <summary>
        /// Patch CatalogBase type
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this ShipmentItemEntity source, ShipmentItemEntity target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }


            var patchInjectionPolicy = new PatchInjection <ShipmentItemEntity>(x => x.BarCode, x => x.ShipmentId, x => x.ShipmentPackageId, x => x.Quantity);

            target.InjectFrom(patchInjectionPolicy, source);
        }
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this MenuLinkList source, MenuLinkList target)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            var patchInjectionPolicy = new PatchInjection<MenuLinkList>(x => x.Language, x => x.Name);
            target.InjectFrom(patchInjectionPolicy, source);

            if (!source.MenuLinks.IsNullCollection())
            {
                source.MenuLinks.Patch(target.MenuLinks, (sourceLink, targetLink) => sourceLink.Patch(targetLink));
            }
        }
		/// <summary>
		/// Patch changes
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this dataModel.DynamicContentItem source, dataModel.DynamicContentItem target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			var patchInjection = new PatchInjection<dataModel.DynamicContentItem>(x => x.Name, x => x.Description, x=>x.FolderId, x=>x.ImageUrl, x=>x.ContentTypeId);
			if (!source.PropertyValues.IsNullCollection())
			{
				var propertyComparer = AnonymousComparer.Create((dataModel.DynamicContentItemProperty x) => x.Name);
				source.PropertyValues.Patch(target.PropertyValues, propertyComparer, (sourceProperty, targetProperty) => sourceProperty.Patch(targetProperty));
			}
			target.InjectFrom(patchInjection, source);
		}
		/// <summary>
		/// Patch CatalogBase type
		/// </summary>
		/// <param name="source"></param>
		/// <param name="target"></param>
		public static void Patch(this PaymentEntity source, PaymentEntity target)
		{
			if (target == null)
				throw new ArgumentNullException("target");

			var patchInjection = new PatchInjection<PaymentEntity>(x => x.Amount, x => x.PaymentGatewayCode);
			target.InjectFrom(patchInjection, source);

			if (!source.Addresses.IsNullCollection())
			{
				source.Addresses.Patch(target.Addresses, new AddressComparer(), (sourceAddress, targetAddress) => sourceAddress.Patch(targetAddress));
			}
		}
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this dataModel.PropertyValue source, dataModel.PropertyValue target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }


            var patchInjectionPolicy = new PatchInjection<dataModel.PropertyValue>(x => x.BooleanValue, x => x.DateTimeValue,
                                                                                  x => x.DecimalValue, x => x.IntegerValue,
                                                                                  x => x.KeyValue, x => x.LongTextValue, x => x.ShortTextValue);
            target.InjectFrom(patchInjectionPolicy, source);
        }