コード例 #1
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);
        }
コード例 #2
0
        public static dataModel.Address ToDataModel(this Domain.Commerce.Model.Address address)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }

            var retVal = new dataModel.Address();

            retVal.InjectFrom(address);
            retVal.DaytimePhoneNumber = address.Phone;
            return(retVal);
        }
コード例 #3
0
        public static Domain.Commerce.Model.Address ToCoreModel(this dataModel.Address entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            var retVal = new Domain.Commerce.Model.Address();

            retVal.InjectFrom(entity);
            retVal.Phone = entity.DaytimePhoneNumber;

            return(retVal);
        }
コード例 #4
0
        public static Domain.Commerce.Model.Address ToCoreModel(this dataModel.Address entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            var retVal = new Domain.Commerce.Model.Address();

            retVal.InjectFrom(entity);
            retVal.Phone       = entity.DaytimePhoneNumber;
            retVal.AddressType = EnumUtility.SafeParse(entity.Type, AddressType.BillingAndShipping);

            return(retVal);
        }
コード例 #5
0
 public virtual AddressDataEntity FromAddress(Address address)
 {
     if (address == null)
         throw new ArgumentNullException("address");
  
     this.InjectFrom(address);
     this.DaytimePhoneNumber = address.Phone;
     this.Type = address.AddressType.ToString();
     return this;
 }
コード例 #6
0
        public virtual Address ToAddress(Address address)
        {
            if (address == null)
                throw new ArgumentNullException("address");

            var retVal = new Domain.Commerce.Model.Address();
            retVal.InjectFrom(this);
            retVal.Phone = this.DaytimePhoneNumber;
            retVal.AddressType = EnumUtility.SafeParse(this.Type, AddressType.BillingAndShipping);

            return retVal;
        }