protected void TestButton_Click(object sender, EventArgs e) { AvaTaxProvider provider = (AvaTaxProvider)_TaxGateway.GetProviderInstance(); PingResult result = provider.Ping(); TestResultPanel.Visible = true; TestResultCode.Text = result.ResultCode.ToString(); if (!string.IsNullOrEmpty(result.Version)) { ServiceVersionLine.Visible = true; ServiceVersion.Text = result.Version; } if (result.Messages != null && result.Messages.Length > 0) { TestResultMessageLine.Visible = true; TestResultMessage.Text = result.Messages[0].Summary; } }
protected void Page_Load(object sender, EventArgs e) { _TaxGatewayId = TaxGatewayDataSource.GetTaxGatewayIdByClassId(Misc.GetClassId(typeof(AvaTaxProvider))); if (_TaxGatewayId > 0) { _TaxGateway = TaxGatewayDataSource.Load(_TaxGatewayId); } if (_TaxGateway != null) { _TaxProvider = _TaxGateway.GetProviderInstance() as AvaTaxProvider; } if (_TaxProvider == null) { _TaxProvider = new AvaTaxProvider(); } if (_TaxGateway == null) { _TaxGateway = new TaxGateway(); _TaxGateway.ClassId = Misc.GetClassId(typeof(AvaTaxProvider)); _TaxGateway.Name = _TaxProvider.Name; _TaxGateway.Store = AbleContext.Current.Store; } if (!Page.IsPostBack) { AccountNumber.Text = _TaxProvider.AccountNumber; CompanyCode.Text = _TaxProvider.CompanyCode; TaxServiceUrl.Text = _TaxProvider.TaxServiceUrl; EnableTaxCalculation.Checked = _TaxProvider.EnableTaxCalculation; TaxableProvinces.Text = _TaxProvider.TaxableProvinces; AddressServiceUrl.Text = _TaxProvider.AddressServiceUrl; EnableAddressValidation.Checked = _TaxProvider.EnableAddressValidation; AddressValidationCountries.Text = _TaxProvider.AddressValidationCountries; TaxReportMode_Breakdown.Checked = _TaxProvider.RecordTaxBreakdown; TaxReportMode_Summary.Checked = !_TaxProvider.RecordTaxBreakdown; SummaryTaxName.Text = _TaxProvider.SummaryTaxName; DebugMode.Checked = _TaxProvider.UseDebugMode; } }