/// <summary> /// Gets the tax rate. /// </summary> /// <param name="order"></param> public void GetTaxRate(Order order) { string postalCode = order.ShippingAddress == null ? order.BillingAddress.PostalCode : order.ShippingAddress.PostalCode; RegionCodeTaxRate regionCodeTaxRate = new RegionCodeTaxRate(RegionCodeTaxRate.Columns.RegionCode, postalCode); foreach(OrderItem orderItem in order.OrderItemCollection) { if(regionCodeTaxRate.RegionCodeTaxRateId > 0) { orderItem.ItemTax = (orderItem.PricePaid - orderItem.DiscountAmount) * regionCodeTaxRate.Rate; } else { orderItem.ItemTax = (orderItem.PricePaid - orderItem.DiscountAmount) * _defaultTaxRate; } } }
/// <summary> /// Gets the tax rate. /// </summary> /// <param name="order"></param> public void GetTaxRate(Order order) { string postalCode = order.ShippingAddress == null ? order.BillingAddress.PostalCode : order.ShippingAddress.PostalCode; RegionCodeTaxRate regionCodeTaxRate = new RegionCodeTaxRate(RegionCodeTaxRate.Columns.RegionCode, postalCode); foreach (OrderItem orderItem in order.OrderItemCollection) { if (regionCodeTaxRate.RegionCodeTaxRateId > 0) { orderItem.ItemTax = (orderItem.PricePaid - orderItem.DiscountAmount) * regionCodeTaxRate.Rate; } else { orderItem.ItemTax = (orderItem.PricePaid - orderItem.DiscountAmount) * _defaultTaxRate; } } }
/// <summary> /// Handles the Click event of the btnAdd control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected void btnAdd_Click(object sender, EventArgs e) { try { RegionCodeTaxRate regionCodeTaxRate = new RegionCodeTaxRate(); regionCodeTaxRate.RegionCode = txtRegionCode.Text.Trim(); decimal rate = 0.00M; decimal.TryParse(txtRate.Text.Trim(), out rate); regionCodeTaxRate.Rate = rate; regionCodeTaxRate.Save(); LoadRegionCodeRates(); txtRegionCode.Text = string.Empty; txtRate.Text = string.Empty; base.MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblRateAdded")); } catch (Exception ex) { Logger.Error(typeof(regioncodeconfiguration).Name + ".btnAdd_Click", ex); base.MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message); } }
/// <summary> /// Handles the Click event of the btnAdd control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected void btnAdd_Click(object sender, EventArgs e) { try { RegionCodeTaxRate regionCodeTaxRate = new RegionCodeTaxRate(); regionCodeTaxRate.RegionCode = txtRegionCode.Text.Trim(); decimal rate = 0.00M; decimal.TryParse(txtRate.Text.Trim(), out rate); regionCodeTaxRate.Rate = rate; regionCodeTaxRate.Save(); LoadRegionCodeRates(); txtRegionCode.Text = string.Empty; txtRate.Text = string.Empty; base.MasterPage.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblRateAdded")); } catch(Exception ex) { Logger.Error(typeof(regioncodeconfiguration).Name + ".btnAdd_Click", ex); base.MasterPage.MessageCenter.DisplayCriticalMessage(ex.Message); } }
public void Insert(decimal Rate,string RegionCode,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn) { RegionCodeTaxRate item = new RegionCodeTaxRate(); item.Rate = Rate; item.RegionCode = RegionCode; item.CreatedBy = CreatedBy; item.CreatedOn = CreatedOn; item.ModifiedBy = ModifiedBy; item.ModifiedOn = ModifiedOn; item.Save(UserName); }
public void Update(int RegionCodeTaxRateId,decimal Rate,string RegionCode,string CreatedBy,DateTime CreatedOn,string ModifiedBy,DateTime ModifiedOn) { RegionCodeTaxRate item = new RegionCodeTaxRate(); item.RegionCodeTaxRateId = RegionCodeTaxRateId; item.Rate = Rate; item.RegionCode = RegionCode; item.CreatedBy = CreatedBy; item.CreatedOn = CreatedOn; item.ModifiedBy = ModifiedBy; item.ModifiedOn = ModifiedOn; item.MarkOld(); item.Save(UserName); }