Dynamicweb.eCommerce.Prices Namespace > Price Class : GetDoublePriceStatement Method |
class MyPage : System.Web.UI.Page { private Dynamicweb.eCommerce.Products.Product product; private void Page_Load(System.Object sender, System.EventArgs e) { product = (Dynamicweb.eCommerce.Products.Product)Session["Ecom.Backend.Product"]; } private int UpdateDoublePrice(UpdateType updateType) { System.Text.StringBuilder SQL = new System.Text.StringBuilder(); int updCnt = 0; string GetPrice = Dynamicweb.eCommerce.Prices.Price.GetDoublePriceStatement(product.ProductPriceString); if (!string.IsNullOrEmpty(GetPrice)) { SQL.Append("UPDATE EcomProducts SET ProductPrice = " + GetPrice + " "); string whereStatement = null; switch (updateType) { case Dynamicweb.eCommerce.Products.UpdateType.LanguageDependent: whereStatement = string.Format("ProductID = '{0}' AND ProductLanguageID = '{1}'", product.ID, product.LanguageID); break; case Dynamicweb.eCommerce.Products.UpdateType.VariantDependent: whereStatement = string.Format("ProductID = '{0}' AND ProductVariantID = '{1}'", product.ID, product.VariantID); break; case Dynamicweb.eCommerce.Products.UpdateType.NoDependencies: whereStatement = string.Format("ProductID = '{0}'", product.ID); break; default: whereStatement = string.Format("ProductID = '{0}' AND ProductLanguageID = '{1}' AND ProductVariantID = '{2}'", product.ID, product.LanguageID, product.VariantID); break; } SQL.Append("WHERE " + whereStatement); if (Database.ExecuteNonQuery(SQL.ToString(), "Ecom.mdb") > 0) { updCnt += 1; } } return updCnt; } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2