private void SaveSettings()
        {
            DataModel.Store store = new DataModel.Store();
            if (store.LoadByPrimaryKey(StoreContext.CurrentStore.Id.Value))
            {
                store.UpdateSetting(StoreSettingNames.CatalogDefaultSortOrder, ddlDefaultSortOrder.SelectedValue);
                store.UpdateSetting(StoreSettingNames.CatalogMaxResultsPerPage, WA.Parser.ToInt(txtMaxResultsPerPage.Text).GetValueOrDefault(100).ToString());

                Response.Redirect(StoreUrls.AdminWithFlash(ModuleDefs.Admin.Views.AdminHome, "Catalog Settings saved successfully"));
            }
        }
        private void SaveStoreSettings()
        {
            DataModel.Store store = new DataModel.Store();
            if (store.LoadByPrimaryKey(StoreContext.CurrentStore.Id.Value))
            {
                store.Name = txtStoreName.Text;
                store.Save();


                store.UpdateSetting(StoreSettingNames.IncludeJQueryUi, chkLoadJQueryUi.Checked.ToString());

                store.UpdateSetting(StoreSettingNames.OrderCompletedEmailRecipient, txtOrderCompletedEmailRecipient.Text);
                store.UpdateSetting(StoreSettingNames.CustomerServiceEmailAddress, txtCustomerServiceEmail.Text);
                store.UpdateSetting(StoreSettingNames.OrderNumberPrefix, txtOrderNumberPrefix.Text);
                store.UpdateSetting(StoreSettingNames.DefaultCountryCode, ddlDefaultCountryCode.SelectedValue);

                store.UpdateSetting(StoreSettingNames.CurrencyCode, ddlCurrency.SelectedValue);
                store.UpdateSetting(StoreSettingNames.ShowPrices, chkShowPrices.Checked.ToString());
                store.UpdateSetting(StoreSettingNames.AcceptedCreditCards, chklAcceptedCreditCards.GetSelectedValues().ToDelimitedString(","));

                store.UpdateSetting(StoreSettingNames.StorePhoneNumber, txtStorePhone.Text);
                store.UpdateSetting(StoreSettingNames.StoreAddressStreet, txtStoreStreet.Text);
                store.UpdateSetting(StoreSettingNames.StoreAddressCity, txtStoreCity.Text);
                store.UpdateSetting(StoreSettingNames.StoreAddressRegion, txtStoreRegion.Text);
                store.UpdateSetting(StoreSettingNames.StoreAddressPostalCode, txtStorePostalCode.Text);
                store.UpdateSetting(StoreSettingNames.StoreAddressCountryCode, ddlStoreCountryCode.SelectedValue);

                store.UpdateSetting(StoreSettingNames.EnableCheckout, chkEnableCheckout.Checked.ToString());
                store.UpdateSetting(StoreSettingNames.CheckoutAllowAnonymous, chkCheckoutAllowAnonymous.Checked.ToString());
                store.UpdateSetting(StoreSettingNames.CheckoutShowCreateAccountLink, chkCheckoutShowCreateAccountLink.Checked.ToString());
                store.UpdateSetting(StoreSettingNames.ShowPriceAndQuantityInCatalog, chkQuantityAndPrice.Checked.ToString());
                store.UpdateSetting(StoreSettingNames.RequireOrderNotes, chkRequireOrderNotes.Checked.ToString());

                store.UpdateSetting(StoreSettingNames.ShowCouponBox, chkShowCouponBox.Checked.ToString());
                store.UpdateSetting(StoreSettingNames.ShowShippingEstimate, chkShowShippingEstimateBox.Checked.ToString());

                store.UpdateSetting(StoreSettingNames.SendPaymentCompleteEmail, chkSendPaymentCompleteEmail.Checked.ToString());
                store.UpdateSetting(StoreSettingNames.SendOrderReceivedEmail, chkSendOrderReceivedEmail.Checked.ToString());

                store.UpdateSetting(StoreSettingNames.TaxShipping, chkTaxShipping.Checked.ToString());
                store.UpdateSetting(StoreSettingNames.ForceSslCheckout, chkForceSslCheckout.Checked.ToString());
                store.UpdateSetting(StoreSettingNames.DisplaySiteCredit, chkDisplaySiteCredit.Checked.ToString());
                store.UpdateSetting(StoreSettingNames.UrlToPostCompletedOrder, txtUrlToPostOrder.Text);

                // re-load the current store from the DB
                StoreContext.SetCurrentStore(store.Id.Value);

                Response.Redirect(StoreUrls.AdminWithFlash(ModuleDefs.Admin.Views.StoreSettings, "Store settings saved successfully"));
            }
        }