System;
using
System.Text;
using
System.Threading;
using
System.Collections;
using
System.Collections.Generic;
using
System.IO;
using
System.Net;
using
System.Text.RegularExpressions;
using
System.Web.UI;
using
System.Web.UI.HtmlControls;
using
System.Web.UI.WebControls;
using
DotNetNuke.Common;
using
DotNetNuke.Common.Utilities;
using
DotNetNuke.Entities.Modules;
using
DotNetNuke.Modules.Store.Components;
using
DotNetNuke.Services.Exceptions;
using
DotNetNuke.Modules.Store.Admin;
using
DotNetNuke.Modules.Store.Cart;
using
DotNetNuke.Modules.Store.Catalog;
using
DotNetNuke.Modules.Store.Catalog.VPOD;
using
DotNetNuke.Modules.Store.Catalog.DotEDIT;
using
DotNetNuke.Modules.Store.Catalog.ProductChoices;
using
DotNetNuke.Store.UI.Library.WebServices;
using
Shamrock.PageFlex.WebServices;
using
DotNetNuke.Services.Localization;
using
Shamrock.DotEDIT;
namespace
{
DotNetNuke.Modules.Store.WebControls/// <summary>
/// Summary description for Media.
/// </summary>
{
public class ProductDetail : StoreControlBaseprivate enum PODPanelType
{
ProductInfo,
FormFilling,
ViewProof,
}
#region
Private Declarationsprivate static Regex _isNumber = new Regex(@"^\d+$");private CatalogNavigation catalogNav;private ProductInfo productInfo = null;private List<ProductChoiceInfo> _productChoices = null;private bool _productAvailable = true;private PODPanelType _podPanelType = PODPanelType.ProductInfo;private StoreInfo _storeInfo = null;private int categoryID = 0;private int productID = 0;private bool showThumbnail = true;private int thumbnailWidth = 90;private bool showAddToCart = true;private string nonInventoryChoiceControlID = "nicNonInventoryChoices";private string quantityControlID = "ctlQuantity";private Panel detailTemplateHolder = null;private Panel detailDotEditHolder = null;private Panel detailFFHolder = null;private Panel detailProofHolder = null;private bool _showInStock = false;private LinkButton addToCartButton = null;private DotEDITControl dotEditControl = null;private TextBox txtSubTotal;private bool _hasInventoryChoice;
#region
Controlsprotected Panel pnlDetails;protected PlaceHolder plhDetails;protected PlaceHolder plhReviews;protected System.Web.UI.WebControls.Label labelReviews;protected HyperLink lnkReturn;protected Telerik.WebControls.RadAjaxManager ajaxManagerProductDetail;protected Telerik.WebControls.AjaxLoadingPanel AjaxLoadingPanel1;protected Telerik.WebControls.AjaxLoadingPanel AjaxLoadingPanel_VpodControlPane;protected Telerik.WebControls.AjaxLoadingPanel pnlSubTotalLoading;protected Telerik.WebControls.AjaxLoadingPanel pnlProductImageLoading;private LinkButton testAjaxButton = null;private Label testAjaxLabel = null;private HtmlGenericControl proofImage = null;private LinkButton viewProofButton = null;Catalog parent = null;ImageButton productProofDetailPageImageLink = null;protected Telerik.WebControls.RadWindowManager rwmProductDetail;protected Telerik.WebControls.RadWindow rwOKCancel;
#endregion
#endregion
#region
Constantspublic readonly string sessionVPODPrefix = "StoreFront4!VPODPrefix";public readonly string sessionDotEDITPrefix = "StoreFront4!DotEDITPrefix";public readonly string sessionGUIDKey = "__VPOD_GUID__";public readonly string singleScreenVPODWizardID = "vpodSingleScreen";private readonly string sessionKey = "AddToCartVPODProject";private readonly string sessionGuidKey = "AddToCartVPODProjectGUID";
#endregion
#region
Web Form Designer generated codeoverride protected void OnInit(EventArgs e) {//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
}
base.OnInit(e);/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
}
private void InitializeComponent() {this.Load += new System.EventHandler(this.Page_Load);this.PreRender += new EventHandler(ProductDetail_PreRender);
#endregion
#region
*
* There is no theory of evolution. Just a list of creatures Chuck Norris has allowed to live.
*
*/
Eventsprivate void Page_Load(object sender, System.EventArgs e) {/* Chuck Norris Fact #136:
_storeInfo =
parent = (
catalogNav =
productInfo = (dataSource
Trace.Write(
_productChoices =
Trace.Write(
_showInStock =
}
}
_showInStock =
productID = productInfo.ProductID;
new StoreController().GetStoreInfo(this.PortalId);Catalog)parentControl;new CatalogNavigation(Request.QueryString);as ProductInfo);if (productInfo != null) {"begin get choices");new ProductChoiceController().GetChoicesByProduct(productInfo.ProductID);"end get choices");ProductChoiceInfo inventoryProductChoice = _productChoices.Find(new Predicate<ProductChoiceInfo>(ChoiceIsInventoryChoice));foreach (ProductChoiceInfo choice in _productChoices) {if (choice.ChoiceItems.Count > 0) {true;break;if (productInfo.IsSimpleProduct)true;//TFS-847 and TFS-848 - 9/20/2006 - CJT
// now using a tiered approach like we did on the store menu module. There ill be a mster template that
// convers the layout of the product detail page and then some new skin controsl that
// make the customization much prettier and puts it into panels rather than lumping it all on one page
Trace.Write(
pnlDetails.Controls.Add(
Trace.Write(
}
products.Add(dataSource);
lnkReturn.NavigateUrl = GetReturnUrl(categoryID);
Trace.Write(
PrepareInStockDisplay();
Trace.Write(
"Begin Parse Template");TemplateController.ParseTemplate(parent.ModuleSettings.ProductDetail.MasterTemplate, new ProcessTokenDelegate(processMasterTokens)));"End Parse Template");ArrayList products = new ArrayList();"Begin InStock Display");"END InStock Display");//if (!Page.IsStartupScriptRegistered("subTotalInit") && _productAvailable)
// Page.RegisterStartupScript("subTotalInit",
// "<script language=\"javascript\">var origSubTotal = document.forms[0]." + subTotalTextBoxClientID + ".value;</script>");
{
Page.RegisterClientScriptBlock(
}
}
if (!Page.IsClientScriptBlockRegistered("radWindowNotificaiton") && _productAvailable)ChoiceQuantityControl quantityChoiceControl = this.FindControl(quantityControlID) as ChoiceQuantityControl;QuantityControl qtyControl = this.FindControl(quantityControlID) as QuantityControl;string controlId = quantityChoiceControl == null ? qtyControl.AddToCartLinkButton.ClientID : quantityChoiceControl.AddToCartLinkButton.ClientID;"radWindowNotification","<script language=\"javascript\">function RadWindowCallback(returnValue) { document.getElementById(\"" + controlId + "\").click()}</script>");private void PrepareInStockDisplay() {ChoiceQuantityControl quantityControl = null;QuantityControl qtyControl = null;ProductChoiceController productChoiceController = new ProductChoiceController();ProductChoiceInfo inventoryProductChoice = _productChoices.Find(new Predicate<ProductChoiceInfo>(ChoiceIsInventoryChoice));List<ProductChoiceSelection> nonInventorySelections = new List<ProductChoiceSelection>();List<ProductChoiceSelection> inventorySelections = new List<ProductChoiceSelection>();Label lblOnHandQty = null;Label lblNotAvailable = this.FindControl("lblNotAvailable") as Label;
#region
quantityControl =
txtSubTotal = (
quantityControl.Visible =
lblNotAvailable.Visible =
Inventory Choicesif (inventoryProductChoice != null) {this.FindControl(quantityControlID) as ChoiceQuantityControl;TextBox)quantityControl.FindControl("subTotal");if (inventoryProductChoice.ChoiceItems.Count == 0) {false;if (lblNotAvailable != null)true; // Text = "This product is not currently available.";
_productAvailable =
}
false;else {foreach (ProductChoiceItemInfo productChoiceItem in inventoryProductChoice.ChoiceItems) {// Get currently available choices for initial display of stock level
inventorySelections.Add(
}
}
}
qtyControl =
txtSubTotal = (
}
new ProductChoiceSelection(productChoiceItem.ChoiceID, productChoiceItem.ID));else {this.FindControl(quantityControlID) as QuantityControl;TextBox)qtyControl.FindControl("subTotal");
#endregion
#region
(
.FindControl(
NonInventory ChoicesNonInventoryChoiceControl nonInventoryChoicesControl = (NonInventoryChoiceControl)this.FindControl(nonInventoryChoiceControlID);if (nonInventoryChoicesControl != null) {foreach (ProductChoiceInfo productChoice in _productChoices) {ListControl nonInventoryChoiceControl =ListControl)nonInventoryChoicesControlNonInventoryChoiceControl.ProductChoiceControlPrefix + productChoice.ID.ToString());if (nonInventoryChoiceControl != null) {// Get currently selected choices for initial display of stock level
nonInventorySelections.Add(
}
}
}
if (productChoice.ChoiceItems.Count > 0)new ProductChoiceSelection(productChoice.ID, int.Parse(nonInventoryChoiceControl.SelectedValue)));
#endregion
Label lblError = this.FindControl("lblProductChoiceError") as Label;//if (lblError != null)
// invalidSelectionErrorTextBoxClientID = lblError.ClientID;
IsVirtualPostBack =
if (!IsVirtualPostBack) {true;// Display initial stock levels on first load
DisplayStockLevels(inventorySelections, nonInventorySelections, quantityControl, qtyControl);
}
if (_showInStock)// Check if the product has any inventory and non-inventory selections
// If not and it is a "normal" product, it is not available
inventorySelections.Count == 0 &&
!productInfo.IsSimpleProduct) {
if (nonInventorySelections.Count == 0 &&// Product is not available
qtyControl =
quantityChoiceControl.Visible =
qtyControl.Visible =
nonInventoryChoicesControl.Visible =
ChoiceQuantityControl quantityChoiceControl = this.FindControl(quantityControlID) as ChoiceQuantityControl;this.FindControl(quantityControlID) as QuantityControl;if (quantityChoiceControl != null)false;if (qtyControl != null)false;if (nonInventoryChoicesControl != null)false;if (_productAvailable) {// If the "not available" label hasnt already been added, add it
lblNotAvailable.Visible =
if (lblNotAvailable != null)true; // "This product is not currently available.";
_productAvailable =
}
}
Trace.Write(
PrepareAjax();
Trace.Write(
}
ajaxManagerProductDetail.AjaxSettings.AddAjaxSetting(testAjaxButton, testAjaxLabel, AjaxLoadingPanel1);
ajaxManagerProductDetail.AjaxSettings.AddAjaxSetting(viewProofButton, proofImage, AjaxLoadingPanel1);
ajaxManagerProductDetail.AjaxSettings.AddAjaxSetting(viewProofButton, vpodHostPanel, AjaxLoadingPanel1);
false;"Being PrepareAjax");"End PrepareAjax");private void PrepareAjax() {if ((testAjaxLabel != null) && (testAjaxButton != null))if ((viewProofButton != null) && (proofImage != null))if ((viewProofButton != null) && (vpodHostPanel != null))
#region
quantityPanels = choiceQuantityControl.QuantityPanels;
quantityTextBoxes = choiceQuantityControl.QuantityTextBoxes;
pnlSubTotal = choiceQuantityControl.FindControl(
btnAddToCart = choiceQuantityControl.AddToCartLinkButton;
}
pnlSubTotal = quantityControl.FindControl(
quantityPanels.Add(quantityControl.FindControl(
quantityTextBoxes.Add(quantityControl.FindControl(
btnAddToCart = quantityControl.AddToCartLinkButton;
}
AjaxSettings for subtotal calculationsList<Panel> quantityPanels = new List<Panel>();List<TextBox> quantityTextBoxes = new List<TextBox>();List<ListControl> choiceDropDowns = new List<ListControl>();Panel pnlProductImage = this.FindControl("pnlProductImage") as Panel;Panel pnlProductChoiceError = this.FindControl("pnlProductChoiceError") as Panel;Panel pnlSubTotal;NonInventoryChoiceControl nonInventoryChoicesControl = this.FindControl(nonInventoryChoiceControlID) as NonInventoryChoiceControl;LinkButton btnAddToCart;if (_hasInventoryChoice) {ChoiceQuantityControl choiceQuantityControl = this.FindControl(quantityControlID) as ChoiceQuantityControl;"pnlSubTotal") as Panel;else {QuantityControl quantityControl = (QuantityControl)this.FindControl(quantityControlID);"pnlSubTotal") as Panel;"pnlQuantity") as Panel);"txtQuantity") as TextBox);// Get the noninventory choice dropdowns if they exist
choiceDropDowns = nonInventoryChoicesControl.ChoiceDropDowns;
if (nonInventoryChoicesControl != null)// Add ajaxSettings for noninventory choice dropdowns
ajaxManagerProductDetail.AjaxSettings.AddAjaxSetting(ddl, pnlSubTotal, pnlSubTotalLoading);
ajaxManagerProductDetail.AjaxSettings.AddAjaxSetting(ddl, pnlProductChoiceError,
ajaxManagerProductDetail.AjaxSettings.AddAjaxSetting(ddl, pnlProductImage, pnlProductImageLoading);
foreach (ListControl ddl in choiceDropDowns) {if (pnlProductChoiceError != null)null);//foreach (Panel pnlQuantity in quantityPanels)
// ajaxManagerProductDetail.AjaxSettings.AddAjaxSetting(ddl, pnlQuantity, null);
}
// Add ajaxSettings for the quantity textboxes
ajaxManagerProductDetail.AjaxSettings.AddAjaxSetting(txtQuantity, pnlSubTotal, pnlSubTotalLoading);
ajaxManagerProductDetail.AjaxSettings.AddAjaxSetting(txtQuantity, pnlProductChoiceError,
foreach (TextBox txtQuantity in quantityTextBoxes) {if (pnlProductChoiceError != null)null);//foreach (Panel pnlQuantity in quantityPanels)
// ajaxManagerProductDetail.AjaxSettings.AddAjaxSetting(txtQuantity, pnlQuantity, null);
}
#endregion
}
private void ProductDetail_PreRender(object sender, EventArgs e) {// Messy, perhaps, but necessary - set up the "Add To Cart" button to first invoke the proper save function.
dotEditControl.AssociateButtonWithSubroutine(addToCartButton,
if (addToCartButton != null && dotEditControl != null)if (dotEditControl.Config.GenerateStandardSaveFunction)"StandardSave");//// Associate "3" button with StandardSave function
//if (productProofDetailPageImageLink != null && dotEditControl != null) {
// if (dotEditControl.Config.GenerateStandardSaveFunction) {
// //dotEditControl.AssociateButtonWithSubroutine(productProofDetailPageImageLink, "StandardSave");
// productProofDetailPageImageLink.OnClientClick = string.Format("{0}.doAction('subroutine','{1}');return true;", dotEditControl.Config.APIAppletName, "StandardSave");
// }
//}
Page.RegisterClientScriptBlock(
detailProofHolder.Visible =
detailDotEditHolder.Visible =
detailTemplateHolder.Visible =
Page.RegisterStartupScript(
detailDotEditHolder.ClientID, detailProofHolder.ClientID));
}
detailProofHolder.Visible =
Page.RegisterStartupScript(
detailDotEditHolder.ClientID, detailTemplateHolder.ClientID));
if (!Page.IsClientScriptBlockRegistered("toggleLayerScript"))"toggleLayerScript", DotNetNuke.Store.UI.Library.Properties.Settings.Default.javascript_ShowHideDiv);if ((detailDotEditHolder != null) && (detailProofHolder != null)) {true;true;true;if (_podPanelType == PODPanelType.ProductInfo) {if (!Page.IsStartupScriptRegistered("toggleLayerStartupScript"))"toggleLayerStartupScript",string.Format(@"<script language=""javascript"">toggleBox('{0}',0);toggleBox('{1}',0)</script>",else if (_podPanelType == PODPanelType.FormFilling) {if (!Page.IsStartupScriptRegistered("toggleLayerStartupScript3")) {if (!Page.IsValid)false;if (detailDotEditHolder != null)"toggleLayerStartupScript3",string.Format(@"<script language=""javascript"">toggleBox('{0}',1);toggleBox('{1}',0)</script>",else
Page.RegisterStartupScript(
detailFFHolder.ClientID, detailTemplateHolder.ClientID));
}
}
Page.RegisterStartupScript(
detailDotEditHolder.ClientID, detailTemplateHolder.ClientID));
}
}
}
"toggleLayerStartupScript3",string.Format(@"<script language=""javascript"">toggleBox('{0}',1);toggleBox('{1}',0)</script>",else if (_podPanelType == PODPanelType.ViewProof) {if (!Page.IsStartupScriptRegistered("toggleLayerStartupScript2"))"toggleLayerStartupScript2",string.Format(@"<script language=""javascript"">toggleBox('{0}',0);toggleBox('{1}',0)</script>",private void DisplayStockLevels(List<ProductChoiceSelection> inventorySelections, List<ProductChoiceSelection> nonInventorySelections, ChoiceQuantityControl quantityControl, QuantityControl qtyControl) {ProductChoiceController productChoiceController = new ProductChoiceController();List<ProductChoiceSelection> stockSelectionsList = new List<ProductChoiceSelection>();int onHandQty = 0;int key = 0;InventoryKeyInfo configuredProduct = null;Label lblOnHandQty = null;if (inventorySelections.Count > 0) {// Inventory selections exist
stockSelectionsList.Add(ivChoice);
stockSelectionsList.Add(nonIVChoice);
}
key = productChoiceController.GetInventoryKeyID(stockSelectionsList, productInfo.ProductID);
configuredProduct = productChoiceController.GetInventoryKey(key);
onHandQty = configuredProduct.InventoryQuantity;
lblOnHandQty = (
.FindControl(
lblOnHandQty.Text = productInfo.IsVPOD ?
}
stockSelectionsList.Clear();
}
}
foreach (ProductChoiceSelection ivChoice in inventorySelections) {foreach (ProductChoiceSelection nonIVChoice in nonInventorySelections) {if (key > 0) {Label)quantityControlChoiceQuantityControl.ProductInventoryChoiceControlStockLabelPrefix + ivChoice.ChoiceItemID.ToString());"Available" : onHandQty.ToString();else { //if (inventorySelections.Count > 0)
// No inventory selections, check for non-inventory selections
stockSelectionsList.Add(nonIVChoice);
}
key = productChoiceController.GetInventoryKeyID(stockSelectionsList, productInfo.ProductID);
configuredProduct = productChoiceController.GetInventoryKey(key);
onHandQty = configuredProduct.InventoryQuantity;
lblOnHandQty = (
.FindControl(
lblOnHandQty.Text = productInfo.IsVPOD ?
if (nonInventorySelections.Count > 0) {foreach (ProductChoiceSelection nonIVChoice in nonInventorySelections) {if (key > 0) {Label)qtyControlQuantityControl.InStockLabelID);if (qtyControl.PersonalizeAvQtyCssClass == "personalizeNow")"Yes" : onHandQty.ToString();else
lblOnHandQty.Text = productInfo.IsVPOD ?
}
}
onHandQty = productInfo.SimpleProductInventoryQuantity;
lblOnHandQty = (
.FindControl(
lblOnHandQty.Text = productInfo.IsVPOD ?
"Available" : onHandQty.ToString();else if (productInfo.IsSimpleProduct) {Label)qtyControlQuantityControl.InStockLabelID);if (qtyControl.PersonalizeAvQtyCssClass == "personalizeNow")"Yes" : onHandQty.ToString();else
lblOnHandQty.Text = productInfo.IsVPOD ?
}
}
"Available" : onHandQty.ToString();//if (inventorySelections.Count > 0)
}
// Yes... we all know this routine needs to be ****in' refactored... soon.
(_storeInfo.ValidateInStockSetting ==
private void btnAddToCart_Click(object sender, EventArgs e) {string errorMessage = "";decimal subTotal = 0;string quantities = "";string imageLocation = "";string inStockValuesList = "";bool validateInStock =ValidateInStockType.Always || _storeInfo.ValidateInStockSetting == ValidateInStockType.ProductDetailOnly || _storeInfo.ValidateInStockSetting== ValidateInStockType.NotifyCSRPopup);// quantity validation
bool isMultipleQtyValid = true;bool isInRange = true;int tmpInventoryKey = -1;int quantity;bool validPurchase = true;bool validMinMaxMult = true;bool userAddedMoreThanInStock = false;bool instanceuserAddedMoreThanInStock = false;string choicesText = "";string notifyChoicesText = "";string quantityValidationErrMsg = "";InventoryKeyInfo configuredProduct = null;bool anyMinMaxMultErrors = false;//InStockWarningDisplayed = false;
LinkButton button = (sender as LinkButton);//LinkButton btnContinueAddToCart = this.FindControl("btnContinueAddToCart") as LinkButton;
//Label lblContinueAddToCart = this.FindControl("lblContinueAddToCart") as Label;
//btnContinueAddToCart.Visible = false;
//lblContinueAddToCart.Visible = false;
if (button != null) {// Instead, take the user to the custom AddToCart control / wizard.
catalogNav.ProductID =
if (button.CommandArgument.Length > 0)int.Parse(button.CommandArgument);else
catalogNav.ProductID =
this.ProductID;ProductChoiceController productChoiceController = new ProductChoiceController();List<ProductChoiceSelection> selections = new List<ProductChoiceSelection>();string nonInventoryChoices = string.Empty;//TODO: Need to move this so that it puts NV pairs in a CSV list
(
.FindControl(
selections.Add(
nonInventoryChoices +=
productChoice.ID, nonInventoryChoiceControl.SelectedValue);
}
}
}
nonInventoryChoices = nonInventoryChoices.Substring(0, nonInventoryChoices.Length - 1);
catalogNav.NonInventoryChoices = nonInventoryChoices;
NonInventoryChoiceControl nonInventoryChoicesControl = (NonInventoryChoiceControl)this.FindControl(nonInventoryChoiceControlID);if (nonInventoryChoicesControl != null) {foreach (ProductChoiceInfo productChoice in _productChoices) {ListControl nonInventoryChoiceControl =ListControl)nonInventoryChoicesControlNonInventoryChoiceControl.ProductChoiceControlPrefix + productChoice.ID.ToString());if (nonInventoryChoiceControl != null) {new ProductChoiceSelection(productChoice.ID, int.Parse(nonInventoryChoiceControl.SelectedValue)));string.Format("{0},{1},",if (nonInventoryChoices.Length > 0)// get the inventory key for the selected items,
// nevermind, we will get the inventory key in the add item area. because of the
// multiple adds that can happen with inventory choices.
// catalogNav.InventoryKey = productChoiceController.GetInventoryKeyID(selections);
// if an inventory choice exists, then let the addtocart know the quantities for the
// choices...
productChoiceController.GetChoicesByProduct(ProductID)
.Find(
ProductChoiceInfo inventoryProductChoice =new Predicate<ProductChoiceInfo>(ChoiceIsInventoryChoice));string inventoryChoices = string.Empty;if (inventoryProductChoice != null) {// add the choice to the selection list to get the proper inventory key.
{
ChoiceQuantityControl quantityControl = (ChoiceQuantityControl)this.FindControl(quantityControlID);if (quantityControl != null)
#region
.FindControl(
"foreach (ProductChoiceItemInfo productChoiceItem in inventoryProductChoice.ChoiceItems) {"foreach (ProductChoiceItemInfo productChoiceItem in inventoryProductChoice.ChoiceItems) {TextBox txtInventoryChoice = (TextBox)quantityControlChoiceQuantityControl.ProductInventoryChoiceControlPrefix + productChoiceItem.ID.ToString());if (txtInventoryChoice != null) {if (IsNumber(txtInventoryChoice.Text)) {// Valid quantity
inventoryChoices +=
selections.Add(inventorySelection);
tmpInventoryKey = productChoiceController.GetInventoryKeyID(selections, productInfo.ProductID);
quantity =
configuredProduct = productChoiceController.GetInventoryKey(tmpInventoryKey);
string.Format("{0},{1},", productChoiceItem.ID, txtInventoryChoice.Text);ProductChoiceSelection inventorySelection =new ProductChoiceSelection(productInfo.InventoryChoiceID, productChoiceItem.ID);int.Parse(txtInventoryChoice.Text);if (configuredProduct != null) {//inventoryChoices += string.Format("{0},{1},", productChoiceItem.ID, txtInventoryChoice.Text);
// Validate instock
{
instanceuserAddedMoreThanInStock =
userAddedMoreThanInStock =
validPurchase =
txtInventoryChoice.Text = configuredProduct.InventoryQuantity.ToString();
}
if (!productInfo.IsVPOD && !productInfo.IsDotEDIT && validateInStock)if (quantity > configuredProduct.InventoryQuantity)true;true;false;if (_storeInfo.ValidateInStockSetting == ValidateInStockType.NotifyCSRPopup)else
instanceuserAddedMoreThanInStock =
false;// Validate min, max, multiple
isMultipleQtyValid = ((quantity % configuredProduct.MultipleQty) == 0);
isInRange = ((quantity <= configuredProduct.MaxOrderQty) && (quantity >= configuredProduct.MinOrderQty));
validMinMaxMult = (isMultipleQtyValid && isInRange);
anyMinMaxMultErrors =
validPurchase = validPurchase && validMinMaxMult;
}
quantities +=
if (configuredProduct.MinOrderQty != 1 || configuredProduct.MaxOrderQty != 1 || configuredProduct.MultipleQty != 1) {if (!validMinMaxMult)true;string.Format("{0},", txtInventoryChoice.Text);if (!validPurchase) {// Invalid quantity
//successfulQuantity = false;
choicesText =
choicesText += item.DisplayName +
}
choicesText = choicesText.Remove(choicesText.Length - 3);
quantityValidationErrMsg =
quantityValidationErrMsg +=
}
quantityValidationErrMsg +=
}
notifyChoicesText += choicesText +
{
quantityValidationErrMsg +=
}
List<ProductChoiceItemInfo> errChoiceItems = productChoiceController.GetProductChoiceItemsByInventoryKey(tmpInventoryKey);"";foreach (ProductChoiceItemInfo item in errChoiceItems) {" - ";if (choicesText.Length > 0)if (quantityValidationErrMsg.Length == 0)"Action Required:<br /><br />";if (!isInRange) {String.Format(Localization.GetString("mpMinMaxQuantityError", LocalResourceFile), choicesText, configuredProduct.MinOrderQty, configuredProduct.MaxOrderQty);if (!isMultipleQtyValid) {String.Format(Localization.GetString("mpMultipleQuantityError", LocalResourceFile), choicesText, configuredProduct.MultipleQty);"<br/>";if (instanceuserAddedMoreThanInStock && !anyMinMaxMultErrors)String.Format(Localization.GetString("mpBackorderMessageContinueToCart", LocalResourceFile), choicesText, configuredProduct.InventoryQuantity);// quantityValidationErrMsg += "<br /><br />";
//lblAddToCartError.Visible = true;
}
// end Validate min, max, multiple
}
// if configuredProduct != null
selections.Remove(inventorySelection);
}
inventoryChoices +=
quantities +=
}
}
}
else {string.Format("{0},{1},", productChoiceItem.ID, 0);"0,";
#endregion
}
//remove the trailing ','
inventoryChoices = inventoryChoices.Substring(0, inventoryChoices.Length - 1);
quantities = quantities.Remove(quantities.Length - 1);
}
if (inventoryChoices.Length > 0) {try {// Need a try-catch here because of weirdness when you click Buy Now and have an invalid item
// even though you were warned
CalculateSubtotal();
}
}
catch {if (validPurchase || userAddedMoreThanInStock) {// assign the CSV to inventory choices for adding multiple products.
// Still need to add inventory choices/quantities to nav in case they were already warned
catalogNav.InventoryChoices = inventoryChoices;
}
}
else {// No inventory choices - single quantity
quantity =
QuantityControl quantityControl = (QuantityControl)this.FindControl(quantityControlID);if (quantityControl != null) {if (quantityControl.QuantityText != null) {if (IsNumber(quantityControl.QuantityText)) {int.Parse(quantityControl.QuantityText);if (selections.Count > 0) {// there are not multiple skus, but there's at least one choice involved ...
// so just gather the one inventory key and add that to the cart
tmpInventoryKey = productChoiceController.GetInventoryKeyID(selections, productInfo.ProductID);
configuredProduct = productChoiceController.GetInventoryKey(tmpInventoryKey);
// Validate instock
{
instanceuserAddedMoreThanInStock =
userAddedMoreThanInStock =
validPurchase =
quantityControl.QuantityText= configuredProduct.InventoryQuantity.ToString();
}
if (!productInfo.IsVPOD && !productInfo.IsDotEDIT && validateInStock)if (quantity > configuredProduct.InventoryQuantity)true;true;false;if (_storeInfo.ValidateInStockSetting == ValidateInStockType.NotifyCSRPopup)else
instanceuserAddedMoreThanInStock =
false;// Validate min, max, and multiple quantities
isMultipleQtyValid = ((quantity % configuredProduct.MultipleQty) == 0);
isInRange = ((quantity <= configuredProduct.MaxOrderQty) && (quantity >= configuredProduct.MinOrderQty));
validMinMaxMult = (isMultipleQtyValid && isInRange);
anyMinMaxMultErrors =
validPurchase = validPurchase && validMinMaxMult;
}
}
if (configuredProduct.MinOrderQty != 1 || configuredProduct.MaxOrderQty != 1 || configuredProduct.MultipleQty != 1) {if (!validMinMaxMult)true;else {// Single sku, no product choice selections
// Validate instock
{
userAddedMoreThanInStock =
instanceuserAddedMoreThanInStock =
validPurchase =
{
quantityControl.QuantityText = productInfo.SimpleProductInventoryQuantity.ToString();
quantity = productInfo.SimpleProductInventoryQuantity;
if (!productInfo.IsVPOD && !productInfo.IsDotEDIT && validateInStock)if (quantity > productInfo.SimpleProductInventoryQuantity)true;true;false;if (_storeInfo.ValidateInStockSetting == ValidateInStockType.NotifyCSRPopup)// TODO: something with max/min I'm sure.
}
}
// Check the min, max, multiples if this is a simple product
isMultipleQtyValid = ((quantity % productInfo.SimpleProductMultipleQty) == 0);
isInRange = ((quantity <= productInfo.SimpleProductMaxOrderQty) && (quantity >= productInfo.SimpleProductMinOrderQty));
validMinMaxMult = (isMultipleQtyValid && isInRange);
anyMinMaxMultErrors =
validPurchase = validPurchase && validMinMaxMult;
}
}
CalculateSubtotal();
catalogNav.CartQuantity =
}
if (productInfo.IsSimpleProduct) {if (!validMinMaxMult)true;if (validPurchase) {int.Parse(quantityControl.QuantityText);else {// Quantity errors
//successfulQuantity = false;
choicesText =
choicesText += item.DisplayName +
}
choicesText = choicesText.Remove(choicesText.Length - 3);
notifyChoicesText += choicesText +
quantityValidationErrMsg =
quantityValidationErrMsg +=
}
quantityValidationErrMsg +=
}
{
quantityValidationErrMsg +=
}
}
if (!productInfo.IsSimpleProduct) {List<ProductChoiceItemInfo> errChoiceItems = productChoiceController.GetProductChoiceItemsByInventoryKey(tmpInventoryKey);"";foreach (ProductChoiceItemInfo item in errChoiceItems) {" - ";if (choicesText.Length > 0)"<br/>";if (quantityValidationErrMsg.Length == 0)"Action Required:<br /><br />";if (!isInRange) {String.Format(Localization.GetString("mpMinMaxQuantityError", LocalResourceFile), choicesText, configuredProduct.MinOrderQty, configuredProduct.MaxOrderQty);if (!isMultipleQtyValid) {String.Format(Localization.GetString("mpMultipleQuantityError", LocalResourceFile), choicesText, configuredProduct.MultipleQty);if (instanceuserAddedMoreThanInStock && !anyMinMaxMultErrors)String.Format(Localization.GetString("mpBackorderMessageContinueToCart", LocalResourceFile), choicesText, configuredProduct.InventoryQuantity);else {// Simple product
quantityValidationErrMsg =
quantityValidationErrMsg +=
quantityValidationErrMsg +=
quantityValidationErrMsg +=
}
if (quantityValidationErrMsg.Length == 0)"Action Required:<br /><br />";if (!isInRange)String.Format(Localization.GetString("spMinMaxQuantityError", LocalResourceFile), productInfo.SimpleProductMinOrderQty, productInfo.SimpleProductMaxOrderQty);if (!isMultipleQtyValid)String.Format(Localization.GetString("spMultipleQuantityError", LocalResourceFile), productInfo.SimpleProductMultipleQty);if (instanceuserAddedMoreThanInStock && !anyMinMaxMultErrors)String.Format(Localization.GetString("spBackorderMessageContinueToCart", LocalResourceFile), productInfo.SimpleProductMultipleQty);// quantityValidationErrMsg += "<br /><br />";
// Still need to add inventory choices/quantities to nav in case they were already warned
quantityControl.QuantityText = outint.ToString();
int outint = 0;if (int.TryParse(quantityControl.QuantityText, out outint))else
quantityControl.QuantityText =
catalogNav.CartQuantity =
}
}
}
}
}
"0";int.Parse(quantityControl.QuantityText);// Set variable signifying that user has been warned about inStock quantities
InStockWarningDisplayed = userAddedMoreThanInStock;
lblError.Text =
bool previousInStockWarningDisplayed = InStockWarningDisplayed;Label lblError = this.FindControl("lblProductChoiceError") as Label;if (lblError != null)"";bool continueToCart = true;//isInRange
// Check for and display any errors that occurred
lblError.Text += errorMessage;
continueToCart =
}
continueToCart =
lblError.Text += quantityValidationErrMsg;
if (errorMessage.Length > 0) {if (lblError != null)false;if (quantityValidationErrMsg.Length > 0) {if (anyMinMaxMultErrors)false;if (lblError != null)if (!validateInStock && continueToCart) {// Do nothing - allow them to continue adding to cart
}
continueToCart =
else {false;// If user was previously warned, let them continue
if (previousInStockWarningDisplayed == InStockWarningDisplayed) {// Only continue to cart if there are no min/max/multiple errors and no invalid items
// and it isn't a CSR Notification popup. Probably going to need to do something with the popup
continueToCart =
}
if (!anyMinMaxMultErrors && (errorMessage.Length == 0) && _storeInfo.ValidateInStockSetting != ValidateInStockType.NotifyCSRPopup)true;else {// Display label/link to allow them to contrinue adding to cart only if no invalid items
if (!anyMinMaxMultErrors) {// btnContinueAddToCart.Visible = true;
// lblContinueAddToCart.Visible = true;
}
else
InStockWarningDisplayed =
}
}
}
{
false;if (!continueToCart)if (productInfo.IsDotEDIT || productInfo.IsVPOD) {// Keep it on the view proof tab
_podPanelType =
detailProofHolder.Visible =
detailDotEditHolder.Visible =
detailTemplateHolder.Visible =
}
{
PODPanelType.ViewProof;true;false;false;string popupTemlate;if (InStockWarningDisplayed && !anyMinMaxMultErrors)// pass the error text into the session retreive it on the other end.
popupTemlate = parent.ModuleSettings.ProductDetail.BackorderOKCancelTemplate;
}
else
{
popupTemlate = parent.ModuleSettings.ProductDetail.ErrorInSelectionTemplate;
}
{
Session[
rwOKCancel.VisibleOnPageLoad =
rwOKCancel.NavigateUrl = ModulePath +
}
if (_storeInfo.ValidateInStockSetting != ValidateInStockType.NotifyCSRPopup)"OKCancelMessage"] = quantityValidationErrMsg;true;"OKCancelPopup.aspx?tabid=" + Request["TabId"] + "&template=" + popupTemlate;else
{
// show a different popup.
// only show this error if no quantity errors exist
{
Session[
rwOKCancel.VisibleOnPageLoad =
rwOKCancel.NavigateUrl = ModulePath +
}
if (anyMinMaxMultErrors)"OKCancelMessage"] = quantityValidationErrMsg;true;"OKCancelPopup.aspx?tabid=" + Request["TabId"] + "&template=" + popupTemlate;else
{
Session[
rwOKCancel.VisibleOnPageLoad =
rwOKCancel.NavigateUrl =
ModulePath, _storeInfo.DefaultEmailAddress,
}
}
string mesg = notifyChoicesText == string.Empty ? productInfo.ProductTitle : productInfo.ProductTitle + " - <br />" + notifyChoicesText;"BackorderNotifyProducts"] = mesg;true;string.Format("{0}NotifyCSRPopup.aspx?emailTo={1}&customerEmail={2}&template={3}&tabid={4}",this.UserInfo.Email, parent.ModuleSettings.ProductDetail.NotifyCSRPopup, Request["TabId"]);//LinkButton lnkAddToCart = (LinkButton)RadWindow1.FindControl("lnkAddToCart");
}
return;
#region
Put VPOD Variables in Storeage// Good to go at this point ...
if (productInfo.IsVPOD) {// Clear all name/value pairs that start with SOME_QUALIFIER in the Session.
ClearNameValueSessionKeys();
// DotNetNuke.Modules.Store.WebControls.SingleScreenVPODWizard vpodControl =
// (DotNetNuke.Modules.Store.WebControls.SingleScreenVPODWizard)FindControl(singleScreenVPODWizardID);
// Add all the name/value pairs to the session, with SOME_QUALIFIER prepended to the name.
vpodControl.PODVariables.UpdateVariableList();
AddGUIDToSession(vpodControl.VPODProjectGUID);
AddNameValueSessionKey(v.Name, v.Value);
}
}
}
if (vpodControl != null) {foreach (Shamrock.PageFlex.Variable v in vpodControl.PODVariables.Variables) {
#endregion
// Good to go
catalogNav.AddToCart =
catalogNav.SkipAddDisplay =
catalogNav.PageIndex =
catalogNav.SortAscending =
catalogNav.SortField =
true;true;Null.NullInteger;Null.NullBoolean;Null.NullString;string url = catalogNav.GetNavigationUrl();int prevTabID = (Request.Params["PrevTabID"] != null) ? int.Parse(Request.Params["PrevTabID"].ToString()) : catalogNav.TabId;// Keep prevTabID on querystring
url = url.Substring(0, url.LastIndexOf(
"/") + 1) +"prevTabID/" + prevTabID.ToString() + url.Substring(url.LastIndexOf("/"));//append product detail tabID to querystring
url = url.Substring(0, url.LastIndexOf(
Response.Redirect(url,
}
}
Response.Redirect(parentControl.EditUrl(
}
}
"/") + 1) +"pdid/" + catalogNav.TabId.ToString() + url.Substring(url.LastIndexOf("/"));false);private void btnEdit_Click(object sender, EventArgs e) {LinkButton button = (sender as LinkButton);if (button != null) {"ProductID", button.CommandArgument.ToString()));
#endregion
#region
Response.Redirect(catalogNav.GetNavigationUrl(),
}
catalogNav.ReviewID =
Response.Redirect(catalogNav.GetNavigationUrl(),
}
obsolete codeprivate void reviewList_EditComplete(object sender, EventArgs e) {false);private void reviewEdit_EditComplete(object sender, EventArgs e) {Null.NullInteger;false);
#endregion
#region
url =
}
}
Protected Functionsprotected string GetReturnUrl(int categoryID) {string url = Globals.NavigateURL();Globals.NavigateURL(parentControl.TabId, "", "CategoryID=" + categoryID.ToString());return url;protected string GetCartUrl(int productID) {string url = "";return url;protected string GetImageUrl(string image) {if (!image.StartsWith("http"))if (thumbnailWidth > 0)return parentControl.ModulePath + "Thumbnail.aspx?IP=" + image + "&IW=" + thumbnailWidth;else
return image;else
}
return image;
#endregion
#region
Token Processors//private Control processPriceBreaks(string tokenName) {
// switch (tokenName) {
// case "IMAGE":
// Image imgProduct = new Image();
// imgProduct.ImageUrl = GetImageUrl(productInfo.ProductImage);
// imgProduct.Visible = showThumbnail;
// imgProduct.Width = ThumbnailWidth;
// imgProduct.ID = "imgProduct";
// return imgProduct;
// default:
// LiteralControl litText = new LiteralControl(tokenName);
// return litText;
// }
//}
imgProduct.ImageUrl = GetImageUrl(productInfo.ProductImage);
imgProduct.Visible = showThumbnail;
imgProduct.Width = ThumbnailWidth;
imgProduct.ID =
pnlHolder.ID =
pnlHolder.Controls.Add(imgProduct);
imgNbProduct.ImageUrl = GetImageUrl(productInfo.ProductImage);
imgNbProduct.Visible = showThumbnail;
imgNbProduct.Width = ThumbnailWidth;
private Control processToken(string tokenName) {Label lbl = new Label();Panel pnlHolder = new Panel();switch (tokenName) {case "IMAGE":Image imgProduct = new Image();if (ThumbnailWidth > 0)"imgProduct";"pnlProductImage";return pnlHolder;case "NONBOUNDIMAGE":Image imgNbProduct = new Image();if (ThumbnailWidth > 0)//imgNbProduct.ID = "imgProduct" + Guid.NewGuid().to;
btnEdit.Visible = parentControl.IsEditable;
btnEdit.CommandArgument = productInfo.ProductID.ToString();
btnEdit.Click +=
imgEdit.ImageUrl =
imgEdit.Visible = parentControl.IsEditable;
btnEdit.Controls.Add(imgEdit);
lblTitle.Text = productInfo.ProductTitle;
lblItemNumber.Text = productInfo.ModelNumber;
lblManufacturer.Text = productInfo.Manufacturer;
lblModelName.Text = productInfo.ModelName;
return imgNbProduct;case "EDIT":LinkButton btnEdit = new LinkButton();new EventHandler(btnEdit_Click);Image imgEdit = new Image();"~/images/Edit.gif";return btnEdit;case "PRODUCTTITLE":Label lblTitle = new Label();return lblTitle;case "MODELNUMBER":Label lblItemNumber = new Label();return lblItemNumber;case "MANUFACTURER":Label lblManufacturer = new Label();return lblManufacturer;case "MODELNAME":Label lblModelName = new Label();return lblModelName;case "SUMMARY":return new LiteralControl(productInfo.Summary);case "PRICE":// TODO: Need to break this out into seperate user control to get the properties of the token
// so we know whether to display as dropdown or list ...
priceBreaksControl.PriceBreakItems = productInfo.PriceBreaks;
priceBreaksControl.moduleSettings =
}
if (productInfo.PriceBreaks.Count > 1) {PriceBreaks priceBreaksControl = (PriceBreaks)LoadControl(ModulePath + "PriceBreaks.ascx");Catalog parent = (Catalog)parentControl;new DotNetNuke.Modules.Store.Catalog.ModuleSettings(parent.ModuleId, int.Parse(Request["TabId"]));return priceBreaksControl;else {// Single price
Label lblPrice = new Label();//lblPrice.Text = productInfo.PriceBreaks[0].Price.ToString("C2");
lblPrice.Text = productInfo.UnitCost.ToString(
}
btnPurchase.Text =
btnPurchase.CommandArgument = productInfo.ProductID.ToString();
btnPurchase.Visible = showAddToCart;
btnPurchase.Click +=
addToCartButton = btnPurchase;
"C2");return lblPrice;case "PURCHASE":LinkButton btnPurchase = new LinkButton();"Add To Cart";new EventHandler(btnAddToCart_Click);if (addToCartButton == null)return btnPurchase;case "DESCRIPTION":return new LiteralControl(System.Web.HttpUtility.HtmlDecode(productInfo.Description));case "NONINVENTORYCHOICES":// Load all the non-inventory choices. There may not be one.
productChoiceController.GetChoicesByProduct(ProductID)
.FindAll(
ctlNonInventoryChoiceControl.OnChoiceItemSelected +=
ProductChoiceController productChoiceController = new ProductChoiceController();List<ProductChoiceInfo> nonInventoryProductChoices =new Predicate<ProductChoiceInfo>(ChoiceIsNotInventoryChoice));NonInventoryChoiceControl ctlNonInventoryChoiceControl = new NonInventoryChoiceControl(nonInventoryProductChoices, nonInventoryChoiceControlID);new EventHandler(ctlNonInventoryChoiceControl_OnChoiceItemSelected);return ctlNonInventoryChoiceControl;case "QUANTITY":// Load the inventory choice. There may not be one.
productChoiceController1.GetChoicesByProduct(ProductID)
.Find(
ProductChoiceController productChoiceController1 = new ProductChoiceController();ProductChoiceInfo inventoryProductChoice =new Predicate<ProductChoiceInfo>(ChoiceIsInventoryChoice));// We were not high when we wrote this. PUNK'd
choiceQuantityControl.AddToCartLinkButton.CommandArgument = productInfo.ProductID.ToString();
choiceQuantityControl.AddToCartLinkButton.Click +=
choiceQuantityControl.OnQuantityChanged +=
choiceQuantityControl.ShowStockLevel = _showInStock;
addToCartButton = choiceQuantityControl.AddToCartLinkButton;
choiceQuantityControl.ProductPrice = productInfo.UnitCost;
}
quantityControl.AddToCartLinkButton.CommandArgument = productInfo.ProductID.ToString();
quantityControl.AddToCartLinkButton.Click +=
quantityControl.OnQuantityChanged +=
quantityControl.ShowStockLevel = _showInStock;
addToCartButton = quantityControl.AddToCartLinkButton;
}
if (_hasInventoryChoice = (inventoryProductChoice != null)) {ChoiceQuantityControl choiceQuantityControl = new ChoiceQuantityControl(inventoryProductChoice, quantityControlID);new EventHandler(btnAddToCart_Click);new EventHandler(choiceQuantityControl_OnQuantityChanged);return choiceQuantityControl;else {QuantityControl quantityControl = new QuantityControl(quantityControlID);new EventHandler(btnAddToCart_Click);new EventHandler(quantityControl_OnQuantityChanged);return quantityControl;//case "PERSONALIZEQTY":
// // Load the inventory choice. There may not be one.
// ProductChoiceController productChoiceController2 = new ProductChoiceController();
// ProductChoiceInfo inventoryProductChoice1 =
// productChoiceController2.GetChoicesByProduct(ProductID)
// .Find(new Predicate<ProductChoiceInfo>(ChoiceIsInventoryChoice));
// // We were not high when we wrote this. PUNK'd
// if (_hasInventoryChoice = (inventoryProductChoice1 != null))
// {
// ChoiceQuantityControl choiceQuantityControl = new ChoiceQuantityControl(inventoryProductChoice1, quantityControlID);
// choiceQuantityControl.AddToCartLinkButton.CommandArgument = productInfo.ProductID.ToString();
// choiceQuantityControl.AddToCartLinkButton.Click += new EventHandler(btnAddToCart_Click);
// choiceQuantityControl.OnQuantityChanged += new EventHandler(choiceQuantityControl_OnQuantityChanged);
// choiceQuantityControl.ShowStockLevel = _showInStock;
// addToCartButton = choiceQuantityControl.AddToCartLinkButton;
// choiceQuantityControl.ProductPrice = productInfo.UnitCost;
// return choiceQuantityControl;
// }
// else
// {
// QuantityControl quantityControl = new QuantityControl(quantityControlID);
// quantityControl.AddToCartLinkButton.CommandArgument = productInfo.ProductID.ToString();
// quantityControl.AddToCartLinkButton.Click += new EventHandler(btnAddToCart_Click);
// quantityControl.OnQuantityChanged += new EventHandler(quantityControl_OnQuantityChanged);
// quantityControl.ShowStockLevel = _showInStock;
// addToCartButton = quantityControl.AddToCartLinkButton;
// return quantityControl;
// }
case "CONTINUE_ADD_TO_CART":// Used as a secondary add to cart link.
btnContinueAddToCart.ID =
btnContinueAddToCart.Visible =
LinkButton btnContinueAddToCart = new LinkButton();"btnContinueAddToCart";true;//btnContinueAddToCart.Visible = this.InStockWarningDisplayed;
//btnContinueAddToCart.Click += new EventHandler(btnAddToCart_Click);
lbl.ID =
lbl.Visible =
ctlQtyRestrictions.MinQty = productInfo.SimpleProductMinOrderQty;
ctlQtyRestrictions.MaxQty = productInfo.SimpleProductMaxOrderQty;
ctlQtyRestrictions.MultipleQty = productInfo.SimpleProductMultipleQty;
}
relatedProductsController.GetRelatedProducts(ProductID, PortalSettings.AdministratorRoleId);
LoadControl(ModulePath +
relatedProductsControl.RelatedProductsList = relatedProducts;
relatedProductsControl.CatalogModuleSettings = ((
}
lblDate.Date = productInfo.InventoryUpdatedDate;
Trace.Write(
Trace.Write(
Trace.Write(
VpodProject =
Trace.Write(
ctlVPODDisplayWrapper.ID =
ctlVPODDisplayWrapper.VpodProject = VpodProject;
ctlVPODDisplayWrapper.PreviewJob = vpodInfo.PreviewJob;
ctlVPODDisplayWrapper.AjaxManager = ajaxManagerProductDetail;
Trace.Write(
}
}
cartItemInstanceGuid = Request.Params[
projectInfo.FillDotEDITConfig(
config.IsProductDetailPage =
return btnContinueAddToCart;case "CONTINUE_ADD_TO_CART_LABEL":"lblContinueAddToCart";false;return lbl;case "QUANTITYRESTRICTIONS":if (productInfo.IsSimpleProduct) {QuantityRestrictionsDisplay ctlQtyRestrictions = (QuantityRestrictionsDisplay)LoadControl(ModulePath + "QuantityRestrictionsDisplay.ascx");return ctlQtyRestrictions;return null;case "RELATEDPRODUCTS":RelatedProductsController relatedProductsController = new RelatedProductsController();List<ProductInfo> relatedProducts =if (relatedProducts.Count > 0) {RelatedProducts relatedProductsControl = (RelatedProducts)"RelatedProducts.ascx");Catalog)parentControl).ModuleSettings;return relatedProductsControl;return null;case "INVENTORYUPDATETIME":DateLabel lblDate = (DateLabel)LoadControl(ModulePath + "DateLabel.ascx");return lblDate;case "PRODUCTCUSTOMIZATION":if (productInfo.IsVPOD) {"Beginning PRODUCTCUSTOMIZATION");VPODController vpodController = new VPODController();"Getting VPOD Projet Info");VPODInfo vpodInfo = vpodController.GetVPODByProduct(productInfo);"Getting PageFlexProject WS");if (VpodProject == null)new Shamrock.PageFlex.Project(vpodInfo.ProjectFileName, Shamrock.PageFlex.ProjectSource.WebService);"Loading VPOD Display Wrapper");VPODDisplayWrapper ctlVPODDisplayWrapper = (VPODDisplayWrapper)LoadControl(ModulePath + "VPODDisplayWrapper.ascx");"ctlVPODDisplayWrapper";"Ending PRODUCTCUSOMTIZATON");return ctlVPODDisplayWrapper;else if (productInfo.IsASI) {else if (productInfo.IsDotEDIT) {DotEDITProjectController projectController = new DotEDITProjectController();DotEDITProjectInfo projectInfo = projectController.GetDotEDITProject(productInfo.DotEDITID);string cartItemInstanceGuid = "";if (Request.Params["inst"] != null)"inst"].ToString();DotEDITConfig config = new DotEDITConfig();this.ProductID, ref config);true;string savedTemplate = projectInfo.GetSavedTemplateFileName(this.ProductID);string templateFilename;if (cartItemInstanceGuid.Length > 0) {// Check if coming from cart page and use the supplied InstanceGuid
templateFilename = cartItemInstanceGuid.Replace(
config.IsNew =
config.InstanceGuid =
config.DocumentFileName = projectInfo.DocumentFileName.Substring(0, projectInfo.DocumentFileName.LastIndexOf(
}
"-", "") + ".xdt";false;new Guid(cartItemInstanceGuid);'/') + 1) + templateFilename;else {// Check if the user has a saved template for this product. If so, use it as the InstanceGuid/FileName
templateFilename = savedTemplate.Replace(
config.IsNew =
config.InstanceGuid =
config.DocumentFileName = projectInfo.DocumentFileName.Substring(0, projectInfo.DocumentFileName.LastIndexOf(
}
}
"-", "") + ".xdt";if (savedTemplate.Length > 0) {false;new Guid(savedTemplate);'/') + 1) + templateFilename;Catalog parent = (Catalog)parentControl;DotEDITSettings settings = parent.ModuleSettings.DotEDIT;StoreFrontConfigSetup.ApplyModuleSettings(settings, ref config);string protocolAndFQDN = Request.Url.Scheme + "://" + Request.Url.Host;StoreFrontConfigSetup.ApplySiteSettings(protocolAndFQDN, ParentControl.ModulePath, ref config);// Get the installed fonts from the web service, and apply them.
DotNetNuke.Store.UI.Library.ProductionDotEDITService.
=
config.FontPanelFonts = service.GetAllInstalledFonts();
DotEditWebService servicenew DotNetNuke.Store.UI.Library.ProductionDotEDITService.DotEditWebService();string[] projectImages = service.GetImages(config.DocumentFileName);List<string> projectImagesList = new List<string>(projectImages);// Get the images in the project directory from the web service, and make a panel for them.
config.ImagePanels.Add(
new DotEDITImagePanel(null, projectImagesList));// Figure out instance GUIDs.
DotEDITInstanceGuid =
}
config.IsNew =
DotEDITInstanceGuid =
config.InstanceGuid = DotEDITInstanceGuid;
}
DotEDITInstanceGuid =
}
}
if (cartItemInstanceGuid.Length > 0) {new Guid(cartItemInstanceGuid);else {if (savedTemplate.Length == 0) {true;Guid.NewGuid();if (!Page.IsPostBack)else {new Guid(savedTemplate);// Serialize it, but only if not on PostBack.
Application[Session.SessionID] = config;
if (!Page.IsPostBack)else
config = ((
dotEditControl = dotEdit;
DotEDITConfig)Application[Session.SessionID]);DotEDITControl dotEdit = new DotEDITControl(config);if (dotEditControl == null)// Make the control.
}
DotNetNuke.Modules.Store.WebControls.
(DotNetNuke.Modules.Store.WebControls.
LoadControl(ModulePath +
ctl.PriceModifiers = controller.GetPriceModifiersByProductID(ProductID);
lblError.ID =
pnlHolder.ID =
pnlHolder.Controls.Add(lblError);
lblNotAvailable.ID =
lblNotAvailable.Visible =
ctlProductProperties.ProductID =
customizeProductPageLink.PreRender +=
productDetailPageLink.PreRender +=
customizeProductPageImageLink.PreRender +=
productDetailPageImageLink.PreRender +=
productProofDetailPageLink.PreRender +=
productProofDetailPageLink.Click +=
productProofDetailPageImageLink =
productProofDetailPageImageLink.Click +=
productProofDetailPageImageLink.PreRender +=
proofImage =
proofImage.TagName =
proofImage.Attributes[
proofImage.Attributes[
proofImage.Attributes[
viewProofButton =
viewProofButton.Click +=
}
return dotEdit;return null;case "PRICEMODIFIERS":ProductChoiceController controller = new ProductChoiceController();PriceModifiersDisplay ctl =PriceModifiersDisplay)"PriceModifiersDisplay.ascx");return ctl;case "PRODUCTCHOICEERROR":Label lblError = new Label();"lblProductChoiceError";"pnlProductChoiceError";return pnlHolder;case "PRODUCTNOTAVAILABLE":Label lblNotAvailable = new Label();"lblNotAvailable";false;return lblNotAvailable;case "PRODUCTPROPERTIES":ProductProperties ctlProductProperties = new ProductProperties();this.ProductID;return ctlProductProperties;case "CUSTOMIZEPRODUCTPAGELINK":LinkButton customizeProductPageLink = new LinkButton();new EventHandler(customizeProductPageLink_PreRender);return customizeProductPageLink;case "PRODUCTDETAILPAGELINK":LinkButton productDetailPageLink = new LinkButton();new EventHandler(productDetailPageLink_PreRender);return productDetailPageLink;case "CUSTOMIZEPRODUCTPAGEIMAGELINK":ImageButton customizeProductPageImageLink = new ImageButton();new EventHandler(customizeProductPageImageLink_PreRender);return customizeProductPageImageLink;case "PRODUCTDETAILPAGEIMAGELINK":ImageButton productDetailPageImageLink = new ImageButton();new EventHandler(productDetailPageImageLink_PreRender);return productDetailPageImageLink;case "PROOFDETAILPAGELINK":LinkButton productProofDetailPageLink = new LinkButton();new EventHandler(productProofDetailPageLink_PreRender);new EventHandler(productProofDetailPageLink_Click);return productProofDetailPageLink;case "PROOFDETAILPAGEIMAGELINK":new ImageButton();new ImageClickEventHandler(productProofDetailPageImageLink_Click);new EventHandler(productProofDetailPageImageLink_PreRender);return productProofDetailPageImageLink;case "PROOFIMAGE":new HtmlGenericControl();"iframe";"src"] = ModulePath + "PDFViewer/IFrame.html";"width"] = "100%";"height"] = "100%";return proofImage;case "VIEWPROOF":new LinkButton();new EventHandler(viewProofButton_Click);return viewProofButton;default:LiteralControl litText = new LiteralControl(tokenName);return litText;//return null;
}
#region
CalculateSubtotal();
}
CalculateSubtotal();
}
CalculateSubtotal();
}
Subtotal Calculation Event Handlersprivate void ctlNonInventoryChoiceControl_OnChoiceItemSelected(object sender, EventArgs e) {private void choiceQuantityControl_OnQuantityChanged(object sender, EventArgs e) {private void quantityControl_OnQuantityChanged(object sender, EventArgs e) {
#endregion
linkSender.OnClientClick =
private void productProofDetailPageImageLink_PreRender(object sender, EventArgs e) {ImageButton linkSender = (ImageButton)sender;if (productInfo.IsDotEDIT)string.Format("{0}.doAction('subroutine','{1}');", dotEditControl.Config.APIAppletName, "StandardSave");//if (detailProofHolder != null)
// ajaxManagerProductDetail.AjaxSettings.AddAjaxSetting(linkSender, detailProofHolder, AjaxLoadingPanel1);
}
private void productProofDetailPageLink_Click(object sender, EventArgs e) {///Page.Validate();
_podPanelType =
ShowProof();
}
if (Page.IsValid) {PODPanelType.ViewProof;else
_podPanelType =
}
PODPanelType.FormFilling;private void productProofDetailPageImageLink_Click(object sender, ImageClickEventArgs e) {//Page.Validate();
_podPanelType =
ShowProof();
}
if (Page.IsValid) {PODPanelType.ViewProof;else
_podPanelType =
}
PODPanelType.FormFilling;
#region
"PRP-Wizard Pre-Render Events"//void viewProofButton_PreRender(object sender, EventArgs e) {
// LinkButton linkSender = (LinkButton)sender;
// //if ((linkSender != null) && (detailDotEditHolder != null) && (detailTemplateHolder != null) && (detailProofHolder != null))
// // linkSender.OnClientClick = string.Format("toggleBox('{0}',1);toggleBox('{1}', 0);toggleBox('{2}',0);",
// // detailProofHolder.ClientID,detailDotEditHolder.ClientID, detailTemplateHolder.ClientID);
//}
linkSender.OnClientClick =
detailDotEditHolder.ClientID, detailProofHolder.ClientID, detailTemplateHolder.ClientID);
}
linkSender.OnClientClick =
detailTemplateHolder.ClientID, detailProofHolder.ClientID, detailDotEditHolder.ClientID);
}
void customizeProductPageImageLink_PreRender(object sender, EventArgs e) {ImageButton linkSender = (ImageButton)sender;if ((linkSender != null) && (detailDotEditHolder != null) && (detailTemplateHolder != null) && (detailProofHolder != null))string.Format("toggleBox('{0}',1);toggleBox('{1}', 0);toggleBox('{2}',0);return false;",void productDetailPageImageLink_PreRender(object sender, EventArgs e) {ImageButton linkSender = (ImageButton)sender;if ((linkSender != null) && (detailDotEditHolder != null) && (detailTemplateHolder != null) && (detailProofHolder != null))string.Format("toggleBox('{0}',1);toggleBox('{1}', 0);toggleBox('{2}',0);return false;",//void productProofDetailPageImageLink_PreRender(object sender, EventArgs e) {
// ImageButton linkSender = (ImageButton)sender;
// if ((linkSender != null) && (detailDotEditHolder != null) && (detailTemplateHolder != null) && (detailProofHolder != null))
// //linkSender.OnClientClick = string.Format("toggleBox('{0}',1);toggleBox('{1}', 0);toggleBox('{2}',0);return false;",
// // detailProofHolder.ClientID, detailDotEditHolder.ClientID, detailTemplateHolder.ClientID);
// linkSender.OnClientClick = string.Format("toggleBox('{0}', 0);toggleBox('{1}',0);return false;",
// detailDotEditHolder.ClientID, detailTemplateHolder.ClientID);
//}
linkSender.OnClientClick =
detailTemplateHolder.ClientID, detailProofHolder.ClientID, detailDotEditHolder.ClientID);
}
linkSender.OnClientClick =
detailDotEditHolder.ClientID, detailProofHolder.ClientID, detailTemplateHolder.ClientID);
}
linkSender.OnClientClick =
void productDetailPageLink_PreRender(object sender, EventArgs e) {LinkButton linkSender = (LinkButton)sender;if ((linkSender != null) && (detailDotEditHolder != null) && (detailTemplateHolder != null) && (detailProofHolder != null))string.Format("toggleBox('{0}',1);toggleBox('{1}', 0);toggleBox('{2}',0);return false;",void customizeProductPageLink_PreRender(object sender, EventArgs e) {LinkButton linkSender = (LinkButton)sender;if ((linkSender != null) && (detailDotEditHolder != null) && (detailTemplateHolder != null) && (detailProofHolder != null))string.Format("toggleBox('{0}',1);toggleBox('{1}', 0);toggleBox('{2}',0);return false;",void productProofDetailPageLink_PreRender(object sender, EventArgs e) {LinkButton linkSender = (LinkButton)sender;if (productInfo.IsDotEDIT)string.Format("{0}.doAction('subroutine','{1}');", dotEditControl.Config.APIAppletName, "StandardSave");//if ((linkSender != null) && (detailDotEditHolder != null) && (detailTemplateHolder != null) && (detailProofHolder != null))
// linkSender.OnClientClick = string.Format("toggleBox('{0}',1);toggleBox('{1}', 0);toggleBox('{2}',0);return false;",
// detailProofHolder.ClientID, detailDotEditHolder.ClientID, detailTemplateHolder.ClientID);
}
#endregion
Shamrock.PageFlex.
vpodProject = (Shamrock.PageFlex.
vpodProjectGuid = (
_podPanelType =
detailProofHolder.Visible =
detailDotEditHolder.Visible =
detailTemplateHolder.Visible =
proofImage.Attributes[
ModulePath, vpodControl.PreviewJobName, vpodProjectGuid.ToString(), Request[
private void ShowProof() {if (proofImage != null) {if (productInfo.IsVPOD) {Project vpodProject;Guid vpodProjectGuid;Project)Session[sessionKey];Guid)Session[sessionGuidKey];if (vpodControl != null) {PODPanelType.ViewProof;true;false;false;"src"] = String.Format("{0}ProofPage.aspx?jobName={1}&guid={2}&TabID={3}","tabId"]);// To speed things up (or give that illusion at least) launch a new thread to submit proof ...
// CHANGE: alright... going to speed this up somewhere else becaues its causing other issues.
// Thread newThread = new Thread(new ThreadStart(SubmitProof));
//newThread.Priority = ThreadPriority.Normal;
//newThread.Start();
SubmitProof();
}
}
DotNetNuke.Store.UI.Library.ProductionDotEDITService.
=
else if (productInfo.IsDotEDIT) {DotEditWebService servicenew DotNetNuke.Store.UI.Library.ProductionDotEDITService.DotEditWebService();// Save this configured session to this product
projectInfo.SaveTemplate(
proofImage.Attributes[
service =
}
}
}
vpodControl.SubmitProof();
}
DotEDITProjectInfo projectInfo = new DotEDITProjectController().GetDotEDITProject(productInfo.DotEDITID);this.ProductID, dotEditControl.Config.InstanceGuid.ToString());string dotEDITProofURL = service.GetProofURL(dotEditControl.Config.InstanceGuid);"src"] = String.Format("{0}ViewProofPage.aspx?mode=url&url={1}", ModulePath, dotEDITProofURL);null;private void SubmitProof() {private void viewProofButton_Click(object sender, EventArgs e) {//Page.Validate();
_podPanelType =
ShowProof();
}
if (Page.IsValid) {PODPanelType.ViewProof;else
_podPanelType =
}
PODPanelType.FormFilling;private Control processMasterTokens(string tokenName) {Panel masterTemplatePlaceHolder = new Panel();//TODO: we need to do something in here to detemine which one is visible
? parent.ModuleSettings.ProductDetail.PODDetailTemplate : parent.ModuleSettings.ProductDetail.NormalDetailTemplate;
masterTemplatePlaceHolder.Controls.Add(
detailTemplateHolder = masterTemplatePlaceHolder;
masterTemplatePlaceHolder.Controls.Add(
detailDotEditHolder = masterTemplatePlaceHolder;
}
masterTemplatePlaceHolder.Controls.Add(
detailFFHolder = masterTemplatePlaceHolder;
detailFFHolder.Visible =
}
masterTemplatePlaceHolder.Controls.Add(
detailProofHolder = masterTemplatePlaceHolder;
}
}
}
switch (tokenName) {case "PRODUCTDETAILTEMPLATE":string templateFile = (productInfo.IsVPOD || productInfo.IsDotEDIT)TemplateController.ParseTemplate(templateFile, new ProcessTokenDelegate(processToken)));return masterTemplatePlaceHolder;case "PRODUCTDETAILDOTEDITTEMPLATE":if (productInfo.IsVPOD || productInfo.IsDotEDIT) {TemplateController.ParseTemplate(parent.ModuleSettings.ProductDetail.DotEditTemplate,new ProcessTokenDelegate(processToken)));return masterTemplatePlaceHolder;return null;case "PRODUCTDETAILFFVPODTEMPLATE":if (productInfo.IsVPOD || productInfo.IsDotEDIT) {TemplateController.ParseTemplate(parent.ModuleSettings.ProductDetail.FFVpodTemplate,new ProcessTokenDelegate(processToken)));false;return masterTemplatePlaceHolder;return null;case "PRODUCTDETAILPROOFTEMPLATE":if (productInfo.IsVPOD || productInfo.IsDotEDIT) {TemplateController.ParseTemplate(parent.ModuleSettings.ProductDetail.ProofTemplate,new ProcessTokenDelegate(processToken)));return masterTemplatePlaceHolder;return null;default:LiteralControl litText = new LiteralControl(tokenName);return litText;private Control processDotEditTemplate(string tokenName) {//switch (tokenName) {
// case "PRODUCTTITLE":
// case "DOTEDITCONTROL":
// // Combine moduleSettings and DotEDITProjectInfo to make a config.
// break;
//}
}
return null;//private Control processFFVpodTemplate(string tokenName)
//{
//}
#endregion
#region
Private Functionsprivate void loadReviewListControl() {// TODO: We may want to use caching here
reviewList.ParentControl =
reviewList.EditComplete +=
plhReviews.Controls.Clear();
plhReviews.Controls.Add(reviewList);
}
StoreControlBase reviewList = (StoreControlBase)LoadControl(ModulePath + "ReviewList.ascx");this as PortalModuleBase;new EventHandler(reviewList_EditComplete);private void loadReviewEditControl() {// Inject the edit control
reviewEdit.ParentControl =
reviewEdit.DataSource = catalogNav.ReviewID;
reviewEdit.EditComplete +=
plhReviews.Controls.Clear();
plhReviews.Controls.Add(reviewEdit);
}
StoreControlBase reviewEdit = (StoreControlBase)LoadControl(ModulePath + "ReviewEdit.ascx");this as PortalModuleBase;new EventHandler(reviewEdit_EditComplete);//private void CalculateSubtotal(string[] quantities, string nonInventoryChoices,
// out decimal subtotal, out string errorMessage, out string imageLocation, out string inStockValuesList) {
*
* Chuck Norris grinds his coffee with his teeth and boils the water with his own rage.
*
*/
private void CalculateSubtotal() {/* Chuck Norris Fact #354:
//string inventoryChoices = "";
productChoiceController.GetChoicesByProduct(ProductID)
.Find(
inventoryProductChoice =
string errorMessage = "";decimal subtotal = 0;string imageLocation = "";string inStockValuesList = "";int quantity = 0;ProductChoiceController productChoiceController = new ProductChoiceController();List<ProductChoiceSelection> selections = new List<ProductChoiceSelection>();ProductChoiceInfo inventoryProductChoice =new Predicate<ProductChoiceInfo>(ChoiceIsInventoryChoice));if (inventoryProductChoice == null)new ProductChoiceInfo();ChoiceQuantityControl quantityControl = this.FindControl(quantityControlID) as ChoiceQuantityControl;
#region
(
.FindControl(
selections.Add(
}
}
NonInventory Choices - Get Selected Dropdown ValuesNonInventoryChoiceControl nonInventoryChoicesControl = (NonInventoryChoiceControl)this.FindControl(nonInventoryChoiceControlID);if (nonInventoryChoicesControl != null) {foreach (ProductChoiceInfo productChoice in _productChoices) {ListControl nonInventoryChoiceControl =ListControl)nonInventoryChoicesControlNonInventoryChoiceControl.ProductChoiceControlPrefix + productChoice.ID.ToString());if (nonInventoryChoiceControl != null)new ProductChoiceSelection(productChoice.ID, int.Parse(nonInventoryChoiceControl.SelectedValue)));
#endregion
// get product image based on nonInventoryChoices
imageLocation = productChoiceController.GetProductImage(productInfo.ProductID, selections);
imageFound =
}
.FindControl(
quantity = (txtInventoryChoice.Text.Length > 0) ?
selections.Add(inventorySelection);
subtotal += ((GetProductUnitPriceByQuantity(productInfo, quantity) + configuredProduct.PriceModifier) * quantity);
bool imageFound = false;if (inventoryProductChoice.ChoiceItems.Count > 0) {if (!imageFound) {true;foreach (ProductChoiceItemInfo productChoiceItem in inventoryProductChoice.ChoiceItems) {ProductChoiceSelection inventorySelection =new ProductChoiceSelection(productInfo.InventoryChoiceID, productChoiceItem.ID);TextBox txtInventoryChoice = (TextBox)quantityControlChoiceQuantityControl.ProductInventoryChoiceControlPrefix + productChoiceItem.ID.ToString());int.Parse(txtInventoryChoice.Text) : -1;if (quantity > 0) {int key = productChoiceController.GetInventoryKeyID(selections, productInfo.ProductID);if (key > 0) {InventoryKeyInfo configuredProduct = productChoiceController.GetInventoryKey(key);if (quantity > 0)else
txtInventoryChoice.Text =
""; // clear out textbox
// stock
inStockValuesList +=
}
errorMessage += BuildInvalidSelectionErrorMessage(selections, _productChoices);
txtInventoryChoice.Text =
String.Format("{0},", configuredProduct.InventoryQuantity);else {if (quantity > 0)""; // clear out textbox
}
// Do to RADAjax, need to call FocusControl() to set the focus to the last textbox they tried to update
//ajaxManagerProductDetail.FocusControl(txtInventoryChoice);
selections.Remove(inventorySelection);
}
}
}
quantity = (qtyControl.QuantityText.Length > 0) ?
else {QuantityControl qtyControl = (QuantityControl)this.FindControl(quantityControlID);int.Parse(qtyControl.QuantityText) : -1;if (selections.Count > 0) {// no inventory choices - just single quantity
int key = productChoiceController.GetInventoryKeyID(selections, productInfo.ProductID);if (key > 0) {InventoryKeyInfo configuredProduct = productChoiceController.GetInventoryKey(key);// stock
inStockValuesList +=
String.Format("{0},", configuredProduct.InventoryQuantity);// sum up subtotal
subtotal += ((GetProductUnitPriceByQuantity(productInfo, quantity) + configuredProduct.PriceModifier) * quantity);
if (quantity > 0)else
qtyControl.QuantityText =
"";// clear out textbox
imageLocation = productChoiceController.GetProductImage(productInfo.ProductID, selections);
imageFound =
}
}
errorMessage += BuildInvalidSelectionErrorMessage(selections, _productChoices);
qtyControl.QuantityText =
if (!imageFound) {true;else {if (quantity > 0)""; // clear out textbox
}
}
else {// Product with no choices at all - use unit price
subtotal += (GetProductUnitPriceByQuantity(productInfo, quantity) * quantity);
if (quantity > 0)else
qtyControl.QuantityText =
"";// clear out textbox
}
// Do to RADAjax, need to call FocusControl() to set the focus to the last textbox they tried to update
//ajaxManagerProductDetail.FocusControl(qtyControl.QuantityTextBox);
}
// Display subtotal, error messages, swap out image
errorMessage =
lblError.Text = errorMessage;
lblError.Visible =
}
lblError.Visible =
}
inStockValuesList = inStockValuesList.Remove(inStockValuesList.Length - 1);
txtSubTotal.Text = subtotal.ToString(
((
}
returnMessage += item.DisplayName +
}
}
}
}
returnMessage = returnMessage.Remove(returnMessage.Length - 2) +
}
Label lblError = this.FindControl("lblProductChoiceError") as Label;if (errorMessage.Length > 0) {"The following selection is not available for this product:<br/><br/>" + errorMessage;true;else {false;if (inStockValuesList.Length > 0)"C");if (imageFound)Image)this.FindControl("imgProduct")).ImageUrl = GetImageUrl(imageLocation);private string BuildInvalidSelectionErrorMessage(List<ProductChoiceSelection> selections, List<ProductChoiceInfo> productChoices) {string returnMessage = "";ProductChoiceController productChoiceController = new ProductChoiceController();foreach (ProductChoiceInfo productChoice in productChoices) {foreach (ProductChoiceSelection selection in selections) {if (productChoice.ID == selection.ChoiceID) {foreach (ProductChoiceItemInfo item in productChoice.ChoiceItems) {if (item.ID == selection.ChoiceItemID)", ";"<br/>";return returnMessage;/// <summary>
/// Returns the unit price based on a product's price breaks (if they exist)
/// </summary>
/// <param name="product"></param>
/// <param name="quantity"></param>
/// <returns></returns>
price = product.UnitCost;
price = product.PriceBreaks[0].Price;
price = priceBreak.Price;
}
price = priceBreak.Price;
}
}
}
}
private decimal GetProductUnitPriceByQuantity(ProductInfo product, int quantity) {decimal price = 0;if (product.PriceBreaks.Count == 0)else {if (product.PriceBreaks.Count == 1)else {for (int i = 0; i < product.PriceBreaks.Count; i++) {PriceBreakInfo priceBreak = product.PriceBreaks[i];if (quantity <= priceBreak.Quantity - 1) {break;if (i == product.PriceBreaks.Count - 1)return price;// TODO: Make these static methods somewhere else.
keysForDeletion.Add(key);
}
Session.Remove(key);
}
Session[sessionVPODPrefix + name] = value;
}
Session[sessionVPODPrefix + sessionGUIDKey] = vpodGuid.ToString();
}
}
Session[sessionDotEDITPrefix + sessionGUIDKey] =
}
}
}
}
}
public void ClearNameValueSessionKeys() {List<string> keysForDeletion = new List<string>();foreach (string key in Session.Keys) {if (key.StartsWith(sessionVPODPrefix))foreach (string key in keysForDeletion)public void AddNameValueSessionKey(string name, object value) {public void AddGUIDToSession(Guid vpodGuid) {public Guid DotEDITInstanceGuid {get {return new Guid((string)Session[sessionDotEDITPrefix + sessionGUIDKey]);set {value.ToString();private bool ChoiceIsNotInventoryChoice(ProductChoiceInfo productChoiceInfo) {return !ChoiceIsInventoryChoice(productChoiceInfo);private bool ChoiceIsInventoryChoice(ProductChoiceInfo productChoiceInfo) {return productChoiceInfo.IsInventoryChoice;public static bool IsNumber(string theValue) {Match m = _isNumber.Match(theValue);return m.Success;//IsInteger
#endregion
#region
}
}
}
}
}
Public Propertiespublic int CategoryID {get { return categoryID; }set { categoryID = value; }public int ProductID {get { return productID; }set { productID = value; }public bool ShowThumbnail {get { return showThumbnail; }set { showThumbnail = value; }public int ThumbnailWidth {get { return thumbnailWidth; }set { thumbnailWidth = value; }public bool ShowAddToCart {get { return showAddToCart; }set { showAddToCart = value; }
#endregion
#region
Private Propertiesprivate SingleScreenVPODWizard vpodControl {get {VPODDisplayWrapper wrapper = this.FindControl("ctlVPODDisplayWrapper") as VPODDisplayWrapper;if (wrapper != null)return wrapper.VPODControl;else
}
}
return null;private Panel vpodHostPanel {get {VPODDisplayWrapper wrapper = this.FindControl("ctlVPODDisplayWrapper") as VPODDisplayWrapper;if (wrapper != null)return wrapper.VPODHostPanel;else
}
}
}
}
}
}
return null;private Shamrock.PageFlex.Project VpodProject {get {object o = ViewState["vpodProject"];if (o != null)return (Shamrock.PageFlex.Project)o;return null;set { ViewState["vpodProject"] = value; }private bool IsVirtualPostBack {get {object o = ViewState["IsVirtualPostBack"];if (o != null)return (bool)o;return false;set { ViewState["IsVirtualPostBack"] = value; }/// <summary>
/// If user tried to add a quantity greater than the in-stock amount, this will return whether or not the warning has been displayed
/// </summary>
}
}
private bool InStockWarningDisplayed {get {object o = ViewState["InStockWarningDisplayed"];if (o != null)return (bool)o;return false;set { ViewState["InStockWarningDisplayed"] = value; }
#endregion
}
}