/// <summary> /// Submit button click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin(); Portal portal = storeAdmin.GetByPortalId(ZNodeConfigManager.SiteConfig.PortalID); portal.AdminEmail = txtAdminEmail.Text; portal.CompanyName = txtCompanyName.Text; portal.CustomerServiceEmail = txtCustomerServiceEmail.Text; portal.CustomerServicePhoneNumber = txtCustomerServicePhoneNumber.Text; portal.DomainName = txtDomainName.Text; portal.MaxCatalogDisplayColumns = byte.Parse(txtMaxCatalogDisplayColumns.Text); portal.MaxCatalogDisplayItems = int.Parse(txtMaxCatalogDisplayItems.Text); portal.InclusiveTax = chkInclusiveTax.Checked; portal.MaxCatalogItemThumbnailWidth = int.Parse(txtMaxCatalogItemThumbnailWidth.Text); portal.MaxCatalogCategoryDisplayThumbnails = int.Parse(txtMaxSmallThumbnailsDisplay.Text); portal.SiteWideBottomJavascript = txtSiteWideBottomJavaScript.Text; portal.SiteWideTopJavascript = txtSiteWideTopJavaScript.Text; portal.SiteWideAnalyticsJavascript = txtSiteWideAnalyticsJavascript.Text; portal.OrderReceiptAffiliateJavascript = txtOrderReceiptJavaScript.Text; portal.MaxCatalogItemLargeWidth = int.Parse(txtMaxCatalogItemLargeWidth.Text); portal.MaxCatalogItemMediumWidth = int.Parse(txtMaxCatalogItemMediumWidth.Text); portal.MaxCatalogItemSmallWidth = int.Parse(txtMaxCatalogItemSmallWidth.Text); portal.MaxCatalogItemCrossSellWidth = int.Parse(txtMaxCatalogCrossSellWidth.Text); portal.MaxCatalogItemThumbnailWidth = int.Parse(txtMaxCatalogItemThumbnailWidth.Text); portal.MaxCatalogItemSwatchWidth = int.Parse(txtMaxCatalogItemSwatchesWidth.Text); portal.ShopByPriceMin = int.Parse(txtShopByPriceMin.Text); portal.ShopByPriceMax = int.Parse(txtShopByPriceMax.Text); portal.ShopByPriceIncrement = int.Parse(txtShopByPriceIncrement.Text); portal.SalesEmail = txtSalesEmail.Text; portal.SalesPhoneNumber = txtSalesPhoneNumber.Text; portal.StoreName = txtStoreName.Text; portal.UseSSL = chkEnableSSL.Checked; portal.DefaultReviewStatus = ListReviewStatus.SelectedValue; //Currency Settings portal.CurrencyTypeID = int.Parse(ddlCurrencyTypes.SelectedValue); ZNodeEncryption encrypt = new ZNodeEncryption(); //SMTP Server Settings portal.SMTPServer = txtSMTPServer.Text; portal.SMTPUserName = encrypt.EncryptData(txtSMTPUserName.Text); portal.SMTPPassword = encrypt.EncryptData(txtSMTPPassword.Text); //UPS Shipping Settings portal.UPSUserName = encrypt.EncryptData(txtUPSUserName.Text.Trim()); portal.UPSPassword = encrypt.EncryptData(txtUPSPassword.Text.Trim()); portal.UPSKey = encrypt.EncryptData(txtUPSKey.Text.Trim()); //FedEx Shipping Settings portal.FedExAccountNumber = encrypt.EncryptData(txtAccountNum.Text.Trim()); portal.FedExMeterNumber = encrypt.EncryptData(txtMeterNum.Text.Trim()); portal.FedExProductionKey = encrypt.EncryptData(txtProductionAccessKey.Text.Trim()); portal.FedExSecurityCode = encrypt.EncryptData(txtSecurityCode.Text.Trim()); //Units portal.WeightUnit = ddlWeightUnits.SelectedItem.Text; portal.DimensionUnit = ddlDimensions.SelectedItem.Text; //default order status setting portal.DefaultOrderStateID = int.Parse(ddlOrderStateList.SelectedValue); //Shipping Settings portal.ShippingOriginAddress1 = txtShippingAddress1.Text.Trim(); portal.ShippingOriginAddress2 = txtShippingAddress2.Text.Trim(); portal.ShippingOriginCity = txtShippingCity.Text.Trim(); portal.ShippingOriginPhone = txtShippingPhone.Text.Trim(); portal.ShippingOriginZipCode = txtShippingZipCode.Text.Trim(); portal.ShippingOriginStateCode = txtShippingStateCode.Text.Trim(); portal.ShippingOriginCountryCode = txtShippingCountryCode.Text.Trim(); portal.FedExDropoffType = ddldropOffTypes.SelectedItem.Value; portal.FedExPackagingType = ddlPackageTypeCodes.SelectedItem.Value; portal.FedExUseDiscountRate = chkFedExDiscountRate.Checked; portal.FedExAddInsurance = chkAddInsurance.Checked; // set logo path System.IO.FileInfo _FileInfo = null; if (radNewImage.Checked == true) { //Check for Product Image _FileInfo = new System.IO.FileInfo(UploadImage.PostedFile.FileName); if (_FileInfo != null) { if ((_FileInfo.Extension == ".jpeg") || (_FileInfo.Extension.Equals(".jpg")) || (_FileInfo.Extension.Equals(".png")) || (_FileInfo.Extension.Equals(".gif"))) { portal.LogoPath = ZNodeConfigManager.EnvironmentConfig.ContentPath + _FileInfo.Name; UploadImage.SaveAs(Server.MapPath(ZNodeConfigManager.EnvironmentConfig.ContentPath + _FileInfo.Name)); } else { lblImageError.Text = "Select a valid jpg, gif or png image."; return; } } } bool ret = storeAdmin.Update(portal); //Set currency CurrencyType currencyType = storeAdmin.GetByCurrencyTypeID(int.Parse(ddlCurrencyTypes.SelectedValue)); if(currencyType !=null) { currencyType.CurrencySuffix = txtCurrencySuffix.Text.Trim(); storeAdmin.UpdateCurrencyType(currencyType); } //remove the siteconfig from session ZNodeConfigManager.SiteConfig = null; if (!ret) { lblMsg.Text = "An error ocurred while updating the store settings. Please try again."; //Log Activity ZNode.Libraries.Framework.Business.ZNodeLogging.LogActivity(9002, HttpContext.Current.User.Identity.Name); } else { HttpContext.Current.Application["CurrencyTypeCache"] = currencyType; Response.Redirect("~/admin/secure/default.aspx"); //Log Activity ZNode.Libraries.Framework.Business.ZNodeLogging.LogActivity(9001, HttpContext.Current.User.Identity.Name); } }
/// <summary> /// Display Price in specified culture format /// </summary> private void ShowPriceFormat() { StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin(); CurrencyType _currencyType = storeAdmin.GetByCurrencyTypeID(int.Parse(ddlCurrencyTypes.SelectedValue)); txtCurrencySuffix.Text = _currencyType.CurrencySuffix; string currencySymbol = _currencyType.Name; CultureInfo info = new CultureInfo(currencySymbol); decimal price = 100.12M; lblPrice.Text = price.ToString("c", info.NumberFormat); if(txtCurrencySuffix.Text.Trim().Length > 0) lblPrice.Text += " (" + txtCurrencySuffix.Text.Trim() + ")"; }