Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
        public ActionResult TestUsa(TaxStrikeIronModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Configure());
            }

            //clear testing results
            model.TestingUsaResult    = "";
            model.TestingCanadaResult = "";

            try
            {
                var     strikeIronTaxProvider = new StrikeIronTaxProvider(_strikeIronTaxSettings);
                string  zip      = model.TestingUsaZip;
                string  userId   = model.UserId;
                string  password = model.Password;
                string  error    = "";
                decimal taxRate  = strikeIronTaxProvider.GetTaxRateUsa(zip, userId, password, ref error);
                if (!String.IsNullOrEmpty(error))
                {
                    model.TestingUsaResult = error;
                }
                else
                {
                    model.TestingUsaResult = string.Format("Rate for zip {0}: {1}", zip, taxRate.ToString("p"));
                }
            }
            catch (Exception exc)
            {
                model.TestingUsaResult = exc.ToString();
            }

            return(View("Nop.Plugin.Tax.StrikeIron.Views.TaxStrikeIron.Configure", model));
        }
Exemplo n.º 4
0
 protected void btnTestUS_Click(object sender, EventArgs e)
 {
     try
     {
         StrikeIronTaxProvider strikeIronTaxProvider = new StrikeIronTaxProvider();
         string  zip      = txtZip_TestUSA.Text.Trim();
         string  userID   = txtUserID.Text.Trim();
         string  password = txtPassword.Text.Trim();
         string  error    = string.Empty;
         decimal taxRate  = strikeIronTaxProvider.GetTaxRateUSA(zip, userID, password, ref error);
         if (!String.IsNullOrEmpty(error))
         {
             lblTestResultUSA.Text = error;
         }
         else
         {
             lblTestResultUSA.Text = string.Format("Rate for zip {0}: {1}", zip, taxRate.ToString("p"));
         }
     }
     catch (Exception exc)
     {
         ProcessException(exc);
     }
 }