示例#1
0
        //DTO
        public TaxDTO ToDto()
        {
            TaxDTO dto = new TaxDTO();

            dto.ApplyToShipping = this.ApplyToShipping;
            dto.CountryName = this.CountryName;
            dto.Id = this.Id;
            dto.PostalCode = this.PostalCode;
            dto.Rate = this.Rate;
            dto.RegionAbbreviation = this.RegionAbbreviation;
            dto.StoreId = this.StoreId;
            dto.TaxScheduleId = this.TaxScheduleId;
            
            return dto;
        }
示例#2
0
        public void FromDto(TaxDTO dto)
        {
            if (dto == null) return;

            this.ApplyToShipping = dto.ApplyToShipping;
            this.CountryName = dto.CountryName;
            this.Id = dto.Id;
            this.PostalCode = dto.PostalCode;
            this.Rate = dto.Rate;
            this.RegionAbbreviation = dto.RegionAbbreviation;
            this.StoreId = dto.StoreId;
            this.TaxScheduleId = dto.TaxScheduleId;
        }
示例#3
0
        private void ImportTaxes()
        {
            Header("Importing Taxes");

            data.bvc2004Entities oldDatabase = GetOldDatabase();
            foreach (data.bvc_Tax old in oldDatabase.bvc_Tax)
            {
                Country newCountry = GeographyHelper.TranslateCountry(EFConnString(settings.SourceConnectionString()), old.CountryCode);
                string RegionAbbreviation = GeographyHelper.TranslateRegionBvinToAbbreviation(EFConnString(settings.SourceConnectionString()), old.RegionCode.ToString());

                wl("Tax: " + newCountry.DisplayName + ", " + RegionAbbreviation + " " + old.PostalCode);

                TaxDTO tx = new TaxDTO();
                tx.ApplyToShipping = false;
                tx.CountryName = newCountry.DisplayName;
                tx.PostalCode = old.PostalCode;
                tx.Rate = (decimal)old.Rate;
                tx.RegionAbbreviation = RegionAbbreviation;

                int matchId = old.TaxClass;
                if (matchId < 0) matchId = 0;

                if (TaxScheduleMapper.ContainsKey(matchId))
                {
                    tx.TaxScheduleId = TaxScheduleMapper[matchId];
                }

                Api bv6proxy = GetBV6Proxy();
                var res = bv6proxy.TaxesCreate(tx);
                if (res != null)
                {
                    if (res.Errors.Count() > 0)
                    {
                        DumpErrors(res.Errors);
                        wl("FAILED");
                    }
                    else
                    {
                        wl("SUCCESS");
                    }
                }
            }

        }
示例#4
0
 public ApiResponse<TaxDTO> TaxesCreate(TaxDTO item)
 {
     ApiResponse<TaxDTO> result = new ApiResponse<TaxDTO>();
     result = RestHelper.PostRequest<ApiResponse<TaxDTO>>(this.fullApiUri + "taxes/?key=" + Enc(key), MerchantTribe.Web.Json.ObjectToJson(item));
     return result;
 }