/// <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> /// 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> /// 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 } }