Imports BVSoftware.BVC.Core Public Class Affiliate_Signup Inherits BaseStorePage #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Protected WithEvents MetaDescriptionControl As BVSoftware.WebControls.MetaTag Protected WithEvents MetaKeywordsControl As BVSoftware.WebControls.MetaTag Protected WithEvents TrailHomeLink As System.Web.UI.WebControls.HyperLink Protected WithEvents TitleLabel As System.Web.UI.WebControls.Label Protected WithEvents DisplayNameField As System.Web.UI.WebControls.TextBox Protected WithEvents TaxIDField As System.Web.UI.WebControls.TextBox Protected WithEvents DriversLicenseNumberField As System.Web.UI.WebControls.TextBox Protected WithEvents btnCancel As System.Web.UI.WebControls.ImageButton Protected WithEvents btnSave As System.Web.UI.WebControls.ImageButton Protected WithEvents WebSiteURLField As System.Web.UI.WebControls.TextBox Protected WithEvents chkAgree As System.Web.UI.WebControls.CheckBox Protected WithEvents pnlSignup As System.Web.UI.WebControls.Panel Protected WithEvents pnlComplete As System.Web.UI.WebControls.Panel Protected WithEvents lblAffiliateLink As System.Web.UI.WebControls.Label Protected WithEvents AddressControl1 As AddressControl Protected WithEvents CSSTag1 As BVSoftware.WebControls.CSSTag Protected WithEvents pnlAffiliate As System.Web.UI.WebControls.Panel Protected WithEvents msg As BVSoftware.WebControls.WebPageMessage Protected WithEvents valEmail As System.Web.UI.WebControls.RequiredFieldValidator Protected WithEvents valWebSite As System.Web.UI.WebControls.RequiredFieldValidator 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object 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 If Not Page.IsPostBack Then MetaKeywordsControl.Content = WebAppSettings.MetaKeywords MetaDescriptionControl.Content = WebAppSettings.MetaDescription CSSTag1.StyleSheetURL = PersonalizationServices.GetPersonalizedStyleSheet 'Me.TitleLabel.Text = SiteContent.SiteTerms.GetTerm("ContactUs") PageTitle = "Sign Up" Me.btnCancel.ImageUrl = ImageHelper.GetThemedButton("Cancel.gif") Me.btnSave.ImageUrl = ImageHelper.GetThemedButton("Submit.gif") AddressControl1.ShowMiddleInitial = True AddressControl1.ShowCompanyName = True AddressControl1.ShowPhoneNumber = True AddressControl1.ShowFaxNumber = True AddressControl1.ShowWebSiteURL = False Me.valEmail.Text = ImageHelper.GetErrorIconTag Me.valWebSite.Text = ImageHelper.GetErrorIconTag End If If WebAppSettings.AffiliateSignupAllowed = True Then pnlAffiliate.Visible = True Else pnlAffiliate.Visible = False End If End Sub Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnCancel.Click Response.Redirect("Affiliate_Intro.aspx") End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSave.Click msg.Clear() If chkAgree.Checked = True Then If AddressControl1.Validate = True Then If CreateAffiliate() = True Then Me.pnlSignup.Visible = False Me.pnlComplete.Visible = True End If End If Else msg.ShowWarning("You must agree to the Terms and Conditions to join the affiliate program.") End If End Sub Private Function CreateAffiliate() As Boolean Dim result As Boolean = False Dim aff As New Contacts.Affiliate Try If Not aff Is Nothing Then aff.DisplayName = HttpUtility.HtmlEncode(DisplayNameField.Text) aff.CommissionAmount = WebAppSettings.AffiliateCommission aff.ReferralDays = WebAppSettings.AffiliateReferralDays aff.CommissionType = WebAppSettings.AffiliateCommissionType aff.TaxID = HttpUtility.HtmlEncode(Me.TaxIDField.Text.Trim) aff.DriversLicenseNumber = HttpUtility.HtmlEncode(Me.DriversLicenseNumberField.Text.Trim) aff.WebSiteURL = HttpUtility.HtmlEncode(Me.WebSiteURLField.Text.Trim) aff.Address = AddressControl1.GetAsAddress If ContactServices.Affiliates.CreateNew(aff) > 0 Then result = True Me.lblAffiliateLink.Text = "Your Affiliate ID is: " & aff.ID & "
" Me.lblAffiliateLink.Text += "Your affiliate Link Is: " & Server.HtmlEncode(ContactServices.Affiliates.GetDefaultLink(aff.ID)) Else msg.ShowError("Couldn't Create New Affiliate Account. Save Failed.") End If End If Catch Ex As Exception msg.ShowException(Ex) result = False End Try aff = Nothing Return result End Function End Class