protected void btnTestCA_Click(object sender, EventArgs e) { try { StrikeIronTaxProvider strikeIronTaxProvider = new StrikeIronTaxProvider(); string province = txtProvince_TestCanada.Text.Trim(); string userId = txtUserId.Text.Trim(); string password = txtPassword.Text.Trim(); string error = string.Empty; decimal taxRate = strikeIronTaxProvider.GetTaxRateCanada(province, userId, password, ref error); if (!String.IsNullOrEmpty(error)) { lblTestResultCanada.Text = error; } else { lblTestResultCanada.Text = string.Format("Rate for province {0}: {1}", province, taxRate.ToString("p")); } } catch (Exception exc) { ProcessException(exc); } }
public ActionResult TestCanada(TaxStrikeIronModel model) { if (!ModelState.IsValid) { return(Configure()); } //clear testing results model.TestingUsaResult = ""; model.TestingCanadaResult = ""; try { var strikeIronTaxProvider = new StrikeIronTaxProvider(_strikeIronTaxSettings); string province = model.TestingCanadaProvinceCode; string userId = model.UserId; string password = model.Password; string error = ""; decimal taxRate = strikeIronTaxProvider.GetTaxRateCanada(province, userId, password, ref error); if (!String.IsNullOrEmpty(error)) { model.TestingCanadaResult = error; } else { model.TestingCanadaResult = string.Format("Rate for province {0}: {1}", province, taxRate.ToString("p")); } } catch (Exception exc) { model.TestingCanadaResult = exc.ToString(); } return(View("Nop.Plugin.Tax.StrikeIron.Views.TaxStrikeIron.Configure", model)); }
public ActionResult TestCanada(TaxStrikeIronModel model) { if (!ModelState.IsValid) { return Configure(); } //clear testing results model.TestingUsaResult = ""; model.TestingCanadaResult = ""; try { var strikeIronTaxProvider = new StrikeIronTaxProvider(_strikeIronTaxSettings); string province = model.TestingCanadaProvinceCode; string userId = model.UserId; string password = model.Password; string error = ""; decimal taxRate = strikeIronTaxProvider.GetTaxRateCanada(province, userId, password, ref error); if (!String.IsNullOrEmpty(error)) model.TestingCanadaResult = error; else model.TestingCanadaResult = string.Format("Rate for province {0}: {1}", province, taxRate.ToString("p")); } catch (Exception exc) { model.TestingCanadaResult = exc.ToString(); } return View("Nop.Plugin.Tax.StrikeIron.Views.TaxStrikeIron.Configure", model); }