using System; using System.Data; using System.Collections; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using CMS.EcommerceProvider; using CMS.GlobalHelper; using CMS.PortalControls; public partial class CMSWebParts_Ecommerce_ShoppingCart_ShoppingCartWebPart : CMSAbstractWebPart { #region "Public properties" /// /// Gets or sets the url where customer is redirected after purchase. /// public string RedirectAfterPurchase { get { return ValidationHelper.GetString(GetValue("RedirectAfterPurchase"), cartElem.RedirectAfterPurchase); } set { SetValue("RedirectAfterPurchase", value); cartElem.RedirectAfterPurchase = value; } } /// /// Gets or sets the value that indicates whether retrieval of forgotten password is enabled. /// public bool PasswordRetrieval { get { return ValidationHelper.GetBoolean(GetValue("PasswordRetrieval"), true); } set { SetValue("PasswordRetrieval", value); cartElem.EnablePasswordRetrieval = value; } } /// /// Gets or sets the conversion track name used after successful registration. /// public string RegistrationTrackConversionName { get { return ValidationHelper.GetString(GetValue("RegistrationTrackConversionName"), ""); } set { if (value.Length > 400) { value = value.Substring(0, 400); } SetValue("RegistrationTrackConversionName", value); cartElem.RegistrationTrackConversionName = value; } } /// /// Gets or sets the conversion track name used after successful order. /// public string OrderTrackConversionName { get { return ValidationHelper.GetString(GetValue("OrderTrackConversionName"), ""); } set { if (value.Length > 400) { value = value.Substring(0, 400); } SetValue("OrderTrackConversionName", value); cartElem.OrderTrackConversionName = value; } } /// /// Gets or sets the value that indicates whether product price detail link is displayed. /// public bool EnableProductPriceDetail { get { return ValidationHelper.GetBoolean(GetValue("EnableProductPriceDetail"), false); } set { SetValue("EnableProductPriceDetail", value); cartElem.EnableProductPriceDetail = value; } } /// /// Gets or sets the value that indicates whether step images should be displayed. /// public bool DisplayStepImages { get { return ValidationHelper.GetBoolean(GetValue("DisplayStepImages"), false); } set { SetValue("DisplayStepImages", value); cartElem.DisplayStepImages = value; } } /// /// Gets or sets the HTML code of the image step separator. /// public string ImageStepSeparator { get { return ValidationHelper.GetString(GetValue("ImageStepSeparator"), cartElem.ImageStepSeparator); } set { SetValue("ImageStepSeparator", value); cartElem.ImageStepSeparator = value; } } /// /// Gets or sets the text which is displayed for required fields in form. /// public string RequiredFieldsMark { get { return ValidationHelper.GetString(GetValue("RequiredFieldsMark"), ""); } set { SetValue("RequiredFieldsMark", value); cartElem.RequiredFieldsMark = value; } } /// /// XML definition of the custom checkout process /// public string CheckoutProcess { get { return ValidationHelper.GetString(GetValue("CheckoutProcess"), ""); } set { SetValue("CheckoutProcess", value); } } #endregion #region "Registration properties" /// /// Gets or sets the email where the new registration notification should be sent to. /// public string SendNewRegistrationNotificationToAddress { get { return ValidationHelper.GetString(GetValue("SendNewRegistrationNotificationToAddress"), cartElem.SendNewRegistrationNotificationToAddress); } set { SetValue("SendNewRegistrationNotificationToAddress", value); cartElem.SendNewRegistrationNotificationToAddress = value; } } /// /// Gets or sets the roles where the new user should be assign to after the registration. /// public string AssignToRoles { get { return ValidationHelper.GetString(GetValue("AssignToRoles"), cartElem.AssignToRoles); } set { SetValue("AssignToRoles", value); cartElem.AssignToRoles = value; } } /// /// Gets or sets the sites where the new user should be assign to after the registration. /// public string AssignToSites { get { return ValidationHelper.GetString(GetValue("AssignToSites"), cartElem.AssignToSites); } set { SetValue("AssignToSites", value); cartElem.AssignToSites = value; } } #endregion /// /// Content loaded event handler. /// public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } /// /// Initializes the control properties. /// protected void SetupControl() { if (StopProcessing) { // Do nothing } else { NotResolveProperties = "AddToShoppingCartConversionValue;OrderConversionValue;RegistrationConversionValue"; // Set shopping cart properties cartElem.RedirectAfterPurchase = RedirectAfterPurchase; cartElem.EnablePasswordRetrieval = PasswordRetrieval; cartElem.RegistrationTrackConversionName = RegistrationTrackConversionName; cartElem.OrderTrackConversionName = OrderTrackConversionName; cartElem.SendNewRegistrationNotificationToAddress = SendNewRegistrationNotificationToAddress; cartElem.AssignToRoles = AssignToRoles; cartElem.AssignToSites = AssignToSites; cartElem.DisplayStepImages = DisplayStepImages; cartElem.ImageStepSeparator = ImageStepSeparator; cartElem.EnableProductPriceDetail = EnableProductPriceDetail; cartElem.RequiredFieldsMark = RequiredFieldsMark; if (string.IsNullOrEmpty(CheckoutProcess)) { // Load checkout process from e-commerce configuration cartElem.CheckoutProcessType = CheckoutProcessEnum.LiveSite; } else { // Load custom checkout process from web part cartElem.CheckoutProcessType = CheckoutProcessEnum.Custom; CheckoutProcessInfo process = new CheckoutProcessInfo(CheckoutProcess); cartElem.LoadCheckoutProcess(process); } } } /// /// Reload data. /// public override void ReloadData() { base.ReloadData(); SetupControl(); } }