コード例 #1
0
ファイル: Form1.cs プロジェクト: TimMeijvogel/Calculator
 private void ClearButton_Click(object sender, EventArgs e)
 {
     FirstNumberTextBox.Clear();
     SecondNumberTextBox.Clear();
     DoubleTextBox.Clear();
     DecimalTextBox.Clear();
 }
コード例 #2
0
        protected void gvShippingByTotals_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "UpdateShippingByTotal")
            {
                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row   = gvShippingByTotals.Rows[index];

                HiddenField    hfShippingByTotalID = row.FindControl("hfShippingByTotalID") as HiddenField;
                DropDownList   ddlShippingMethod   = row.FindControl("ddlShippingMethod") as DropDownList;
                DecimalTextBox txtFrom             = row.FindControl("txtFrom") as DecimalTextBox;
                DecimalTextBox txtTo                       = row.FindControl("txtTo") as DecimalTextBox;
                CheckBox       cbUsePercentage             = row.FindControl("cbUsePercentage") as CheckBox;
                DecimalTextBox txtShippingChargePercentage = row.FindControl("txtShippingChargePercentage") as DecimalTextBox;
                DecimalTextBox txtShippingChargeAmount     = row.FindControl("txtShippingChargeAmount") as DecimalTextBox;

                int             shippingByTotalID = int.Parse(hfShippingByTotalID.Value);
                int             shippingMethodID  = int.Parse(ddlShippingMethod.SelectedItem.Value);
                ShippingByTotal shippingByTotal   = ShippingByTotalManager.GetByID(shippingByTotalID);

                if (shippingByTotal != null)
                {
                    ShippingByTotalManager.UpdateShippingByTotal(shippingByTotal.ShippingByTotalID,
                                                                 shippingMethodID, txtFrom.Value, txtTo.Value, cbUsePercentage.Checked,
                                                                 txtShippingChargePercentage.Value, txtShippingChargeAmount.Value);
                }

                BindData();
            }
        }
コード例 #3
0
        protected void gvShippingByWeights_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "UpdateShippingByWeight")
            {
                int         index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row   = gvShippingByWeights.Rows[index];

                HiddenField    hfShippingByWeightId = row.FindControl("hfShippingByWeightId") as HiddenField;
                DropDownList   ddlShippingMethod    = row.FindControl("ddlShippingMethod") as DropDownList;
                DecimalTextBox txtFrom                     = row.FindControl("txtFrom") as DecimalTextBox;
                DecimalTextBox txtTo                       = row.FindControl("txtTo") as DecimalTextBox;
                CheckBox       cbUsePercentage             = row.FindControl("cbUsePercentage") as CheckBox;
                DecimalTextBox txtShippingChargePercentage = row.FindControl("txtShippingChargePercentage") as DecimalTextBox;
                DecimalTextBox txtShippingChargeAmount     = row.FindControl("txtShippingChargeAmount") as DecimalTextBox;

                int shippingByWeightId            = int.Parse(hfShippingByWeightId.Value);
                int shippingMethodId              = int.Parse(ddlShippingMethod.SelectedItem.Value);
                ShippingByWeight shippingByWeight = this.ShippingByWeightService.GetById(shippingByWeightId);

                if (shippingByWeight != null)
                {
                    shippingByWeight.ShippingMethodId = shippingMethodId;
                    shippingByWeight.From             = txtFrom.Value;
                    shippingByWeight.To                       = txtTo.Value;
                    shippingByWeight.UsePercentage            = cbUsePercentage.Checked;
                    shippingByWeight.ShippingChargePercentage = txtShippingChargePercentage.Value;
                    shippingByWeight.ShippingChargeAmount     = txtShippingChargeAmount.Value;

                    this.ShippingByWeightService.UpdateShippingByWeight(shippingByWeight);
                }

                BindData();
            }
        }
コード例 #4
0
        public void Save()
        {
            foreach (GridViewRow row in gvTaxCategories.Rows)
            {
                DecimalTextBox txtRate         = row.FindControl("txtRate") as DecimalTextBox;
                HiddenField    hfTaxCategoryId = row.FindControl("hfTaxCategoryId") as HiddenField;

                int     taxCategoryId = int.Parse(hfTaxCategoryId.Value);
                decimal rate          = txtRate.Value;

                this.SettingManager.SetParamNative(string.Format("Tax.TaxProvider.FixedRate.TaxCategoryId{0}", taxCategoryId), rate);
            }
        }
コード例 #5
0
        protected void gvTaxCategories_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                TaxCategory taxCategory = (TaxCategory)e.Row.DataItem;

                DecimalTextBox txtRate = e.Row.FindControl("txtRate") as DecimalTextBox;
                if (txtRate != null)
                {
                    txtRate.Value = this.SettingManager.GetSettingValueDecimalNative(string.Format("Tax.TaxProvider.FixedRate.TaxCategoryId{0}", taxCategory.TaxCategoryId));
                }
            }
        }
コード例 #6
0
        public void Save()
        {
            foreach (GridViewRow row in gvShippingMethods.Rows)
            {
                DecimalTextBox txtRate            = row.FindControl("txtRate") as DecimalTextBox;
                HiddenField    hfShippingMethodId = row.FindControl("hfShippingMethodId") as HiddenField;

                int     shippingMethodId = int.Parse(hfShippingMethodId.Value);
                decimal rate             = txtRate.Value;

                this.SettingManager.SetParamNative(string.Format("ShippingRateComputationMethod.FixedRate.Rate.ShippingMethodId{0}", shippingMethodId), rate);
            }
        }
コード例 #7
0
        protected void gvShippingMethods_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                ShippingMethod shippingMethod = (ShippingMethod)e.Row.DataItem;

                DecimalTextBox txtRate = e.Row.FindControl("txtRate") as DecimalTextBox;
                if (txtRate != null)
                {
                    txtRate.Value = this.SettingManager.GetSettingValueDecimalNative(string.Format("ShippingRateComputationMethod.FixedRate.Rate.ShippingMethodId{0}", shippingMethod.ShippingMethodId));
                }
            }
        }