public void FromDto(TaxScheduleDTO dto) { if (dto == null) return; this.Id = dto.Id; this.Name = dto.Name; this.StoreId = dto.StoreId; }
//DTO public TaxScheduleDTO ToDto() { TaxScheduleDTO dto = new TaxScheduleDTO(); dto.Id = this.Id; dto.Name = this.Name; dto.StoreId = this.StoreId; return dto; }
// Taxes private void ImportTaxSchedules() { Header("Importing Tax Schedules"); TaxScheduleMapper = new Dictionary<int, long>(); data.bvc2004Entities oldDatabase = GetOldDatabase(); foreach (data.bvc_TaxClass old in oldDatabase.bvc_TaxClass) { wl("Tax Schedule: " + old.DisplayName); TaxScheduleDTO ts = new TaxScheduleDTO(); ts.Name = old.DisplayName; Api bv6proxy = GetBV6Proxy(); var res = bv6proxy.TaxSchedulesCreate(ts); if (res != null) { if (res.Errors.Count() > 0) { DumpErrors(res.Errors); wl("FAILED"); } else { long newId = res.Content.Id; TaxScheduleMapper.Add(old.ID, newId); wl("SUCCESS"); } } } // Migrate Default Tax Schedule TaxScheduleDTO defaultTaxSchedule = new TaxScheduleDTO(); defaultTaxSchedule.Name = "Default"; Api bv6proxy2 = GetBV6Proxy(); var res2 = bv6proxy2.TaxSchedulesCreate(defaultTaxSchedule); if (res2 != null) { long defId = res2.Content.Id; TaxScheduleMapper.Add(0, defId); TaxScheduleMapper.Add(-1, defId); } }
public ApiResponse<TaxScheduleDTO> TaxSchedulesUpdate(TaxScheduleDTO item) { ApiResponse<TaxScheduleDTO> result = new ApiResponse<TaxScheduleDTO>(); result = RestHelper.PostRequest<ApiResponse<TaxScheduleDTO>>(this.fullApiUri + "taxschedules/" + item.Id + "?key=" + Enc(key), MerchantTribe.Web.Json.ObjectToJson(item)); return result; }