/// <summary> /// Delete button click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDelete_Click(object sender, EventArgs e) { StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin(); PaymentSetting _pmtSettings = storeAdmin.GetPaymentSettingByID(ItemId); //Disabled because this does not permit removing CC profiles which is annoying //Validate atleast one payment must exist for each profile //if (!storeAdmin.CheckPaymentSettingProfile(_pmtSettings.ProfileID)) //{ // lblMsg.Text = "At least one Payment Option must exist for each Profile Name."; // lblMsg.CssClass = "Error"; // return; //} bool retval = storeAdmin.DeletePaymentSetting(ItemId); if (!retval) { lblMsg.Text = "Delete action could not be completed."; lblMsg.CssClass = "Error"; } else { Response.Redirect("~/admin/secure/settings/payment/"); } }
/// <summary> /// Bind data to the fields /// </summary> protected void BindData() { ShippingAdmin shipAdmin = new ShippingAdmin(); StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin(); if (ItemId > 0) { Shipping shippingOption = shipAdmin.GetShippingOptionById(ItemId); lblShippingType.Text = shipAdmin.GetShippingTypeName(shippingOption.ShippingTypeID); if (shippingOption.ProfileID.HasValue) lblProfileName.Text = shipAdmin.GetProfileNamee((int)shippingOption.ProfileID); else lblProfileName.Text = "All Profiles"; lblDescription.Text = shippingOption.Description; lblShippingCode.Text = shippingOption.ShippingCode; if (shippingOption.HandlingCharge > 0) { lblHandlingCharge.Text = shippingOption.HandlingCharge.ToString("N2"); } else { lblHandlingCharge.Text = "0.00"; } if (shippingOption.DestinationCountryCode != null) { if (shippingOption.DestinationCountryCode.Length > 0) { lblDestinationCountry.Text = shippingOption.DestinationCountryCode; } } else { lblDestinationCountry.Text = "All Countries"; } imgActive.Src = ZNodeHelper.GetCheckMark((bool)shippingOption.ActiveInd); lblDisplayOrder.Text = shippingOption.DisplayOrder.ToString(); if (shippingOption.ShippingTypeID == 1) { pnlShippingRuletypes.Visible = true; } } else { //nothing to do here } }
/// <summary> /// Binds the themes to the DropDownList /// </summary> private void BindList() { System.IO.DirectoryInfo path = new System.IO.DirectoryInfo(Server.MapPath(ZNodeConfigManager.EnvironmentConfig.ApplicationPath + "/Themes")); themeslist.DataSource = path.GetDirectories(); themeslist.DataBind(); StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin(); Portal portal = storeAdmin.GetByPortalId(ZNodeConfigManager.SiteConfig.PortalID); if (themeslist.SelectedIndex != -1) { themeslist.SelectedValue = portal.Theme; } ListItem li = new ListItem("Select a Site Theme", "0"); themeslist.Items.Insert(0, li); lblError.Visible = false; }
/// <summary> /// Submit Button Click Event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { if(themeslist.SelectedIndex > 0) { StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin(); Portal portal = storeAdmin.GetByPortalId(ZNodeConfigManager.SiteConfig.PortalID); portal.Theme = themeslist.SelectedValue; ZNodeConfigManager.RefreshConfiguration(); storeAdmin.Update(portal); lblmessage.Text = "The theme of your site has been successfully changed."; btnSubmit.Visible = false; btncancel.Visible = false; lblError.Visible = false; btnback.Visible = true; } else { lblError.Visible = true; lblError.Text = "* Select a theme"; } }
/// <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); // SEO Settings portal.SeoDefaultProductTitle = txtSEOProductTitle.Text.Trim(); portal.SeoDefaultProductDescription = txtSEOProductDescription.Text.Trim(); portal.SeoDefaultProductKeyword = txtSEOProductKeyword.Text.Trim(); portal.SeoDefaultCategoryTitle = txtSEOCategoryTitle.Text.Trim(); portal.SeoDefaultCategoryDescription = txtSEOCategoryDescription.Text.Trim(); portal.SeoDefaultCategoryKeyword = txtSEOCategoryKeyword.Text.Trim(); portal.SeoDefaultContentTitle = txtSEOContentTitle.Text.Trim(); portal.SeoDefaultContentDescription = txtSEOContentDescription.Text.Trim(); portal.SeoDefaultContentKeyword = txtSEOContentKeyword.Text.Trim(); bool ret = storeAdmin.Update(portal); //remove the siteconfig from session ZNodeConfigManager.SiteConfig = null; if (!ret) { lblMsg.Text = "An error ocurred while updating the SEO settings. Please try again."; //Log Activity ZNode.Libraries.Framework.Business.ZNodeLogging.LogActivity(9002, HttpContext.Current.User.Identity.Name); } else { Response.Redirect("~/admin/secure/SEO/SEOManager.aspx"); //Log Activity ZNode.Libraries.Framework.Business.ZNodeLogging.LogActivity(9001, HttpContext.Current.User.Identity.Name); } }
public void BindImage() { ZNode.Libraries.Admin.StoreSettingsAdmin imageadmin = new StoreSettingsAdmin(); GridThumb.DataSource = imageadmin.Getall(); GridThumb.DataBind(); }
/// <summary> /// Submit button click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin(); PaymentSetting paymentSetting = new PaymentSetting(); //If edit mode then retrieve data first if (ItemId > 0) { paymentSetting = settingsAdmin.GetPaymentSettingByID(ItemId); if (paymentSetting.ProfileID.HasValue) { if ((paymentSetting.ProfileID != int.Parse(lstProfile.SelectedValue)) || (paymentSetting.PaymentTypeID != int.Parse(lstPaymentType.SelectedValue))) { //check if this setting already exists for this profile bool settingExists = PaymentSettingExists(); if (settingExists) { lblMsg.Text = "This Payment Option already exists for this Profile. Please select a different Payment Option."; return; } } } else { if (lstProfile.SelectedValue != "-1") { //check if this setting already exists for this profile bool settingExists = PaymentSettingExists(); if (settingExists) { lblMsg.Text = "This Payment Option already exists for this Profile. Please select a different Payment Option."; return; } } } } //set values based on user input paymentSetting.ActiveInd = chkActiveInd.Checked; paymentSetting.PaymentTypeID = int.Parse(lstPaymentType.SelectedValue); if (lstProfile.SelectedValue == "-1") { paymentSetting.ProfileID = null;//If All profiles is selected } else { paymentSetting.ProfileID = int.Parse(lstProfile.SelectedValue); } paymentSetting.DisplayOrder = Convert.ToInt32(txtDisplayOrder.Text); //paymentSetting.OfflineMode = false; //if credit card if (paymentSetting.PaymentTypeID == 0) { paymentSetting.GatewayTypeID = int.Parse(lstGateway.SelectedValue); paymentSetting.EnableAmex = chkEnableAmex.Checked; paymentSetting.EnableDiscover = chkEnableDiscover.Checked; paymentSetting.EnableMasterCard = chkEnableMasterCard.Checked; paymentSetting.EnableVisa = chkEnableVisa.Checked; paymentSetting.TestMode = chkTestMode.Checked; paymentSetting.PreAuthorize = chkPreAuthorize.Checked; paymentSetting.GatewayPassword = string.Empty; paymentSetting.TransactionKey = string.Empty; ZNodeEncryption encrypt = new ZNodeEncryption(); paymentSetting.GatewayUsername = encrypt.EncryptData(txtGatewayUserName.Text); //if authorize.net if (paymentSetting.GatewayTypeID == 1) { paymentSetting.TransactionKey = encrypt.EncryptData(txtTransactionKey.Text); } //If Verisign PayFlow pro gateway is selected else if (paymentSetting.GatewayTypeID == 2) { paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text); paymentSetting.Partner = txtPartner.Text.Trim(); paymentSetting.Vendor = txtVendor.Text.Trim(); } //If Nova gateway is selected else if (paymentSetting.GatewayTypeID == 5) { paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text); paymentSetting.TransactionKey = encrypt.EncryptData(txtTransactionKey.Text); } //If Paypal direct payment gateway is selected else if (paymentSetting.GatewayTypeID == 6) { paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text); paymentSetting.TransactionKey = txtTransactionKey.Text; } // If World Pay gateway is selected else if (paymentSetting.GatewayTypeID == 10) { // Authorization password paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text); // Installation Id paymentSetting.TransactionKey = encrypt.EncryptData(txtTransactionKey.Text); } else { paymentSetting.TransactionKey = ""; paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text); } } // if Paypal else if (paymentSetting.PaymentTypeID == 2) { paymentSetting.GatewayTypeID = null; ZNodeEncryption encrypt = new ZNodeEncryption(); paymentSetting.GatewayUsername = encrypt.EncryptData(txtGatewayUserName.Text); paymentSetting.TransactionKey = txtTransactionKey.Text; paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text); paymentSetting.TestMode = chkTestMode.Checked; } //if Google Checkout else if (paymentSetting.PaymentTypeID == 3) { paymentSetting.GatewayTypeID = null; //Set null value to Google ZNodeEncryption encrypt = new ZNodeEncryption(); paymentSetting.GatewayUsername = encrypt.EncryptData(txtGatewayUserName.Text); paymentSetting.GatewayPassword = encrypt.EncryptData(txtGatewayPassword.Text); paymentSetting.TestMode = chkTestMode.Checked; } else // Purchase Order { paymentSetting.GatewayTypeID = null; } bool retval = false; //Update Payment setting into database if (ItemId > 0) { retval = settingsAdmin.UpdatePaymentSetting(paymentSetting); } else { bool settingExists = settingsAdmin.PaymentSettingExists(int.Parse(lstProfile.SelectedValue), int.Parse(lstPaymentType.SelectedValue)); if (settingExists) { lblMsg.Text = "This Payment Option already exists for this Profile. Please select a different Payment Option."; return; } retval = settingsAdmin.AddPaymentSetting(paymentSetting); } if (retval) { //redirect to main page Response.Redirect("~/admin/secure/settings/payment/"); } else { //display error message lblMsg.Text = "An error occurred while updating. Please try again."; } }
/// <summary> /// Bind data to grid /// </summary> private void BindGridData() { StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin(); uxGrid.DataSource = settingsAdmin.GetPaymentSettings(ZNodeConfigManager.SiteConfig.PortalID); uxGrid.DataBind(); }
/// <summary> /// Submit button click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin(); ShippingAdmin shipAdmin = new ShippingAdmin(); Shipping shipOption = new Shipping(); //If edit mode then retrieve data first if (ItemId > 0) { shipOption = shipAdmin.GetShippingOptionById(ItemId); } //set values shipOption.ActiveInd = chkActiveInd.Checked; //If UPS Shipping type is selected if (lstShippingType.SelectedValue == "2") { shipOption.ShippingCode = lstShippingServiceCodes.SelectedItem.Value; shipOption.Description = lstShippingServiceCodes.SelectedItem.Text; } //If FedEx Shipping type is selected else if (lstShippingType.SelectedValue == "3") { shipOption.ShippingCode = lstShippingServiceCodes.SelectedItem.Value; shipOption.Description = lstShippingServiceCodes.SelectedItem.Text; } else { shipOption.ShippingCode = txtShippingCode.Text; shipOption.Description = txtDescription.Text; } if (lstCountries.SelectedValue.Equals("*")) { shipOption.DestinationCountryCode = null; } else { shipOption.DestinationCountryCode = lstCountries.SelectedValue; } shipOption.DisplayOrder = int.Parse(txtDisplayOrder.Text); //Profile settings if (lstProfile.SelectedValue != "-1") { shipOption.ProfileID = int.Parse(lstProfile.SelectedValue); } else { shipOption.ProfileID = null; } shipOption.ShippingTypeID = int.Parse(lstShippingType.SelectedValue); if (txtHandlingCharge.Text.Length > 0) { shipOption.HandlingCharge = decimal.Parse(txtHandlingCharge.Text); } bool retval = false; if (ItemId > 0) { retval = shipAdmin.UpdateShippingOption(shipOption); } else { retval = shipAdmin.AddShippingOption(shipOption); } if (retval) { //redirect to main page Response.Redirect("~/admin/secure/settings/shipping/default.aspx"); } else { //display error message lblMsg.Text = "An error occurred while updating. Please try again."; } }
/// <summary> /// Bind data to the fields /// </summary> protected void BindData() { ShippingAdmin shipAdmin = new ShippingAdmin(); StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin(); //GET LIST DATA //Get shipping types lstShippingType.DataSource = shipAdmin.GetShippingTypes(); lstShippingType.DataTextField = "Name"; lstShippingType.DataValueField = "ShippingTypeID"; lstShippingType.DataBind(); lstShippingType.SelectedIndex = 0; //Bind countries BindCountry(); //get profiles lstProfile.DataSource = settingsAdmin.GetProfiles(); lstProfile.DataTextField = "Name"; lstProfile.DataValueField = "ProfileID"; lstProfile.DataBind(); lstProfile.Items.Insert(0, new ListItem("All Profiles", "-1")); lstProfile.SelectedItem.Value = "-1"; if (ItemId > 0) { Shipping shippingOption = shipAdmin.GetShippingOptionById(ItemId); if(shippingOption.ProfileID.HasValue) lstProfile.SelectedValue = shippingOption.ProfileID.Value.ToString(); lstShippingType.SelectedValue = shippingOption.ShippingTypeID.ToString(); lstShippingType.Enabled = false; //If UPS Shipping Option is Selected if (lstShippingType.SelectedValue == "2") { //Bind UPS Service codes BindShippingServiceCodes(); lstShippingServiceCodes.SelectedValue = shippingOption.ShippingCode; pnlShippingServiceCodes.Visible = true; pnlShippingOptions.Visible = false; pnlDestinationCountry.Visible = false; } //If FedEx Shipping Option is Selected else if (lstShippingType.SelectedValue == "3") { //Bind FedEx Service codes BindShippingServiceCodes(); lstShippingServiceCodes.SelectedValue = shippingOption.ShippingCode; pnlShippingServiceCodes.Visible = true; pnlShippingOptions.Visible = false; pnlDestinationCountry.Visible = false; } else { txtDescription.Text = shippingOption.Description; txtShippingCode.Text = shippingOption.ShippingCode; } if (shippingOption.HandlingCharge > 0) { txtHandlingCharge.Text = shippingOption.HandlingCharge.ToString("N2"); } else { txtHandlingCharge.Text = "0.00"; } if (shippingOption.DestinationCountryCode != null) { if (shippingOption.DestinationCountryCode.Length > 0) { lstCountries.SelectedValue = shippingOption.DestinationCountryCode; } } chkActiveInd.Checked = (bool)shippingOption.ActiveInd; txtDisplayOrder.Text = shippingOption.DisplayOrder.ToString(); } else { //nothing to do here } }
/// <summary> /// Check if this setting already exists for this profile /// </summary> private bool PaymentSettingExists() { StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin(); return settingsAdmin.PaymentSettingExists(int.Parse(lstProfile.SelectedValue), int.Parse(lstPaymentType.SelectedValue)); }
/// <summary> /// Bind data to the fields /// </summary> protected void BindData() { StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin(); txtDisplayOrder.Text = "1"; //GET LIST DATA //Get payment types lstPaymentType.DataSource = settingsAdmin.GetPaymentTypes(); lstPaymentType.DataTextField = "Name"; lstPaymentType.DataValueField = "PaymentTypeID"; lstPaymentType.DataBind(); lstPaymentType.SelectedIndex = 0; //get gateways lstGateway.DataSource = settingsAdmin.GetGateways(); lstGateway.DataTextField = "GatewayName"; lstGateway.DataValueField = "GatewayTypeID"; lstGateway.DataBind(); lstGateway.SelectedIndex = 0; //get profiles lstProfile.DataSource = settingsAdmin.GetProfiles(); lstProfile.DataTextField = "Name"; lstProfile.DataValueField = "ProfileID"; lstProfile.DataBind(); lstProfile.Items.Insert(0, new ListItem("All Profiles", "-1")); lstProfile.SelectedValue = "-1"; try { if (ItemId > 0) { //get payment setting PaymentSetting paymentSetting = settingsAdmin.GetPaymentSettingByID(ItemId); txtDisplayOrder.Text = paymentSetting.DisplayOrder.ToString(); if (paymentSetting.ProfileID.HasValue) lstProfile.SelectedValue = paymentSetting.ProfileID.Value.ToString(); lstPaymentType.SelectedValue = paymentSetting.PaymentTypeID.ToString(); chkActiveInd.Checked = paymentSetting.ActiveInd; if (paymentSetting.PaymentTypeID == 0) { pnlCreditCard.Visible = true; ZNodeEncryption encrypt = new ZNodeEncryption(); txtGatewayUserName.Text = encrypt.DecryptData(paymentSetting.GatewayUsername); //if authorize.net if (paymentSetting.GatewayTypeID == 1) { txtTransactionKey.Text = encrypt.DecryptData(paymentSetting.TransactionKey); lblTransactionKey.Text = "Transaction key (Authorize.Net only)"; pnlAuthorizeNet.Visible = true; pnlPassword.Visible = false; chkTestMode.Checked = paymentSetting.TestMode; chkPreAuthorize.Checked = paymentSetting.PreAuthorize; pnlGatewayOptions.Visible = true; } //if verisign payflow pro else if (paymentSetting.GatewayTypeID == 2) { txtVendor.Text = paymentSetting.Vendor; // Vendor txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); txtPartner.Text = paymentSetting.Partner; pnlPassword.Visible = true; pnlVerisignGateway.Visible = true; chkTestMode.Checked = paymentSetting.TestMode; pnlGatewayOptions.Visible = true; } //if Nova Gateway else if (paymentSetting.GatewayTypeID == 5) { txtTransactionKey.Text = encrypt.DecryptData(paymentSetting.TransactionKey); lblTransactionKey.Text = "Pin Number (Nova gateway Only)"; pnlAuthorizeNet.Visible = true; pnlPassword.Visible = true; txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); chkTestMode.Checked = paymentSetting.TestMode; } //if NSoftware Gateway else if (paymentSetting.GatewayTypeID == 6) { txtTransactionKey.Text = paymentSetting.TransactionKey; txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); lblTransactionKey.Text = "Transaction key"; pnlAuthorizeNet.Visible = true; pnlPassword.Visible = true; chkTestMode.Checked = paymentSetting.TestMode; } else if (paymentSetting.GatewayTypeID == 9) { pnlLogin.Visible = false; pnlPassword.Visible = false; chkTestMode.Checked = paymentSetting.TestMode; } //if World Pay Gateway else if (paymentSetting.GatewayTypeID == 10) { txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); txtTransactionKey.Text = encrypt.DecryptData(paymentSetting.TransactionKey); lblGatewayUserName.Text = "Merchant Code"; lblGatewaypassword.Text = "Authorization Password"; lblTransactionKey.Text = "World Pay Installation Id"; pnlAuthorizeNet.Visible = true; pnlPassword.Visible = true; chkTestMode.Checked = paymentSetting.TestMode; } else { pnlAuthorizeNet.Visible = false; pnlPassword.Visible = true; txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); txtTransactionKey.Text = ""; chkTestMode.Checked = paymentSetting.TestMode; } lstGateway.SelectedValue = paymentSetting.GatewayTypeID.ToString(); chkEnableAmex.Checked = (bool)paymentSetting.EnableAmex; chkEnableDiscover.Checked = (bool)paymentSetting.EnableDiscover; chkEnableMasterCard.Checked = (bool)paymentSetting.EnableMasterCard; chkEnableVisa.Checked = (bool)paymentSetting.EnableVisa; //ChkEnableOfflinemode.Checked = (bool)paymentSetting.OfflineMode; //ChkEnableCreditCard.Checked = (bool)paymentSetting.SaveCreditCartInfo; } else if (paymentSetting.PaymentTypeID == 2) { pnlCreditCard.Visible = true; ZNodeEncryption encrypt = new ZNodeEncryption(); txtGatewayUserName.Text = encrypt.DecryptData(paymentSetting.GatewayUsername); txtTransactionKey.Text = paymentSetting.TransactionKey; txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); lblTransactionKey.Text = "API Signature (Paypal only)"; pnlAuthorizeNet.Visible = true; pnlPassword.Visible = true; pnlGatewayList.Visible = false; pnlCreditCardOptions.Visible = false; chkTestMode.Checked = paymentSetting.TestMode; } else if (paymentSetting.PaymentTypeID == 3) //If Google Checkout is Selected { ZNodeEncryption encrypt = new ZNodeEncryption(); txtGatewayUserName.Text = encrypt.DecryptData(paymentSetting.GatewayUsername); txtGatewayPassword.Text = encrypt.DecryptData(paymentSetting.GatewayPassword); chkTestMode.Checked = paymentSetting.TestMode; pnlCreditCardOptions.Visible = false; //Hide CreditCard Options pnlGatewayList.Visible = false; // Hide Gateway dropdownlist pnlCreditCard.Visible = true; //Enable settings pnlAuthorizeNet.Visible = false; //Disable TransactionKey field pnlPassword.Visible = true; // Enable PassWord field } else { pnlCreditCard.Visible = false; } } else { // enable credit card option by default pnlCreditCard.Visible = true; lstGateway.SelectedValue = "1"; BindPanels(); } } catch { //ignore } }
/// <summary> /// Bind data to form fields /// </summary> private void BindData() { StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin(); Portal portal = storeAdmin.GetByPortalId(ZNodeConfigManager.SiteConfig.PortalID); // Set SEO Details if (portal.SeoDefaultProductTitle != null) txtSEOProductTitle.Text = portal.SeoDefaultProductTitle.ToString(); if (portal.SeoDefaultProductDescription != null) txtSEOProductDescription.Text = portal.SeoDefaultProductDescription.ToString(); if (portal.SeoDefaultProductKeyword != null) txtSEOProductKeyword.Text = portal.SeoDefaultProductKeyword.ToString(); if (portal.SeoDefaultCategoryTitle != null) txtSEOCategoryTitle.Text = portal.SeoDefaultCategoryTitle.ToString(); if (portal.SeoDefaultCategoryDescription != null) txtSEOCategoryDescription.Text = portal.SeoDefaultCategoryDescription.ToString(); if (portal.SeoDefaultCategoryKeyword != null) txtSEOCategoryKeyword.Text = portal.SeoDefaultCategoryKeyword.ToString(); if (portal.SeoDefaultContentTitle != null) txtSEOContentTitle.Text = portal.SeoDefaultContentTitle.ToString(); if (portal.SeoDefaultContentDescription != null) txtSEOContentDescription.Text = portal.SeoDefaultContentDescription.ToString(); if (portal.SeoDefaultContentKeyword != null) txtSEOContentKeyword.Text = portal.SeoDefaultContentKeyword.ToString(); }
/// <summary> /// Bind Profile drop down list /// </summary> private void BindData() { StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin(); //get profiles lstProfile.DataSource = settingsAdmin.GetProfiles(); lstProfile.DataTextField = "Name"; lstProfile.DataValueField = "ProfileID"; lstProfile.DataBind(); //Insert New Item ListItem item = new ListItem("All", "0"); lstProfile.Items.Insert(0, item); //Set Default as "ALL" lstProfile.SelectedIndex = 0; }
/// <summary> /// /// </summary> /// <param name="ds"></param> /// <returns></returns> private DataSet FormatReportDataSet(DataSet ds) { //This will copied the structure and data from the Original dataset DataSet tempDataSet = ds.Copy(); # region Local Variables OrderAdmin orderAdmin = new OrderAdmin(); ShippingAdmin shippingAdmin = new ShippingAdmin(); StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin(); #endregion //Initialize new columns for OrderStatus,ShippingType,Payment Type //Add column to this temporary dataset DataColumn columnOrderStatus = new DataColumn("OrderStatus"); tempDataSet.Tables[0].Columns.Add(columnOrderStatus); //Add ShippingType column DataColumn columnShippingType = new DataColumn("ShippingTypeName"); tempDataSet.Tables[0].Columns.Add(columnShippingType); //Add Paymenttype column DataColumn columnPaymentType = new DataColumn("PaymentTypeName"); tempDataSet.Tables[0].Columns.Add(columnPaymentType); //Loop through the Orders in the dataset foreach (DataRow dr in tempDataSet.Tables[0].Rows) { //Get Order Status int OrderStateId = int.Parse(dr["OrderStateId"].ToString()); OrderState entity = orderAdmin.GetByOrderStateID(OrderStateId); int shippingId = int.Parse(dr["ShippingId"].ToString()); Shipping shippingEntity = shippingAdmin.GetShippingOptionById(shippingId); int paymentTypeId = 0; if(dr["PaymentTypeId"].ToString().Length > 0) //If PaymentTypeId value length is greater than Zero paymentTypeId = int.Parse(dr["PaymentTypeId"].ToString()); PaymentType paymentType = storeAdmin.GetPaymentTypeById(paymentTypeId); if (entity != null) dr["OrderStatus"] = entity.OrderStateName; if (shippingEntity != null) dr["ShippingTypeName"] = (shippingAdmin.GetShippingTypeName(shippingEntity.ShippingTypeID)); if (paymentType != null) dr["PaymentTypeName"] = paymentType.Name; } //Return dataset return tempDataSet; }
/// <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() + ")"; }
/// <summary> /// Bind Currency Types to dropdown list /// </summary> private void BindList() { StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin(); ddlCurrencyTypes.DataSource = storeAdmin.GetAll(); ddlCurrencyTypes.DataTextField = "Description"; ddlCurrencyTypes.DataValueField = "CurrencyTypeId"; ddlCurrencyTypes.DataBind(); ddlCurrencyTypes.SelectedValue = "150"; //By Default US-English }
/// <summary> /// Bind data to form fields /// </summary> private void BindData() { StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin(); Portal portal = storeAdmin.GetByPortalId(ZNodeConfigManager.SiteConfig.PortalID); txtDomainName.Text = portal.DomainName; txtCompanyName.Text = portal.CompanyName; txtStoreName.Text = portal.StoreName; chkEnableSSL.Checked = portal.UseSSL; txtAdminEmail.Text = portal.AdminEmail; txtSalesEmail.Text = portal.SalesEmail; txtCustomerServiceEmail.Text = portal.CustomerServiceEmail; txtSalesPhoneNumber.Text = portal.SalesPhoneNumber; txtCustomerServicePhoneNumber.Text = portal.CustomerServicePhoneNumber; txtMaxCatalogDisplayColumns.Text = portal.MaxCatalogDisplayColumns.ToString(); txtMaxCatalogDisplayItems.Text = portal.MaxCatalogDisplayItems.ToString(); txtMaxSmallThumbnailsDisplay.Text = portal.MaxCatalogCategoryDisplayThumbnails.ToString(); chkInclusiveTax.Checked = portal.InclusiveTax; txtMaxCatalogItemLargeWidth.Text = portal.MaxCatalogItemLargeWidth.ToString(); txtMaxCatalogItemMediumWidth.Text = portal.MaxCatalogItemMediumWidth.ToString(); txtMaxCatalogItemSmallWidth.Text = portal.MaxCatalogItemSmallWidth.ToString(); txtMaxCatalogCrossSellWidth.Text = portal.MaxCatalogItemCrossSellWidth.ToString(); txtMaxCatalogItemSwatchesWidth.Text = portal.MaxCatalogItemSwatchWidth.ToString(); txtMaxCatalogItemThumbnailWidth.Text = portal.MaxCatalogItemThumbnailWidth.ToString(); txtShopByPriceMax.Text = portal.ShopByPriceMax.ToString(); txtShopByPriceMin.Text = portal.ShopByPriceMin.ToString(); txtShopByPriceIncrement.Text = portal.ShopByPriceIncrement.ToString(); ListReviewStatus.SelectedValue = portal.DefaultReviewStatus; //Currency Type settings if (portal.CurrencyTypeID.HasValue) { ddlCurrencyTypes.SelectedValue = portal.CurrencyTypeID.Value.ToString(); } //Show Example ShowPriceFormat(); if(portal.SiteWideBottomJavascript!=null) { txtSiteWideBottomJavaScript.Text = portal.SiteWideBottomJavascript.ToString(); } if (portal.SiteWideTopJavascript != null) { txtSiteWideTopJavaScript.Text = portal.SiteWideTopJavascript.ToString(); } if (portal.SiteWideAnalyticsJavascript != null) { txtSiteWideAnalyticsJavascript.Text = portal.SiteWideAnalyticsJavascript.ToString(); } if (portal.OrderReceiptAffiliateJavascript != null) { txtOrderReceiptJavaScript.Text = portal.OrderReceiptAffiliateJavascript.ToString(); } try { ZNodeEncryption encrypt = new ZNodeEncryption(); if (portal.SMTPServer != null) { txtSMTPServer.Text = portal.SMTPServer; } if (portal.SMTPUserName != null) { txtSMTPUserName.Text = encrypt.DecryptData(portal.SMTPUserName); } if (portal.SMTPPassword != null) { txtSMTPPassword.Text = encrypt.DecryptData(portal.SMTPPassword); } //Set UPS Account details if (portal.UPSUserName != null) { txtUPSUserName.Text = encrypt.DecryptData(portal.UPSUserName); } if (portal.UPSPassword != null) { txtUPSPassword.Text = encrypt.DecryptData(portal.UPSPassword); } if (portal.UPSKey != null) { txtUPSKey.Text = encrypt.DecryptData(portal.UPSKey); } //Bind FedEx Account details if (portal.FedExAccountNumber != null) txtAccountNum.Text = encrypt.DecryptData(portal.FedExAccountNumber); if (portal.FedExMeterNumber != null) txtMeterNum.Text = encrypt.DecryptData(portal.FedExMeterNumber); if (portal.FedExProductionKey != null) txtProductionAccessKey.Text = encrypt.DecryptData(portal.FedExProductionKey); if (portal.FedExSecurityCode != null) txtSecurityCode.Text = encrypt.DecryptData(portal.FedExSecurityCode); if (portal.FedExUseDiscountRate.HasValue) chkFedExDiscountRate.Checked = portal.FedExUseDiscountRate.Value; if (portal.FedExAddInsurance.HasValue) chkAddInsurance.Checked = portal.FedExAddInsurance.Value; } catch { //ignore decryption errors } txtShippingAddress1.Text = portal.ShippingOriginAddress1; txtShippingAddress2.Text = portal.ShippingOriginAddress2; txtShippingCity.Text = portal.ShippingOriginCity; txtShippingPhone.Text = portal.ShippingOriginPhone; txtShippingZipCode.Text = portal.ShippingOriginZipCode; txtShippingStateCode.Text = portal.ShippingOriginStateCode; txtShippingCountryCode.Text = portal.ShippingOriginCountryCode; //Units - tab ddlWeightUnits.SelectedValue = portal.WeightUnit; ddlPackageTypeCodes.SelectedValue = portal.FedExPackagingType; ddldropOffTypes.SelectedValue = portal.FedExDropoffType; ddlDimensions.SelectedValue = portal.DimensionUnit; //set logo image imgLogo.ImageUrl = portal.LogoPath; //display tab ddlOrderStateList.SelectedValue = portal.DefaultOrderStateID.GetValueOrDefault(10).ToString(); }