Beispiel #1
0
 public static decimal GetBasePrice(tbl_ProductPrice table)
 {
     return table.PR_OnSale ? table.PR_SalePrice.GetValueOrDefault(0) :
         table.tbl_Products.tbl_ProductTypes.PT_Name == ProductType.Event.ToString() ?
              table.GetCurrentPriceForEvent() : table.PR_Price;
 }
Beispiel #2
0
        public static decimal GetTaxPercentage(tbl_ProductPrice table)
        {
            IDomain domainService = (IDomain)DependencyResolver.Current.GetService<IDomain>();
            if (!domainService.GetSettingsValueAsBool(SettingsKey.useTax, table.tbl_Products.tbl_SiteMap.SM_DomainID))
                return 0;

            decimal tax = table.tbl_Products.P_TaxID.HasValue && table.tbl_Products.P_TaxID.Value != 0 ? table.tbl_Products.tbl_Tax.TA_Percentage.GetValueOrDefault(-1) : -1;

            if (tax == -1 && table.tbl_Products.tbl_ProdCategories.PC_TaxID.HasValue && table.tbl_Products.tbl_ProdCategories.PC_TaxID.Value != 0)
                tax = table.tbl_Products.tbl_ProdCategories.tbl_Tax.TA_Percentage.GetValueOrDefault(-1);

            if (tax == -1)
            {
                var parentCategory = table.tbl_Products.tbl_ProdCategories.tbl_ProdCategories2;
                while (parentCategory != null)
                {
                    if (parentCategory.PC_TaxID.HasValue && parentCategory.PC_TaxID.Value != 0)
                    {
                        tax = parentCategory.tbl_Tax.TA_Percentage.GetValueOrDefault(-1);
                        break;
                    }
                    parentCategory = parentCategory.tbl_ProdCategories2;
                }
            }

            if (tax == -1)
                tax = domainService.GetSettingsValueAsDecimal(SettingsKey.taxPercentage, table.tbl_Products.tbl_SiteMap.SM_DomainID);

            return tax != -1 ? tax : 0;
        }
Beispiel #3
0
        public static Tuple<decimal, decimal> GetPriceAndTaxAmounts(tbl_ProductPrice table, int amount)
        {
            decimal tax = PriceManager.GetTaxPercentage(table);
            decimal basePrice = PriceManager.GetBasePrice(table);

            return PriceManager.GetPrice(basePrice, tax, amount, table.tbl_Products.tbl_SiteMap.SM_DomainID);
        }
Beispiel #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tbl_ProductPrice EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotbl_ProductPrice(tbl_ProductPrice tbl_ProductPrice)
 {
     base.AddObject("tbl_ProductPrice", tbl_ProductPrice);
 }
Beispiel #5
0
 /// <summary>
 /// Create a new tbl_ProductPrice object.
 /// </summary>
 /// <param name="priceID">Initial value of the PriceID property.</param>
 /// <param name="pR_ProductID">Initial value of the PR_ProductID property.</param>
 /// <param name="pR_Price">Initial value of the PR_Price property.</param>
 /// <param name="pR_OnSale">Initial value of the PR_OnSale property.</param>
 public static tbl_ProductPrice Createtbl_ProductPrice(global::System.Int32 priceID, global::System.Int32 pR_ProductID, global::System.Decimal pR_Price, global::System.Boolean pR_OnSale)
 {
     tbl_ProductPrice tbl_ProductPrice = new tbl_ProductPrice();
     tbl_ProductPrice.PriceID = priceID;
     tbl_ProductPrice.PR_ProductID = pR_ProductID;
     tbl_ProductPrice.PR_Price = pR_Price;
     tbl_ProductPrice.PR_OnSale = pR_OnSale;
     return tbl_ProductPrice;
 }
Beispiel #6
0
 private bool IsActual(tbl_ProductPrice pp)
 {
     return pp.PR_EventEndDate.HasValue ? pp.PR_EventEndDate.Value > DateTime.Now : pp.PR_EventStartDate.GetValueOrDefault() > DateTime.Now;
 }