/// <summary> /// Process this step. /// </summary> public override bool ProcessStep() { // Do not process step if order is paid if (OrderIsPaid) { return(false); } // Shopping cart units are already saved in database (on "Update" or on "btnAddProduct_Click" actions) bool isOK = false; if (ShoppingCart != null) { // Reload data ReloadData(); // Validate available items before "Check out" var cartValidator = new ShoppingCartValidator(ShoppingCart); cartValidator.Validate(); if (!cartValidator.IsValid) { lblError.Text = cartValidator.GetErrorMessages() .Select(e => HTMLHelper.HTMLEncode(e)) .Join("<br />"); } else if (ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskOrderItems) { // Indicates whether order saving process is successful isOK = true; try { ShoppingCartInfoProvider.SetOrder(ShoppingCart); } catch (Exception ex) { // Log exception EventLogProvider.LogException("Shopping cart", "SAVEORDER", ex, ShoppingCart.ShoppingCartSiteID); isOK = false; } if (isOK) { lblInfo.Text = GetString("general.changessaved"); // Send order notification when editing existing order if (ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskOrderItems) { if (chkSendEmail.Checked) { OrderInfoProvider.SendOrderNotificationToAdministrator(ShoppingCart); OrderInfoProvider.SendOrderNotificationToCustomer(ShoppingCart); } } // Send order notification emails when on the live site else if (ECommerceSettings.SendOrderNotification(SiteContext.CurrentSite.SiteName)) { OrderInfoProvider.SendOrderNotificationToAdministrator(ShoppingCart); OrderInfoProvider.SendOrderNotificationToCustomer(ShoppingCart); } } else { lblError.Text = GetString("ecommerce.orderpreview.errorordersave"); } } // Go to the next step else { // Save other options if (!ShoppingCartControl.IsInternalOrder) { ShoppingCartInfoProvider.SetShoppingCartInfo(ShoppingCart); } isOK = true; } } return(isOK); }