/// <summary>
    /// Returns DataSet with all the taxes which should be applied to the shopping cart items.
    /// </summary>
    /// <param name="cart">Shopping cart</param>
    protected override DataSet GetTaxesInternal(ShoppingCartInfo cart)
    {
        DataSet taxDataSet = new DataSet();
        // Create an empty taxes table
        DataTable     table   = GetNewTaxesTable();
        List <TaxRow> taxRows = new List <TaxRow>();

        foreach (ShoppingCartItemInfo item in cart.CartItems)
        {
            TaxRow row = new TaxRow();
            row.SKUID   = item.SKU.SKUID;
            row.SKUGUID = item.SKU.SKUGUID;
            taxRows.Add(row);
        }
        foreach (TaxRow row in taxRows)
        {
            double rate = 0;
            string name = "";
            // Add conditions for different tax rates here
            // --------------------------------------------
            // For Example
            if (cart.Customer.CustomerCountryID == countryYouWantToExclude)
            {
                rate = yourTaxRate;
                name = "Name for the tax";
            }
            else
            {
                rate = 0;
                name = "";
            }
            row.TaxRate = rate;
            row.TaxName = name;
        }
        BuildTaxTable(ref table, taxRows);

        // Return our dataset with the taxes
        taxDataSet.Tables.Add(table);
        return(taxDataSet);
    }
示例#2
0
 public TaxRowChangeEvent(TaxRow row, global::System.Data.DataRowAction action)
 {
     this.eventRow    = row;
     this.eventAction = action;
 }