Example #1
0
        private void LoadTaxRates()
        {
            TaxController controller = new TaxController();
            TaxInfo       taxInfo    = controller.GetTaxRates(PortalId);

            if (taxInfo != null)
            {
                cbEnableTax.Checked = taxInfo.ShowTax;
                txtTaxRate.Text     = taxInfo.DefaultTaxRate < 0 ? "" : taxInfo.DefaultTaxRate.ToString("0.00");
            }

            IsReady = true;
        }
Example #2
0
        private void SaveTaxRates()
        {
            if (!Page.IsValid)
            {
                return;
            }

            bool    enableTax = cbEnableTax.Checked;
            decimal rate      = Null.NullDecimal;

            if (enableTax)
            {
                rate = Decimal.Parse(txtTaxRate.Text);
            }

            TaxController controller = new TaxController();

            controller.UpdateTaxRates(PortalId, rate, enableTax);
        }
Example #3
0
 private void loadTaxRates()
 {
     TaxController controller = new TaxController();
     TaxInfo taxInfo = controller.GetTaxRates(this.PortalId);
     txtTaxRate.Text = taxInfo.DefaultTaxRate < 0 ? "" : taxInfo.DefaultTaxRate.ToString("0.00");
     cbEnableTax.Checked = taxInfo.ShowTax;
 }
Example #4
0
        private void saveTaxRates()
        {
            decimal rate = -1;

            if (cbEnableTax.Checked && txtTaxRate.Text.Length == 0)
            {
                lblError.Visible = true;
                lblError.Text = Localization.GetString("lblErrorTax", this.LocalResourceFile);
                txtTaxRate.BorderColor = System.Drawing.Color.Red;
                txtTaxRate.ForeColor = System.Drawing.Color.Red;
                return;
            }
            else
            {
                lblError.Visible = false;
                txtTaxRate.BorderColor = System.Drawing.Color.Empty;
                txtTaxRate.ForeColor = System.Drawing.Color.Empty;
            }

            if (txtTaxRate.Text.Length > 0)
            {
                try
                {
                    rate = Decimal.Parse(txtTaxRate.Text);
                    lblError.Visible = false;
                    txtTaxRate.BorderColor = System.Drawing.Color.Empty;
                    txtTaxRate.ForeColor = System.Drawing.Color.Empty;
                    if (rate < 0)
                    {
                        throw new Exception();
                    }
                }
                catch (Exception)
                {
                    lblError.Visible = true;
                    lblError.Text = Localization.GetString("lblErrorTax", this.LocalResourceFile);
                    txtTaxRate.BorderColor = System.Drawing.Color.Red;
                    txtTaxRate.ForeColor = System.Drawing.Color.Red;
                    return;
                }
            }

            TaxController controller = new TaxController();
            controller.UpdateTaxRates(this.PortalId, rate, cbEnableTax.Checked);
        }