コード例 #1
0
 /// <summary>
 /// Loads the region code rates.
 /// </summary>
 private void LoadRegionCodeRates()
 {
     RegionCodeTaxRateCollection regionCodeTaxRateCollection = new RegionCodeTaxRateController().FetchAll();
       if(regionCodeTaxRateCollection.Count > 0) {
     pnlAvailableRegionCodes.Visible = true;
     dgRegionCode.DataSource = regionCodeTaxRateCollection;
     dgRegionCode.ItemDataBound += new DataGridItemEventHandler(dgRegionCode_ItemDataBound);
     dgRegionCode.Columns[0].HeaderText = LocalizationUtility.GetText("hdrRegionCode");
     dgRegionCode.Columns[1].HeaderText = LocalizationUtility.GetText("hdrRate");
     dgRegionCode.Columns[2].HeaderText = LocalizationUtility.GetText("lblDelete");
     dgRegionCode.DataBind();
       }
       else {
     pnlAvailableRegionCodes.Visible = false;
       }
 }
コード例 #2
0
 /// <summary>
 /// Handles the Delete event of the dgRegionCode control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.Web.UI.WebControls.CommandEventArgs"/> instance containing the event data.</param>
 protected void dgRegionCode_Delete(object sender, CommandEventArgs e)
 {
     try {
     int rateId = 0;
     int.TryParse(e.CommandArgument.ToString(), out rateId);
     bool deleted = new RegionCodeTaxRateController().Delete(rateId);
     LoadRegionCodeRates();
     base.MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblRateDeleted"));
       }
       catch(Exception ex) {
     Logger.Error(typeof(regioncodeconfiguration).Name + ".dgRegionCode_Delete", ex);
     base.MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message);
       }
 }