示例#1
0
        public virtual PricelistAssignmentEntity FromModel(PricelistAssignment assignment, PrimaryKeyResolvingMap pkMap)
        {
            if (assignment == null)
            {
                throw new ArgumentNullException(nameof(assignment));
            }

            pkMap.AddPair(assignment, this);

            Id           = assignment.Id;
            CreatedBy    = assignment.CreatedBy;
            CreatedDate  = assignment.CreatedDate;
            ModifiedBy   = assignment.ModifiedBy;
            ModifiedDate = assignment.ModifiedDate;
            OuterId      = assignment.OuterId;

            CatalogId   = assignment.CatalogId;
            Description = assignment.Description;
            Name        = assignment.Name;
            PricelistId = assignment.PricelistId;
            Priority    = assignment.Priority;
            StartDate   = assignment.StartDate;
            EndDate     = assignment.EndDate;

            if (assignment.DynamicExpression != null)
            {
                PredicateVisualTreeSerialized = JsonConvert.SerializeObject(assignment.DynamicExpression, new ConditionJsonConverter(doNotSerializeAvailCondition: true));
            }

            return(this);
        }
示例#2
0
        public virtual PricelistAssignmentEntity FromModel(PricelistAssignment assignment, PrimaryKeyResolvingMap pkMap)
        {
            if (assignment == null)
            {
                throw new ArgumentNullException("assignment");
            }

            pkMap.AddPair(assignment, this);

            this.Id                            = assignment.Id;
            this.CatalogId                     = assignment.CatalogId;
            this.ConditionExpression           = assignment.ConditionExpression;
            this.CreatedBy                     = assignment.CreatedBy;
            this.CreatedDate                   = assignment.CreatedDate;
            this.Description                   = assignment.Description;
            this.EndDate                       = assignment.EndDate;
            this.ModifiedBy                    = assignment.ModifiedBy;
            this.ModifiedDate                  = assignment.ModifiedDate;
            this.Name                          = assignment.Name;
            this.PredicateVisualTreeSerialized = assignment.PredicateVisualTreeSerialized;
            this.PricelistId                   = assignment.PricelistId;
            this.Priority                      = assignment.Priority;
            this.StartDate                     = assignment.StartDate;

            return(this);
        }
示例#3
0
        public virtual PricelistAssignment ToModel(PricelistAssignment assignment)
        {
            if (assignment == null)
            {
                throw new ArgumentNullException("assignment");
            }

            assignment.Id                            = this.Id;
            assignment.CatalogId                     = this.CatalogId;
            assignment.ConditionExpression           = this.ConditionExpression;
            assignment.CreatedBy                     = this.CreatedBy;
            assignment.CreatedDate                   = this.CreatedDate;
            assignment.Description                   = this.Description;
            assignment.EndDate                       = this.EndDate;
            assignment.ModifiedBy                    = this.ModifiedBy;
            assignment.ModifiedDate                  = this.ModifiedDate;
            assignment.Name                          = this.Name;
            assignment.PredicateVisualTreeSerialized = this.PredicateVisualTreeSerialized;
            assignment.PricelistId                   = this.PricelistId;
            assignment.Priority                      = this.Priority;
            assignment.StartDate                     = this.StartDate;

            if (this.Pricelist != null)
            {
                //Need to make lightweight pricelist
                assignment.Pricelist = AbstractTypeFactory <Pricelist> .TryCreateInstance();

                assignment.Pricelist.Id          = this.Pricelist.Id;
                assignment.Pricelist.Currency    = this.Pricelist.Currency;
                assignment.Pricelist.Description = this.Pricelist.Description;
                assignment.Pricelist.Name        = this.Pricelist.Name;
            }

            return(assignment);
        }
		public static dataModel.PricelistAssignment ToDataModel(this coreModel.PricelistAssignment assignment)
		{
			if (assignment == null)
				throw new ArgumentNullException("assignment");

			var retVal = new dataModel.PricelistAssignment();

			retVal.InjectFrom(assignment);

			return retVal;
		}
        /// <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>
        /// Converting to model type
        /// </summary>
        /// <param name="catalogBase"></param>
        /// <returns></returns>
        public static coreModel.PricelistAssignment ToCoreModel(this dataModel.PricelistAssignment dbEntity)
        {
            if (dbEntity == null)
            {
                throw new ArgumentNullException("dbEntity");
            }

            var retVal = new coreModel.PricelistAssignment();

            retVal.InjectFrom(dbEntity);
            return(retVal);
        }
        public static dataModel.PricelistAssignment ToDataModel(this coreModel.PricelistAssignment assignment)
        {
            if (assignment == null)
            {
                throw new ArgumentNullException("assignment");
            }

            var retVal = new dataModel.PricelistAssignment();

            retVal.InjectFrom(assignment);

            return(retVal);
        }
示例#8
0
        public virtual PricelistAssignment ToModel(PricelistAssignment assignment)
        {
            if (assignment == null)
            {
                throw new ArgumentNullException(nameof(assignment));
            }

            assignment.Id           = Id;
            assignment.CreatedBy    = CreatedBy;
            assignment.CreatedDate  = CreatedDate;
            assignment.ModifiedBy   = ModifiedBy;
            assignment.ModifiedDate = ModifiedDate;
            assignment.OuterId      = OuterId;

            assignment.CatalogId   = CatalogId;
            assignment.Description = Description;
            assignment.Name        = Name;
            assignment.PricelistId = PricelistId;
            assignment.Priority    = Priority;
            assignment.StartDate   = StartDate;
            assignment.EndDate     = EndDate;

            if (Pricelist != null)
            {
                //Need to make lightweight pricelist
                assignment.Pricelist = AbstractTypeFactory <Pricelist> .TryCreateInstance();

                assignment.Pricelist.Id          = Pricelist.Id;
                assignment.Pricelist.Currency    = Pricelist.Currency;
                assignment.Pricelist.Description = Pricelist.Description;
                assignment.Pricelist.Name        = Pricelist.Name;
            }
            assignment.DynamicExpression = AbstractTypeFactory <PriceConditionTree> .TryCreateInstance();

            if (PredicateVisualTreeSerialized != null)
            {
                assignment.DynamicExpression = JsonConvert.DeserializeObject <PriceConditionTree>(PredicateVisualTreeSerialized, new ConditionJsonConverter());
            }
            return(assignment);
        }