Ejemplo n.º 1
0
        private void AddTax()
        {
            // ensure page validity
            if (!Page.IsValid)
            {
                return;
            }

            try
            {
                //
                string description = txtDescription.Text.Trim();
                //
                string country = ddlCountries.SelectedValue;
                //
                string state = String.Empty;
                if (chkAllStates.Checked)
                {
                    state = ALL_STATES;
                }
                else
                {
                    state = (ddlStates.Visible) ? ddlStates.SelectedValue : txtStateProvince.Text.Trim();
                }
                //
                int taxTypeId = Convert.ToInt32(ddlTaxType.SelectedValue);
                //
                bool active = Convert.ToBoolean(rblTaxStatus.SelectedValue);
                //
                decimal amount = Convert.ToDecimal(txtTaxAmount.Text.Trim());
                //
                int result = StorehouseHelper.AddTaxation(country, state, description, taxTypeId,
                                                          amount, active);
                //
                if (result < 0)
                {
                    //
                    ShowResultMessage(Keys.ModuleName, result, country, state);
                    //
                    return;
                }
                //
                RedirectToBrowsePage();
            }
            catch (Exception ex)
            {
                ShowErrorMessage("SAVE_TAX", ex);
            }
        }