Imports BVSoftware.BVC.Core Public Class configuration_payment Inherits BaseAdminPage Protected WithEvents lstCards As System.Web.UI.WebControls.CheckBoxList Protected WithEvents btnCancel As System.Web.UI.WebControls.ImageButton Protected WithEvents ChargeAtCheckout As System.Web.UI.WebControls.RadioButtonList Protected WithEvents PayPalUsername As System.Web.UI.WebControls.TextBox Protected WithEvents PayPalItemDescription As System.Web.UI.WebControls.TextBox Protected WithEvents chkCreditCardAllowed As System.Web.UI.WebControls.CheckBox Protected WithEvents chkPayPalAllowed As System.Web.UI.WebControls.CheckBox Protected WithEvents MetaDescriptionControl As BVSoftware.WebControls.MetaTag Protected WithEvents MetaKeywordsControl As BVSoftware.WebControls.MetaTag Protected WithEvents DescriptionPayPal As System.Web.UI.WebControls.TextBox Protected WithEvents InstructionsPaypal As System.Web.UI.WebControls.TextBox Protected WithEvents chkPurchaseOrder As System.Web.UI.WebControls.CheckBox Protected WithEvents DescriptionPurchaseOrder As System.Web.UI.WebControls.TextBox Protected WithEvents InstructionsPurchaseOrder As System.Web.UI.WebControls.TextBox Protected WithEvents chkTelephone As System.Web.UI.WebControls.CheckBox Protected WithEvents DescriptionTelephone As System.Web.UI.WebControls.TextBox Protected WithEvents InstructionsTelephone As System.Web.UI.WebControls.TextBox Protected WithEvents chkFax As System.Web.UI.WebControls.CheckBox Protected WithEvents DescriptionFax As System.Web.UI.WebControls.TextBox Protected WithEvents InstructionsFax As System.Web.UI.WebControls.TextBox Protected WithEvents chkEmail As System.Web.UI.WebControls.CheckBox Protected WithEvents DescriptionEmail As System.Web.UI.WebControls.TextBox Protected WithEvents InstructionsEmail As System.Web.UI.WebControls.TextBox Protected WithEvents chkCheck As System.Web.UI.WebControls.CheckBox Protected WithEvents DescriptionCheck As System.Web.UI.WebControls.TextBox Protected WithEvents InstructionsCheck As System.Web.UI.WebControls.TextBox Protected WithEvents InstructionsCreditCard As System.Web.UI.WebControls.TextBox Protected WithEvents btnSelectCCProcessor As System.Web.UI.WebControls.ImageButton Protected WithEvents msg As BVSoftware.WebControls.WebPageMessage Protected WithEvents chkRequireCVV As System.Web.UI.WebControls.CheckBox Protected WithEvents PayPalCurrencyCodeField As BVSoftware.WebControls.SelectDropDownList Protected WithEvents btnSave As System.Web.UI.WebControls.ImageButton #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load BVC2004Store.CheckThisPage(Security.RolePermission.LoginToAdmin) BVC2004Store.CheckThisPage(Security.RolePermission.AccessSettingsArea) If Not Page.IsPostBack Then MetaKeywordsControl.Content = WebAppSettings.MetaKeywords MetaDescriptionControl.Content = WebAppSettings.MetaDescription End If If Not Page.IsPostBack Then PopulatePaymentStuff() PopulateChargeOptions() PopulateCards() SetActiveCards() End If End Sub Sub PopulatePaymentStuff() Try Me.chkCreditCardAllowed.Checked = WebAppSettings.PaymentEnabledCreditCard Me.chkPayPalAllowed.Checked = WebAppSettings.PaymentEnabledPayPal Me.chkPurchaseOrder.Checked = WebAppSettings.PaymentEnabledPurchaseOrder Me.chkTelephone.Checked = WebAppSettings.PaymentEnabledTelephone Me.chkEmail.Checked = WebAppSettings.PaymentEnabledEmail Me.chkFax.Checked = WebAppSettings.PaymentEnabledFax Me.chkCheck.Checked = WebAppSettings.PaymentEnabledCheck PayPalUsername.Text = WebAppSettings.PayPalUsername PayPalItemDescription.Text = WebAppSettings.PayPalItemDescription Me.DescriptionCheck.Text = WebAppSettings.PaymentDescriptionCheck Me.DescriptionEmail.Text = WebAppSettings.PaymentDescriptionEmail Me.DescriptionFax.Text = WebAppSettings.PaymentDescriptionFax Me.DescriptionPayPal.Text = WebAppSettings.PaymentDescriptionPayPal Me.DescriptionPurchaseOrder.Text = WebAppSettings.PaymentDescriptionPurchaseOrder Me.DescriptionTelephone.Text = WebAppSettings.PaymentDescriptionTelephone Me.InstructionsCheck.Text = WebAppSettings.PaymentInstructionsCheck Me.InstructionsCreditCard.Text = WebAppSettings.PaymentInstructionsCreditCard Me.InstructionsEmail.Text = WebAppSettings.PaymentInstructionsEmail Me.InstructionsFax.Text = WebAppSettings.PaymentInstructionsFax Me.InstructionsPaypal.Text = WebAppSettings.PaymentInstructionsPayPal Me.InstructionsPurchaseOrder.Text = WebAppSettings.PaymentInstructionsPurchaseOrder Me.InstructionsTelephone.Text = WebAppSettings.PaymentInstructionsTelephone Me.PayPalCurrencyCodeField.SelectByValue(WebAppSettings.PayPalCurrencyCode) Catch Ex As Exception msg.ShowException(Ex) End Try End Sub Sub PopulateChargeOptions() ChargeAtCheckout.ClearSelection() Dim li As ListItem For Each li In ChargeAtCheckout.Items If li.Value = WebAppSettings.ChargeAtCheckout Then li.Selected = True End If Next 'SP2- Admin option to require CVV code Me.chkRequireCVV.Checked = WebAppSettings.RequireCVV '-SP2 End Sub Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnCancel.Click Response.Redirect("admindefault.aspx") End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSave.Click SaveSettings() End Sub Private Sub SaveSettings() msg.Clear() Try Dim Cards As New Payment.PaymentCards Dim li As New ListItem For Each li In lstCards.Items If li.Selected = True Then Cards.UpdateMethod(li.Value, "1") Else Cards.UpdateMethod(li.Value, "0") End If Next 'SP2- Admin option to require CVV code WebAppSettings.RequireCVV = Me.chkRequireCVV.Checked '-SP2 Cards = Nothing li = Nothing WebAppSettings.ChargeAtCheckout = ChargeAtCheckout.SelectedValue WebAppSettings.PayPalUsername = Me.PayPalUsername.Text WebAppSettings.PayPalItemDescription = Me.PayPalItemDescription.Text WebAppSettings.PaymentEnabledCheck = Me.chkCheck.Checked WebAppSettings.PaymentEnabledCreditCard = Me.chkCreditCardAllowed.Checked WebAppSettings.PaymentEnabledEmail = Me.chkEmail.Checked WebAppSettings.PaymentEnabledFax = Me.chkFax.Checked WebAppSettings.PaymentEnabledPayPal = Me.chkPayPalAllowed.Checked WebAppSettings.PaymentEnabledPurchaseOrder = Me.chkPurchaseOrder.Checked WebAppSettings.PaymentEnabledTelephone = Me.chkTelephone.Checked WebAppSettings.PaymentDescriptionCheck = Me.DescriptionCheck.Text.Trim WebAppSettings.PaymentDescriptionEmail = Me.DescriptionEmail.Text.Trim WebAppSettings.PaymentDescriptionFax = Me.DescriptionFax.Text.Trim WebAppSettings.PaymentDescriptionPayPal = Me.DescriptionPayPal.Text.Trim WebAppSettings.PaymentDescriptionPurchaseOrder = Me.DescriptionPurchaseOrder.Text.Trim WebAppSettings.PaymentDescriptionTelephone = Me.DescriptionTelephone.Text.Trim WebAppSettings.PaymentInstructionsCheck = Me.InstructionsCheck.Text.Trim WebAppSettings.PaymentInstructionsCreditCard = Me.InstructionsCreditCard.Text.Trim WebAppSettings.PaymentInstructionsEmail = Me.InstructionsEmail.Text.Trim WebAppSettings.PaymentInstructionsFax = Me.InstructionsFax.Text.Trim WebAppSettings.PaymentInstructionsPayPal = Me.InstructionsPaypal.Text.Trim WebAppSettings.PaymentInstructionsPurchaseOrder = Me.InstructionsPurchaseOrder.Text.Trim WebAppSettings.PaymentInstructionsTelephone = Me.InstructionsTelephone.Text.Trim WebAppSettings.PayPalCurrencyCode = Me.PayPalCurrencyCodeField.SelectedValue msg.ShowOK("Changes Saved") Catch Ex As Exception msg.ShowException(Ex) End Try End Sub Sub PopulateCards() Dim Cards As New Payment.PaymentCards lstCards.DataSource = Cards.ToDataTable() lstCards.DataTextField = "name" lstCards.DataValueField = "id" lstCards.DataBind() SetActiveCards() Cards = Nothing End Sub Sub SetActiveCards() Dim dtCards As New DataTable Dim li As New ListItem Dim Cards As New Payment.PaymentCards dtCards = Cards.ToDataTable() If dtCards.Rows.Count > 0 Then Dim iCount As Integer = 0 For iCount = 0 To dtCards.Rows.Count - 1 If dtCards.Rows(iCount).Item("active") = "1" Then li = lstCards.Items.FindByValue(dtCards.Rows(iCount).Item("id")) li.Selected = True End If Next End If Cards = Nothing li = Nothing dtCards = Nothing End Sub Private Sub btnSelectCCProcessor_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSelectCCProcessor.Click SaveSettings() Response.Redirect("configuration_Payment_methods.aspx") End Sub End Class