protected void Page_Init(object sender, System.EventArgs e)
        {
            IList <EmailTemplate> templates = EmailTemplateDataSource.LoadAll("Name");

            EmailTemplate.DataSource = templates;
            EmailTemplate.DataBind();
            AllEmailTemplates.DataSource = templates;
            AllEmailTemplates.DataBind();

            AbleCommerce.Code.PageHelper.SetHtmlEditor(TermsAndConditions, TermsAndConditionsHtml);
        }
Esempio n. 2
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     AbleCommerce.Code.PageHelper.ConvertEnterToTab(Name);
     if (!Page.IsPostBack)
     {
         //SignupEmailTemplate
         IList <EmailTemplate> emailTemplates = EmailTemplateDataSource.LoadAll();
         foreach (EmailTemplate template in emailTemplates)
         {
             ListItem li = new ListItem(template.Name, template.Id.ToString());
             SignupEmailTemplate.Items.Add(li);
         }
     }
 }
Esempio n. 3
0
        protected void Page_Init(object sender, EventArgs e)
        {
            _Store    = AbleContext.Current.Store;
            _Settings = _Store.Settings;

            // INITIALIZE GENERAL SETTINGS
            DefaultAddress.Text      = _Settings.DefaultEmailAddress;
            SubscriptionAddress.Text = _Settings.SubscriptionEmailAddress;
            SubscriptionRequestExpirationDays.Text = _Settings.SubscriptionRequestExpirationDays.ToString();

            // BIND THE SEND TO FRIEND SELECTBOX
            IList <EmailTemplate> templates = EmailTemplateDataSource.LoadAll();

            EmailTemplatesList.DataSource = templates;
            EmailTemplatesList.DataBind();

            ContactUsEmailTemplatesList.DataSource = templates;
            ContactUsEmailTemplatesList.DataBind();

            // BIND EMAIL TEMPLATES FOR ABANDONED BASKETS ALERT
            AbandonedBasketEmailTemplateList.DataSource = templates;
            AbandonedBasketEmailTemplateList.DataBind();

            // BIND THE DEFAULT EMAIL LIST SELECTBOX
            IList <EmailList> emailLists = EmailListDataSource.LoadAll();

            DefaultEmailList.DataSource = emailLists;
            DefaultEmailList.DataBind();

            // INITIALIZE SERVER CONFIGURATION
            SmtpServer.Text = _Settings.SmtpServer;
            if (String.IsNullOrEmpty(_Settings.SmtpPort))
            {
                SmtpPort.Text = "25";
            }
            else
            {
                SmtpPort.Text = _Settings.SmtpPort;
            }
            SmtpEnableSSL.Checked = _Settings.SmtpEnableSSL;
            SmtpUserName.Text     = _Settings.SmtpUserName;
            RequiresAuth.Checked  = _Settings.SmtpRequiresAuthentication;

            // DISABLE SCROLLING DURING VALIDATION
            AbleCommerce.Code.PageHelper.DisableValidationScrolling(this.Page);
        }
Esempio n. 4
0
        protected void Page_Init(object sender, EventArgs e)
        {
            // WARN IF SMTP SERVER NOT CONFIGURED
            if (IsSmtpServerConfigured())
            {
                // FIND THE DATASOURCE FOR THE EMAILS
                LocateRecipientSource();

                // INITIALIZE THE EMAIL TEMPLATES
                EmailTemplates.DataSource = EmailTemplateDataSource.LoadAll("Name");
                EmailTemplates.DataBind();
                EmailTemplates.Attributes.Add("onchange", "if(!confirm('Changing the email template will reset any message text entered below.  Continue?')) return false;");

                // INITIALIZE THE MAIL FORM
                ToAddress.Text = GetRecipientList();
                if (!Page.IsPostBack)
                {
                    FromAddress.Text = AbleContext.Current.Store.Settings.DefaultEmailAddress;
                }
                MailFormat.Attributes.Add("onchange", "$get('" + MessageHtml.ClientID + "').style.visibility=(this.selectedIndex==0?'visible':'hidden');");
                MessageHtml.OnClientClick = "if(/^\\s*#.*?\\n/gm.test($get('" + Message.ClientID + "').value)){if(!confirm('WARNING: HTML editor may corrupt NVelocity script if you make changes in WYSIWYG mode.  Continue?'))return false;}";
                AbleCommerce.Code.PageHelper.SetHtmlEditor(Message, MessageHtml);

                // SHOW/hide the restock notification subscriptions removal option
                trRemoveNotificationSubscriptions.Visible = _RestockNotifyList != null;
            }
            else
            {
                // SMTP IS NOT CONFIGURED
                ComposePanel.Visible      = false;
                PreviewPanel.Visible      = false;
                ConfirmationPanel.Visible = false;
                SmtpErrorPanel.Visible    = true;
            }

            // SET CANCEL LINKS TO CALLING PAGE
            OKButton.NavigateUrl   = GetReturnUrl();
            CancelLink.NavigateUrl = GetReturnUrl();
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _EmailListId = AlwaysConvert.ToInt(Request.QueryString["EmailListId"]);
            _EmailList   = EmailListDataSource.Load(_EmailListId);
            if (_EmailList != null)
            {
                AbleCommerce.Code.PageHelper.ConvertEnterToTab(Name);
                if (!Page.IsPostBack)
                {
                    Name.Text        = _EmailList.Name;
                    IsPublic.Checked = _EmailList.IsPublic;
                    Description.Text = _EmailList.Description;
                    ListItem item = SignupRule.Items.FindByValue(_EmailList.SignupRule.ToString());
                    if (item != null)
                    {
                        SignupRule.SelectedIndex = SignupRule.Items.IndexOf(item);
                    }

                    IList <EmailTemplate> emailTemplates = EmailTemplateDataSource.LoadAll();
                    foreach (EmailTemplate template in emailTemplates)
                    {
                        ListItem li = new ListItem(template.Name, template.Id.ToString());
                        SignupEmailTemplate.Items.Add(li);
                    }

                    item = SignupEmailTemplate.Items.FindByValue(_EmailList.SignupEmailTemplateId.ToString());
                    if (item != null)
                    {
                        SignupEmailTemplate.SelectedIndex = SignupEmailTemplate.Items.IndexOf(item);
                    }
                }
            }
            else
            {
                this.Controls.Clear();
            }
        }
Esempio n. 6
0
        private void InitializeForm(bool forceRefresh)
        {
            int digitalGoodId = AlwaysConvert.ToInt(Request.QueryString["DigitalGoodId"]);

            _DigitalGood = DigitalGoodDataSource.Load(digitalGoodId);
            if (_DigitalGood == null)
            {
                Response.Redirect(CancelButton.NavigateUrl);
            }
            RenameFileExtensions.Text = AbleContext.Current.Store.Settings.FileExt_DigitalGoods;
            if (!Page.IsPostBack || forceRefresh)
            {
                Name.Text     = _DigitalGood.Name;
                FileName.Text = _DigitalGood.FileName;
                MediaKey.Text = _DigitalGood.MediaKey;
                ListItem item = ActivationMode.Items.FindByValue(_DigitalGood.ActivationModeId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }
                if (_DigitalGood.MaxDownloads > 0)
                {
                    MaxDownloads.Text = _DigitalGood.MaxDownloads.ToString();
                }
                int days, hours, minutes;
                DigitalGood.ParseTimeout(_DigitalGood.ActivationTimeout, out days, out hours, out minutes);
                if (days > 0)
                {
                    ActivationTimeoutDays.Text = days.ToString();
                }
                if (hours > 0)
                {
                    ActivationTimeoutHours.Text = hours.ToString();
                }
                if (minutes > 0)
                {
                    ActivationTimeoutMinutes.Text = minutes.ToString();
                }
                DigitalGood.ParseTimeout(_DigitalGood.DownloadTimeout, out days, out hours, out minutes);
                if (days > 0)
                {
                    DownloadTimeoutDays.Text = days.ToString();
                }
                if (hours > 0)
                {
                    DownloadTimeoutHours.Text = hours.ToString();
                }
                if (minutes > 0)
                {
                    DownloadTimeoutMinutes.Text = minutes.ToString();
                }
                //bind license agreements
                LicenseAgreement.DataSource = LicenseAgreementDataSource.LoadAll();
                LicenseAgreement.DataBind();
                item = LicenseAgreement.Items.FindByValue(_DigitalGood.LicenseAgreementId.ToString());
                if (item != null)
                {
                    LicenseAgreement.SelectedIndex = LicenseAgreement.Items.IndexOf(item);
                }
                item = LicenseAgreementMode.Items.FindByValue(_DigitalGood.LicenseAgreementModeId.ToString());
                if (item != null)
                {
                    LicenseAgreementMode.SelectedIndex = LicenseAgreementMode.Items.IndexOf(item);
                }

                // BIND GROUPs
                Groups.DataBind();
                Groups.ClearSelection();

                foreach (DigitalGoodGroup dgg in _DigitalGood.DigitalGoodGroups)
                {
                    item = Groups.Items.FindByValue(dgg.Group.Id.ToString());
                    if (item != null)
                    {
                        item.Selected = true;
                    }
                }

                //bind readmes
                Readme.DataSource = ReadmeDataSource.LoadAll();
                Readme.DataBind();
                item = Readme.Items.FindByValue(_DigitalGood.ReadmeId.ToString());
                if (item != null)
                {
                    Readme.SelectedIndex = Readme.Items.IndexOf(item);
                }
                EnableSerialKeys.Checked = _DigitalGood.EnableSerialKeys;

                // INITIALIZE SERIAL KEY PROVIDERS
                KeySource.Items.Clear();
                KeySource.Items.Add(new ListItem("Manual Entry", "0"));

                // ADD PROVIDERS
                IList <ISerialKeyProvider> providers = SerialKeyProviderDataSource.GetSerialKeyProviders();
                foreach (ISerialKeyProvider provider in providers)
                {
                    string   classId = Misc.GetClassId(provider.GetType());
                    ListItem providerItem;
                    // (BUG # 8347) ABLECOMMERCE DEFAULT KEY PROVIDER SHOULD BE NAMED AS "Managed List of Keys"
                    if (provider.GetType() == typeof(DefaultSerialKeyProvider))
                    {
                        providerItem = new ListItem("Managed List of Keys", classId);
                    }
                    else
                    {
                        providerItem = new ListItem(provider.Name, classId);
                    }
                    KeySource.Items.Add(providerItem);
                }
                //SELECT CORRECT PROVIDER
                if (_DigitalGood.SerialKeyProviderId != null)
                {
                    ListItem providerItem = KeySource.Items.FindByValue(_DigitalGood.SerialKeyProviderId);
                    if (providerItem != null)
                    {
                        KeySource.SelectedIndex = KeySource.Items.IndexOf(providerItem);
                    }
                }

                IList <EmailTemplate> templates = EmailTemplateDataSource.LoadAll();
                foreach (EmailTemplate template in templates)
                {
                    ListItem activationItem = new ListItem(template.Name, template.Id.ToString());
                    ListItem fulfillItem    = new ListItem(template.Name, template.Id.ToString());

                    if (_DigitalGood.ActivationEmailId == template.Id)
                    {
                        activationItem.Selected = true;
                    }

                    if (_DigitalGood.FulfillmentEmailId == template.Id)
                    {
                        fulfillItem.Selected = true;
                    }

                    ActivationEmailTemplateList.Items.Add(activationItem);
                    FulfillmentEmailTemplateList.Items.Add(fulfillItem);
                }

                if (_DigitalGood.FulfillmentMode == CommerceBuilder.DigitalDelivery.FulfillmentMode.Manual)
                {
                    FulfillmentMode.SelectedIndex = 0;
                }
                else if (_DigitalGood.FulfillmentMode == CommerceBuilder.DigitalDelivery.FulfillmentMode.OnOrder)
                {
                    FulfillmentMode.SelectedIndex = 1;
                }
                else
                {
                    FulfillmentMode.SelectedIndex = 2;
                }

                ToggleConfigureProvider();
            }
        }
Esempio n. 7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            Store store = AbleContext.Current.Store;
            StoreSettingsManager settings = store.Settings;

            // FULLTEXT SEARCH
            bool ftsIsInstalled = KeywordSearchHelper.IsFullTextSearchInstalled(false);
            bool ftsIsEnabled   = false;

            if (ftsIsInstalled)
            {
                ftsIsEnabled = KeywordSearchHelper.IsFullTextSearchEnabled(false);
                if (!ftsIsEnabled)
                {
                    // ATTEMPT TO ENABLE FULLTEXT SEARCH IF POSSIBLE
                    KeywordSearchHelper.EnableFullTextSearch(false);
                    ftsIsEnabled = KeywordSearchHelper.IsFullTextSearchEnabled(false);
                }
            }

            ListItem sqlFtsProviderItem = SearchProvider.Items.FindByValue("SqlFtsSearchProvider");

            if (sqlFtsProviderItem != null && !(ftsIsInstalled && ftsIsEnabled))
            {
                SearchProvider.Items.Remove(sqlFtsProviderItem);
            }

            bool authorizeNetCIMEnabled = PaymentGatewayDataSource.GetPaymentGatewayIdByClassId("CommerceBuilder.Payments.Providers.AuthorizeNetCIM.AuthNetCIMProvider, CommerceBuilder.AuthorizeNetCIM") > 0;

            if (!authorizeNetCIMEnabled)
            {
                tdPaymentStorage.Attributes.Add("class", "inactive");
                PaymentStorageLabel.Text = "Only available with Authorize.Net CIM gateway";
            }

            PaymentStorage.Enabled = authorizeNetCIMEnabled;

            if (!Page.IsPostBack)
            {
                // GENERAL
                StoreName.Text = store.Name;
                if (AbleContext.Current.User.IsSecurityAdmin)
                {
                    StoreUrl.Text           = store.StoreUrl;
                    StoreUrlLiteral.Visible = false;
                }
                else
                {
                    StoreUrlLiteral.Text = store.StoreUrl;
                    StoreUrl.Visible     = false;
                }
                if (!string.IsNullOrEmpty(settings.SiteDisclaimerMessage))
                {
                    SiteDisclaimerMessage.Text = settings.SiteDisclaimerMessage;
                }

                // VOLUME DISCOUNTS
                DiscountMode.SelectedIndex = (int)store.VolumeDiscountMode;

                // INVENTORY
                EnableInventory.Checked = settings.EnableInventory;
                InventoryPanel.Visible  = settings.EnableInventory;
                CurrentInventoryDisplayMode.SelectedIndex = settings.InventoryDisplayDetails ? 1 : 0;
                InStockMessage.Text               = settings.InventoryInStockMessage;
                OutOfStockMessage.Text            = settings.InventoryOutOfStockMessage;
                InventoryAvailabilityMessage.Text = settings.InventoryAvailabilityMessage;
                RestockNotificationLink.Text      = settings.InventoryRestockNotificationLink;

                IList <EmailTemplate> emailTemplates = EmailTemplateDataSource.LoadAll();
                foreach (EmailTemplate template in emailTemplates)
                {
                    RestockNotificationEmail.Items.Add(new ListItem(template.Name, template.Id.ToString()));
                }

                RestockNotificationEmail.ClearSelection();
                ListItem item = RestockNotificationEmail.Items.FindByValue(settings.InventoryRestockNotificationEmailTemplateId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }

                // ORDER SETTINGS
                UpdateNextOrderNumber(store);

                OrderIdIncrement.Text         = store.OrderIdIncrement.ToString();
                OrderMinAmount.Text           = (settings.OrderMinimumAmount > 0) ? settings.OrderMinimumAmount.ToString() : string.Empty;
                OrderMaxAmount.Text           = (settings.OrderMaximumAmount > 0) ? settings.OrderMaximumAmount.ToString() : string.Empty;
                EnableOnePageCheckout.Checked = settings.EnableOnePageCheckout;

                // GUEST CHECKOUT OPTIONS
                AllowGuestCheckout.Checked   = settings.AllowAnonymousCheckout;
                LimitedGuestCheckout.Checked = !settings.AllowAnonymousCheckoutForDigitalGoods && settings.AllowAnonymousCheckout;
                DisableGuestCheckout.Checked = !settings.AllowAnonymousCheckout;

                // CHECKOUT PAYMENT SETTINGS
                AllowOnlyFullPayments.Checked = !settings.AcceptOrdersWithInvalidPayment;
                IgnoreFailedPayments.Checked  = settings.AcceptOrdersWithInvalidPayment;
                AllowPartialPaymnets.Checked  = settings.EnablePartialPaymentCheckouts && !settings.AcceptOrdersWithInvalidPayment;

                EnableShipMessage.Checked             = settings.EnableShipMessage;
                EnableShipToMultipleAddresses.Checked = settings.EnableShipToMultipleAddresses;
                if (!string.IsNullOrEmpty(settings.CheckoutTermsAndConditions))
                {
                    CheckoutTerms.Text = settings.CheckoutTermsAndConditions;
                }

                EnableOrderNotes.Checked = settings.EnableCustomerOrderNotes;

                // UNITS
                WeightUnit.DataSource     = EnumToHashtable(typeof(CommerceBuilder.Shipping.WeightUnit));
                WeightUnit.DataTextField  = "Key";
                WeightUnit.DataValueField = "Value";
                WeightUnit.DataBind();

                MeasurementUnit.DataSource     = EnumToHashtable(typeof(CommerceBuilder.Shipping.MeasurementUnit));
                MeasurementUnit.DataTextField  = "Key";
                MeasurementUnit.DataValueField = "Value";
                MeasurementUnit.DataBind();

                item = WeightUnit.Items.FindByValue(store.WeightUnitId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }
                item = MeasurementUnit.Items.FindByValue(store.MeasurementUnitId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }
                BindTimeZone();

                PostalCodeCountries.Text = settings.PostalCodeCountries;

                // PRODUCTS PURCHASING
                ProductPurchasingDisabled.Checked = settings.ProductPurchasingDisabled;

                // WISHLISTS ENABLED
                WishlistsEnabled.Checked = settings.WishlistsEnabled;

                // SEARCH SETTINGS
                EnableWishlistSearch.Checked    = settings.WishlistSearchEnabled;
                MinimumSearchLength.Text        = settings.MinimumSearchLength.ToString();
                PopularSearchThreshold.Text     = settings.PopularSearchThreshold.ToString();
                CategorySearchDisplayLimit.Text = settings.CategorySearchDisplayLimit.ToString();

                item = SearchProvider.Items.FindByValue(ApplicationSettings.Instance.SearchProvider);
                if (item != null)
                {
                    item.Selected = true;
                }

                // RESTRICT STORE ACCESS
                ListItem option = RestrictStoreAccessOptions.Items.FindByValue(settings.RestrictStoreAccess.ToString());
                if (option != null)
                {
                    option.Selected = true;
                }


                IList <Group> allGroups        = GroupDataSource.LoadForStore(AbleContext.Current.StoreId, "Name ASC");
                IList <Group> nonAdminGroups   = allGroups.FindAll(grp => !grp.IsInRole(Role.AllAdminRoles)) as IList <Group>;
                IList <Group> authorizedGroups = allGroups.FindAll(grp => grp.IsInRole(Role.CustomerRoles));
                AuthorizedGroups.DataSource = nonAdminGroups as IList <Group>;
                AuthorizedGroups.DataBind();
                foreach (ListItem groupItem in AuthorizedGroups.Items)
                {
                    int groupId = AlwaysConvert.ToInt(groupItem.Value);
                    foreach (Group group in authorizedGroups)
                    {
                        if (groupId == group.Id)
                        {
                            groupItem.Selected = true; break;
                        }
                    }
                }

                PaymentStorage.Checked = settings.EnablePaymentProfilesStorage;

                EnableHtmlEditor.Checked = settings.EnableWysiwygEditor;
            }
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Store store = AbleContext.Current.Store;
            StoreSettingsManager  settings       = store.Settings;
            IList <EmailTemplate> emailTemplates = EmailTemplateDataSource.LoadAll();

            if (!Page.IsPostBack)
            {
                foreach (EmailTemplate template in emailTemplates)
                {
                    EnrollmentEmail.Items.Add(new ListItem(template.Name, template.Id.ToString()));
                    PaymentRemindersEmail.Items.Add(new ListItem(template.Name, template.Id.ToString()));
                    SubscriptionExpirationEmailTemplate.Items.Add(new ListItem(template.Name, template.Id.ToString()));
                    CancellationEmail.Items.Add(new ListItem(template.Name, template.Id.ToString()));
                    ExpiredEmail.Items.Add(new ListItem(template.Name, template.Id.ToString()));
                    SubscriptionChangedEmail.Items.Add(new ListItem(template.Name, template.Id.ToString()));
                }

                ROEnabledPanel.Visible     = settings.ROCreateNewOrdersEnabled;
                RONotEnabledPanel.Visible  = !ROEnabledPanel.Visible;
                EnableInstructions.Visible = false;
                LblEnabling.Visible        = false;

                // CreateNewOrders.Checked = settings.ROCreateNewOrdersEnabled;
                ListItem item = new ListItem();

                CreateNextOrderDays.Text           = settings.ROCreateNextOrderDays.ToString();
                SubscriptionChangesDays.Text       = settings.ROSubscriptionChangesDays.ToString();
                SubscriptionsCancellationDays.Text = settings.ROSubscriptionCancellationDays.ToString();

                EnrollmentEmail.ClearSelection();
                item = EnrollmentEmail.Items.FindByValue(settings.ROSubscriptionEnrollmentEmailTemplateId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }

                PaymentReminderDays.Text = settings.ROPaymentReminderIntervalDays.ToString();
                PaymentRemindersEmail.ClearSelection();
                item = PaymentRemindersEmail.Items.FindByValue(settings.ROPaymentReminderEmailTemplateId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }

                /* Currently we do not have a separate email sending for failure of subscription payment
                 * item = PaymnetFailureEmail.Items.FindByValue(settings.ROPaymentFailEmailTemplateId.ToString());
                 * if (item != null) item.Selected = true;
                 */

                if (!string.IsNullOrEmpty(settings.ROExpirationReminderEmailDays))
                {
                    ExpirationReminderEmailIntervalDays.Text = settings.ROExpirationReminderEmailDays.ToString();
                }

                SubscriptionExpirationEmailTemplate.ClearSelection();
                item = SubscriptionExpirationEmailTemplate.Items.FindByValue(settings.ROExpirationReminderEmailTemplateId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }

                SubscriptionChangedEmail.ClearSelection();
                item = SubscriptionChangedEmail.Items.FindByValue(settings.ROSubscriptionUpdatedEmailTemplateId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }

                CancellationEmail.ClearSelection();
                item = CancellationEmail.Items.FindByValue(settings.ROSubscriptionCancellationEmailTemplateId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }

                ExpiredEmail.ClearSelection();
                item = ExpiredEmail.Items.FindByValue(settings.ROSubscriptionExpiredEmailTemplateId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }

                IgnoreGatewayForPartialRecurSupport.Checked = settings.ROIgnoreGatewayForPartialRecurSupport;
                CreateOrdersForDetachedPayments.Checked     = settings.ROCreateOrdersForDetachedPayments;
                trCreateOrdersForDetachedPayments.Visible   = false;
                RecurringPaymentsWithoutCVVAllowed.Checked  = settings.RORecurringPaymentsWithoutCVVAllowed;

                // SettingsPanel.Visible = CreateNewOrders.Checked;
            }
        }