protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!IsPostBack)
            {
                LoadPaymentProviders();

                DrpVatGroups.DataSource = VatGroupService.Instance.GetAll(paymentMethod.StoreId);
                DrpVatGroups.DataBind();

                TxtName.Text = paymentMethod.Name;
                TxtDictionaryItemName.Text = paymentMethod.Alias;
                TxtSku.Text = paymentMethod.Sku;
                if (paymentMethod.VatGroupId != null)
                {
                    DrpVatGroups.SelectedValue = paymentMethod.VatGroupId.Value.ToString();
                }
                if (!string.IsNullOrEmpty(paymentMethod.ImageIdentifier))
                {
                    CPImage.Value = paymentMethod.ImageIdentifier;
                }

                foreach (ListItem item in DrpPaymentProviders.Items)
                {
                    item.Selected = item.Value == paymentMethod.PaymentProviderAlias;
                }

                if (paymentMethod.Settings.Count == 0)
                {
                    OverwriteSettings();
                }

                LoadPaymentMethodSettings();
                LoadPaymentProviderAPIAllows(false);

                LoadCurrenciesAndCountries();
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!IsPostBack)
            {
                DrpVatGroups.DataSource = VatGroupService.Instance.GetAll(shippingMethod.StoreId);
                DrpVatGroups.DataBind();

                TxtName.Text = shippingMethod.Name;
                TxtDictionaryItemName.Text = shippingMethod.Alias;
                TxtSku.Text = shippingMethod.Sku;
                if (shippingMethod.VatGroupId != null)
                {
                    DrpVatGroups.SelectedValue = shippingMethod.VatGroupId.Value.ToString();
                }
                if (!string.IsNullOrEmpty(shippingMethod.ImageIdentifier))
                {
                    CPImage.Value = shippingMethod.ImageIdentifier;
                }

                LoadCurrenciesAndCountries();
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (!IsPostBack)
            {
                TemplateFileSelectorControl.LoadTemplateFiles();
                TemplateFileSelectionListControl.LoadTemplateFiles();

                TxtName.Text            = store.Name;
                DrpCountries.DataSource = CountryService.Instance.GetAll(store.Id);
                DrpCountries.DataBind();
                DrpCountries.SelectedValue = store.GeneralSettings.DefaultCountryId.ToString();

                DrpVatGroups.DataSource = VatGroupService.Instance.GetAll(store.Id);
                DrpVatGroups.DataBind();
                DrpVatGroups.SelectedValue = store.GeneralSettings.DefaultVatGroupId.ToString();

                DrpOrderStatuses.DataSource = OrderStatusService.Instance.GetAll(store.Id);
                DrpOrderStatuses.DataBind();
                DrpOrderStatuses.SelectedValue = store.GeneralSettings.DefaultOrderStatusId.ToString();

                DrpConfirmationEmail.DataSource = EmailTemplateService.Instance.GetAll(store.Id);
                DrpConfirmationEmail.DataBind();
                DrpConfirmationEmail.Items.TrySelectByValue(store.GeneralSettings.ConfirmationEmailTemplateId);

                DrpPaymentInconsistencyEmail.DataSource = EmailTemplateService.Instance.GetAll(store.Id);
                DrpPaymentInconsistencyEmail.DataBind();
                DrpPaymentInconsistencyEmail.Items.TrySelectByValue(store.GeneralSettings.PaymentInconsistencyEmailTemplateId);

                ChkPricesIsSpecifiedWithVat.Checked = store.GeneralSettings.PricesIsSpecifiedWithVat;

                ChkPersistOrderId.Checked = store.GeneralSettings.CookieTimeout != null;
                if (store.GeneralSettings.CookieTimeout != null)
                {
                    TxtOrderPersistanceTimeout.Text = store.GeneralSettings.CookieTimeout.Value.TotalMinutes.ToString("0");
                }

                TxtCartNumberPrefix.Text  = store.OrderSettings.CartNumberPrefix;
                TxtOrderNumberPrefix.Text = store.OrderSettings.OrderNumberPrefix;

                TxtProductPropertyAliases.Text           = string.Join(",", store.ProductSettings.ProductPropertyAliases);
                TxtProductUniquenessPropertyAliases.Text = string.Join(",", store.ProductSettings.ProductUniquenessPropertyAliases);

                IEnumerable <Store> stores             = StoreService.Instance.GetAll().ToList();
                IEnumerable <Store> stockSharingStores = stores.Where(s => s.ProductSettings.StockSharingStoreId == store.Id).ToList();
                PPnlStockSharingStore.Visible        = stores.Count() > 1;
                DrpStockSharingStore.Visible         = !stockSharingStores.Any();
                LblStockSharingStoreAssigned.Visible = !DrpStockSharingStore.Visible;

                if (!stockSharingStores.Any())
                {
                    foreach (Store store1 in stores)
                    {
                        if (store1.Id != store.Id)
                        {
                            bool hasAccessToStore = currentLoggedInUserPermissions != null && currentLoggedInUserPermissions.HasPermission(StoreSpecificPermissionType.AccessStore, store1.Id);

                            if (hasAccessToStore || store1.Id == store.ProductSettings.StockSharingStoreId)
                            {
                                DrpStockSharingStore.Items.Add(new ListItem((!hasAccessToStore ? "* " : "") + store1.Name, store1.Id.ToString(CultureInfo.InvariantCulture)));
                            }
                        }
                    }
                    DrpStockSharingStore.Items.TrySelectByValue(store.ProductSettings.StockSharingStoreId);
                }
                else
                {
                    LblStockSharingStoreAssigned.Text = string.Join(", ", stockSharingStores.Select(s => s.Name));
                }

                TxtGiftCardLength.Text    = store.GiftCardSettings.Length.ToString(CultureInfo.InvariantCulture);
                TxtGiftCardDaysValid.Text = store.GiftCardSettings.DaysValid.ToString(CultureInfo.InvariantCulture);
                TxtGiftCardPrefix.Text    = store.GiftCardSettings.Prefix;
                TxtGiftCardSuffix.Text    = store.GiftCardSettings.Suffix;

                TemplateFileSelectorControl.Items.TrySelectByValue(store.UISettings.EditOrderUiFile);
                TemplateFileSelectionListControl.Items.Cast <ListItem>().ToList().ForEach(i => i.Selected = store.UISettings.AllowedFilesForClientRendering.Contains(i.Value));
            }
        }