using System;
using System.Web.UI.HtmlControls;
public partial class BuyNow : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void cmdContinue_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
UG.Affiliate objAffiliate = new UG.Affiliate();
objAffiliate.ReferralCode = txtRefCode.Text.ToUpper();
objAffiliate.Email = "";
if (txtRefCode.Text.Trim() != "" && !objAffiliate.IsAffiliateExist())
{
ErrLabel.Text = "Please enter correct referral code. This referral code does not exist.";
return;
}
UG.User objUser = new UG.User();
objUser.FirstName = UG.Utility.Text.ProperCase(txtFirstName.Text.Trim());
objUser.LastName = UG.Utility.Text.ProperCase(txtLastName.Text.Trim());
objUser.Email = txtEmail.Text.Trim();
objUser.Password = UG.Utility.Password.EncodePassword(UG.Utility.Password.RandomPasword(8, 12), UG.Utility.Password.PasswordFormat.Encrypted);
objUser.Address = txtAddress.Text;
objUser.City = UG.Utility.Text.ProperCase(txtCity.Text.Trim());
objUser.State = UG.Utility.Text.ProperCase(txtState.Text.Trim());
objUser.Zip = txtZip.Text.Trim();
objUser.Phone = System.Text.RegularExpressions.Regex.Replace(txtPhone.Text.Trim(), @"\D", "");
objUser.ReferralCode = txtRefCode.Text.ToUpper();
if (objUser.ValidateLogin(true))
{
ErrLabel.Text = "Email address already exists.";
}
else
{
objUser.AddUser();
if (!objUser.OperationStatus)
{
Response.Redirect("BuyNow2.aspx?UID=" + objUser.UserID.ToString());
//SendEmail(objUser.Email, objUser.FirstName + " " + objUser.LastName, objUser.Password);
//ErrLabel.Text = "You have registered successfully. Please check your mail for login information.";
//Response.AddHeader("refresh", "3;BuyNow.aspx");
}
else
{
ErrLabel.Text = objUser.OperationResult;
}
}
}
}
}