protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (SKUID > 0) { InitializeControls(); if (!mDataLoaded) { ReloadData(); } // Set visibility for horizontal line (separator) between stock and selectors pnlSeparator.Visible = ShowProductOptions && SKUHasOptions; // Get count of the product options if (ShowTotalPrice && SKUHasOptions) { // Count and show total price with options CalculateTotalPrice(); // Use default label lblPrice.Text = GetString("ShoppingCartItemSelector.TotalPrice"); pnlPrice.Visible = true; } else { // Hide total price container pnlPrice.Visible = false; } if (DialogMode) { pnlButton.CssClass += " PageFooterLine"; } } hdnSKUID.Value = SKUID.ToString(); // Show panel only when some selectors loaded pnlSelectors.Visible = ShowProductOptions && SKUHasOptions; if (pnlSelectors.Visible) { SetDisabledProductOptions(); } }
static void Main(string[] args) { Console.WriteLine("Total number of order(s)"); int totalOreder = Convert.ToInt32(Console.ReadLine()); // Providing the valid SKU IDs to end user. Console.WriteLine("Please provide product type from the below given list"); foreach (var item in SKUID.SKUIDs) { Console.WriteLine(item); } Console.WriteLine("========================================="); // [Interface Repository pattern] Which can be provided as dependent service to client class using DI. ICartService _cart = new CartService(); for (int i = 0; i < totalOreder; i++) { Console.WriteLine("Enter the product type"); string productType = Console.ReadLine(); // SKU ID validtaion for the Product which is going to be added into the order list. if (!SKUID.CheckSkuId(productType)) { Console.WriteLine("Please provide valid product type."); return; } // Adding the Products having SKUIDs -> A, B, C, D. Product prod = new Product { Id = productType }; _cart.AddProduct(prod); } // Getting the Total Order price. decimal totalPrice = _cart.GetWholeOrderTotalPrice(); Console.WriteLine("========================================="); Console.WriteLine("Your Total Order Value: {0}", totalPrice); Console.ReadLine(); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (SKUID > 0) { InitializeControls(); if (!mDataLoaded) { ReloadData(); } // Set visibility for horizontal line (separator) between stock and selectors pnlSeparator.Visible = ShowProductOptions && SKUHasOptions; if (StockVisible) { SetStockInformation(); lblStock.Text = GetString("com.shoppingcartitemselector.stock"); pnlStock.Visible = true; } // Get count of the product options if (AlwaysShowTotalPrice || (ShowTotalPrice && SKUHasOptions)) { // Count and show total price with options CalculateTotalPrice(); // Show info message if selected variant is invalid EnsureUnavailableVariantMessage(); if (!string.IsNullOrEmpty(TotalPriceLabel)) { // Use custom label lblPrice.Text = GetString(TotalPriceLabel); } else { // Use default label lblPrice.Text = GetString("ShoppingCartItemSelector.TotalPrice"); } pnlPrice.Visible = true; } else { // Hide total price container pnlPrice.Visible = false; } if (DialogMode) { pnlButton.CssClass += " PageFooterLine"; } } hdnSKUID.Value = SKUID.ToString(); // Show panel only when some selectors loaded pnlSelectors.Visible = ShowProductOptions && SKUHasOptions; if (pnlSelectors.Visible) { SetDisabledProductOptions(); } }