Exemplo n.º 1
0
 ///<summary>
 ///Load the selected address checkout control and add to the address placeholder.
 ///</summary>
 private void LoadAddressControl()
 {
     plhAddressCheckout.Controls.Clear();
     _addressProvider          = StoreController.GetAddressProvider(StoreSettings.AddressName);
     AddressCheckoutControl    = (AddressCheckoutControlBase)_addressProvider.GetCheckoutControl(this, ControlPath);
     AddressCheckoutControl.ID = "addresscheckout";
     AddressCheckoutControl.ModuleConfiguration     = ModuleConfiguration;
     AddressCheckoutControl.NoDelivery              = StoreSettings.NoDelivery;
     AddressCheckoutControl.CheckoutMode            = StoreSettings.CheckoutMode;
     AddressCheckoutControl.BillingAddressChanged  += ctlAddressCheckout_BillingAddressChanged;
     AddressCheckoutControl.ShippingAddressChanged += ctlAddressCheckout_ShippingAddressChanged;
     plhAddressCheckout.Controls.Add(AddressCheckoutControl);
 }
Exemplo n.º 2
0
        private void LoadAddressAdmin(string addressName)
        {
            plhAddressProvider.Controls.Clear();

            //Get an instance of the provider
            IAddressProvider addressProvider = StoreController.GetAddressProvider(addressName);

            //Create an instance of the provider's admin control
            ProviderControlBase providerControl = addressProvider.GetAdminControl(this, ControlPath);

            providerControl.ID = "AddressProvider";

            plhAddressProvider.Controls.Add(providerControl);
        }
Exemplo n.º 3
0
        private void LoadAddressProvider()
        {
            plhAddressProvider.Controls.Clear();

            //Get an instance of the provider
            IAddressProvider addressProvider = StoreController.GetAddressProvider(StoreSettings.AddressName);

            //Create an instance of the provider's profile control
            ProviderControlBase providerControl = addressProvider.GetProfileControl(this, ControlPath);

            providerControl.ModuleConfiguration = ModuleConfiguration;
            providerControl.ParentControl       = this;
            providerControl.EditComplete       += editControl_EditComplete;
            providerControl.ProviderError      += editControl_Error;

            plhAddressProvider.Controls.Add(providerControl);
        }
Exemplo n.º 4
0
        private void SendOrderStatusChangeEmail(OrderInfo order)
        {
            // Get Store Currency Symbol
            if (!string.IsNullOrEmpty(StoreSettings.CurrencySymbol))
            {
                order.CurrencySymbol = StoreSettings.CurrencySymbol;
            }

            // Get Order Date Format
            string orderDateFormat = Localization.GetString("OrderDateFormat", LocalResourceFile);

            if (!string.IsNullOrEmpty(orderDateFormat))
            {
                order.DateFormat = orderDateFormat;
            }

            // Get Customer Email
            IAddressProvider controler      = StoreController.GetAddressProvider(StoreSettings.AddressName);
            IAddressInfo     billingAddress = controler.GetAddress(order.BillingAddressID);
            string           customerEmail  = billingAddress.Email;

            // Get Admin Email
            string adminEmail = StoreSettings.DefaultEmailAddress;

            // Customer Order Email Template
            string customerSubjectEmail = Localization.GetString("CustomerStatusChangedEmailSubject", LocalResourceFile);
            string customerBodyEmail    = Localization.GetString("CustomerStatusChangedEmailBody", LocalResourceFile);

            // Extract or remove IFPAID token
            Match regPaidMatch = RegPaid.Match(customerBodyEmail);

            if (regPaidMatch.Success)
            {
                // If Status is Paid
                if (order.OrderStatusID == 7)
                {
                    // Replace IFPAID token by his content
                    string paidTemplate = regPaidMatch.Groups[1].ToString();
                    paidTemplate      = RegStripStartNewLine.Replace(paidTemplate, string.Empty);
                    paidTemplate      = RegStripEndNewLine.Replace(paidTemplate, string.Empty);
                    customerBodyEmail = RegPaid.Replace(customerBodyEmail, paidTemplate);
                }
                else // Remove IFPAID token
                {
                    customerBodyEmail = RegPaid.Replace(customerBodyEmail, string.Empty);
                }
            }

            // Admin Order Email Template
            string adminSubjectEmail = Localization.GetString("AdminStatusChangedEmailSubject", LocalResourceFile);
            string adminBodyEmail    = Localization.GetString("AdminStatusChangedEmailBody", LocalResourceFile);

            // Init Email Order Replacement Tokens
            EmailOrderTokenReplace tkEmailOrder = new EmailOrderTokenReplace();

            tkEmailOrder.StoreSettings = StoreSettings;
            tkEmailOrder.Order         = order;

            // Replace tokens
            customerSubjectEmail = tkEmailOrder.ReplaceEmailOrderTokens(customerSubjectEmail);
            customerBodyEmail    = tkEmailOrder.ReplaceEmailOrderTokens(customerBodyEmail);
            adminSubjectEmail    = tkEmailOrder.ReplaceEmailOrderTokens(adminSubjectEmail);
            adminBodyEmail       = tkEmailOrder.ReplaceEmailOrderTokens(adminBodyEmail);

            try
            {
                // Send Customer Email
                string result = Mail.SendMail(adminEmail, customerEmail, "", customerSubjectEmail, customerBodyEmail, "", HtmlUtils.IsHtml(customerBodyEmail) ? MailFormat.Html.ToString() : MailFormat.Text.ToString(), "", "", "", "");
                if (!string.IsNullOrEmpty(result))
                {
                    LogSMTPError(customerEmail, result);
                }

                // Send Store Admin Email
                result = Mail.SendMail(adminEmail, adminEmail, "", adminSubjectEmail, adminBodyEmail, "", HtmlUtils.IsHtml(adminBodyEmail) ? MailFormat.Html.ToString() : MailFormat.Text.ToString(), "", "", "", "");
                if (!string.IsNullOrEmpty(result))
                {
                    LogSMTPError(customerEmail, result);
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (StoreSettings != null)
            {
                // Read module settings
                _moduleSettings = new ModuleSettings(ModuleId, TabId);
                // Init vars
                _productColumn = _moduleSettings.MainCart.ProductColumn.ToLower();
                if (StoreSettings.CurrencySymbol != string.Empty)
                {
                    _localFormat.CurrencySymbol = StoreSettings.CurrencySymbol;
                }
                _orderDateFormat       = Localization.GetString("OrderDateFormat", LocalResourceFile);
                _customerNav           = new CustomerNavigation(Request.QueryString);
                lblError.Text          = "";     //Initialize the Error Label.
                pnlOrdersError.Visible = false;
                _orderController       = new OrderController();
                _addressProvider       = StoreController.GetAddressProvider(StoreSettings.AddressName);

                CheckUserRoles();

                if (ShowOrdersInStatus && OrderStatusID != Null.NullInteger)
                {
                    plhGrid.Visible = true;
                    plhForm.Visible = false;

                    List <OrderInfo> orders = _orderController.GetOrders(PortalId, OrderStatusID);

                    if (orders.Count > 0)
                    {
                        _orderStatusList     = _orderController.GetOrderStatuses();
                        grdOrders.DataSource = orders;
                        grdOrders.DataBind();
                    }
                    else
                    {
                        lblError.Text          = Localization.GetString("NoOrdersFound", LocalResourceFile);
                        pnlOrdersError.Visible = true;
                        pnlOrders.Visible      = false;
                        grdOrders.DataSource   = null;
                        grdOrders.DataBind();
                    }
                }
                else
                {
                    if (_customerNav.OrderID != Null.NullInteger)
                    {
                        plhGrid.Visible = false;
                        plhForm.Visible = true;

                        if (_customerNav.OrderID != 0 && !IsPostBack)
                        {
                            lblEditTitle.Text = Localization.GetString("ViewDetails", LocalResourceFile);
                            ShowOrderDetails(_customerNav.OrderID);
                        }
                    }
                    else
                    {
                        if (_customerNav.CustomerID == Null.NullInteger)
                        {
                            _customerNav.CustomerID = UserId;
                        }
                        else if (_canManageOrders == false && _customerNav.CustomerID != UserId)
                        {
                            // Someone is trying to steal data
                            pnlOrders.Visible = false;
                            throw new Exception(Localization.GetString("Unexpected.Error", LocalSharedResourceFile));
                        }

                        if (_canManageOrders || StoreSettings.AuthorizeCancel)
                        {
                            grdOrders.Columns[6].Visible = true;
                        }
                        else
                        {
                            grdOrders.Columns[6].Visible = false;
                        }

                        plhGrid.Visible = true;
                        plhForm.Visible = false;
                        DisplayCustomerOrders();
                    }
                }
            }
            else
            {
                pnlOrdersError.Visible = false;
                pnlOrders.Visible      = false;
            }
        }