📄 register.cs
字号:
this.InteractiveMessagerTxtIDCard.IsValidEmpty = this.GetEnableValid("IDCard");
this.ReqTxtHomePhone.Visible = this.GetEnableValid("HomePhone");
this.InteractiveMessagerTxtHomePhone.IsValidEmpty = this.GetEnableValid("HomePhone");
this.ReqTxtICQ.Visible = this.GetEnableValid("ICQ");
this.InteractiveMessagerTxtICQ.IsValidEmpty = this.GetEnableValid("ICQ");
this.ReqTxtMobile.Visible = this.GetEnableValid("Mobile");
this.InteractiveMessagerTxtMobile.IsValidEmpty = this.GetEnableValid("Mobile");
this.ReqTxtMSN.Visible = this.GetEnableValid("MSN");
this.InteractiveMessagerTxtMSN.IsValidEmpty = this.GetEnableValid("MSN");
this.ReqTxtPosTitle.Visible = this.GetEnableValid("PosTitle");
this.InteractiveMessagerTxtPosTitle.IsValidEmpty = this.GetEnableValid("PosTitle");
this.ReqTxtQQ.Visible = this.GetEnableValid("QQ");
this.InteractiveMessagerTxtQQ.IsValidEmpty = this.GetEnableValid("QQ");
this.ReqTxtSign.Visible = this.GetEnableValid("Sign");
this.InteractiveMessagerTxtSign.IsValidEmpty = this.GetEnableValid("Sign");
this.ReqTxtSpareEmail.Visible = this.GetEnableValid("SpareEmail");
this.InteractiveMessagerTxtSpareEmail.IsValidEmpty = this.GetEnableValid("SpareEmail");
this.ReqTxtTrueName.Visible = this.GetEnableValid("TrueName");
this.InteractiveMessagerTxtTrueName.IsValidEmpty = this.GetEnableValid("TrueName");
this.ReqTxtUC.Visible = this.GetEnableValid("UC");
this.InteractiveMessagerTxtUC.IsValidEmpty = this.GetEnableValid("UC");
this.ReqTxtUserFace.Visible = this.GetEnableValid("UserFace");
this.InteractiveMessagerTxtUserFace.IsValidEmpty = this.GetEnableValid("UserFace");
this.ReqTxtVocation.Visible = this.GetEnableValid("Vocation");
this.InteractiveMessagerTxtVocation.IsValidEmpty = this.GetEnableValid("Vocation");
this.ReqTxtYahoo.Visible = this.GetEnableValid("Yahoo");
this.InteractiveMessagerTxtYahoo.IsValidEmpty = this.GetEnableValid("Yahoo");
this.ReqTxtZipCode.Visible = this.GetEnableValid("ZipCode");
this.InteractiveMessagerTxtZipCode.IsValidEmpty = this.GetEnableValid("ZipCode");
this.ReqTxtOfficePhone.Visible = this.GetEnableValid("OfficePhone");
this.InteractiveMessagerTxtOfficePhone.IsValidEmpty = this.GetEnableValid("OfficePhone");
this.ReqTxtPHS.Visible = this.GetEnableValid("PHS");
this.InteractiveMessagerTxtPHS.IsValidEmpty = this.GetEnableValid("PHS");
this.ReqDropMarriage.Visible = this.GetEnableValid("Marriage");
this.InteractiveMessagerDropMarriage.IsValidEmpty = this.GetEnableValid("Marriage");
if (this.userSiteConfig.EnableQAofReg)
{
if (!string.IsNullOrEmpty(this.userSiteConfig.RegQuestion1))
{
this.LitRegQuestion1.Text = this.userSiteConfig.RegQuestion1;
this.TrRegQuestion1.Visible = true;
}
if (!string.IsNullOrEmpty(this.userSiteConfig.RegQuestion2))
{
this.LitRegQuestion2.Text = this.userSiteConfig.RegQuestion2;
this.TrRegQuestion2.Visible = true;
}
if (!string.IsNullOrEmpty(this.userSiteConfig.RegQuestion3))
{
this.LitRegQuestion3.Text = this.userSiteConfig.RegQuestion3;
this.TrRegQuestion3.Visible = true;
}
}
if (this.userSiteConfig.EnableCheckCodeOfReg)
{
this.TrVcodeRegister.Visible = true;
}
}
}
protected void BtnRegStep1NotApprove_Click(object sender, EventArgs e)
{
base.Response.Redirect("~/Index.aspx");
}
protected void BtnRegStep2_Click(object sender, EventArgs e)
{
IEncourageStrategy<int> strategy2;
if (!this.userSiteConfig.EnableUserReg)
{
return;
}
if (!this.Page.IsValid)
{
return;
}
this.CheckUserName();
this.CheckEmail();
this.CheckCode();
this.CheckQAofReg();
UserInfo usersInfo = new UserInfo();
usersInfo.Question = this.TxtQuestion.Text;
usersInfo.Answer = StringHelper.MD5(this.TxtAnswer.Text);
usersInfo.Email = this.TxtEmail.Text;
usersInfo.UserFace = this.TxtUserFace.Text;
usersInfo.FaceWidth = DataConverter.CLng(this.TxtFaceWidth.Text);
usersInfo.FaceHeight = DataConverter.CLng(this.TxtFaceHeight.Text);
usersInfo.Sign = this.TxtSign.Text;
usersInfo.PrivacySetting = DataConverter.CLng(this.DropPrivacy.SelectedValue);
ContacterInfo contacterInfo = new ContacterInfo();
contacterInfo.TrueName = this.TxtTrueName.Text;
contacterInfo.Country = this.Region.Country;
contacterInfo.Province = this.Region.Province;
contacterInfo.City = this.Region.City;
contacterInfo.Address = this.TxtAddress.Text;
contacterInfo.ZipCode = this.TxtZipCode.Text;
contacterInfo.OfficePhone = this.TxtOfficePhone.Text;
contacterInfo.HomePhone = this.TxtHomePhone.Text;
contacterInfo.Mobile = this.TxtMobile.Text;
contacterInfo.Fax = this.TxtFax.Text;
contacterInfo.Homepage = this.TxtHomepage.Text;
contacterInfo.Email = this.TxtEmail.Text;
contacterInfo.QQ = this.TxtQQ.Text;
contacterInfo.Msn = this.TxtMSN.Text;
contacterInfo.Icq = this.TxtICQ.Text;
contacterInfo.Yahoo = this.TxtYahoo.Text;
contacterInfo.UC = this.TxtUC.Text;
contacterInfo.Aim = this.TxtAim.Text;
contacterInfo.IdCard = this.TxtIDCard.Text;
contacterInfo.Sex = (UserSexType) Enum.Parse(typeof(UserSexType), this.DropSex.SelectedValue);
contacterInfo.Marriage = (UserMarriageType) Enum.Parse(typeof(UserMarriageType), DataConverter.CLng(this.DropMarriage.SelectedValue).ToString());
if (this.GetDisplayStyle("Income") != "none")
{
contacterInfo.Income = DataConverter.CLng(this.DropIncome.SelectedValue);
}
else
{
contacterInfo.Income = -1;
}
contacterInfo.Education = -1;
contacterInfo.Company = this.TxtCompany.Text;
contacterInfo.Department = this.TxtDepartment.Text;
contacterInfo.ClientId = 0;
contacterInfo.ParentId = 0;
contacterInfo.CreateTime = DateTime.Now;
contacterInfo.Owner = "";
contacterInfo.UserType = ContacterType.EnterpriceMainContacter;
contacterInfo.UpdateTime = DateTime.Now;
contacterInfo.UserName = Users.UserNamefilter(this.TxtUserName.Text);
contacterInfo.Phs = this.TxtPHS.Text;
contacterInfo.Birthday = string.IsNullOrEmpty(this.TxtBirthday.Text) ? null : new DateTime?(this.TxtBirthday.Date);
contacterInfo.Position = this.TxtPosTitle.Text;
usersInfo.UserName = Users.UserNamefilter(this.TxtUserName.Text);
usersInfo.UserPassword = StringHelper.MD5(this.TxtPassword.Text);
usersInfo.GroupId = this.userSiteConfig.GroupId;
usersInfo.JoinTime = DateTime.Now;
usersInfo.RegTime = DateTime.Now;
usersInfo.UserExp = (int) this.userSiteConfig.PresentExp;
usersInfo.UserPoint = 0;
usersInfo.IsInheritGroupRole = true;
usersInfo.Status = UserStatus.None;
if (this.userSiteConfig.EmailCheckReg)
{
usersInfo.Status = UserStatus.WaitValidateByEmail;
usersInfo.CheckNum = DataSecurity.MakeRandomString("abcdefghijklmnopqrstuvwxyz0123456789_", 10);
}
if (this.userSiteConfig.AdminCheckReg)
{
usersInfo.Status = UserStatus.WaitValidateByAdmin;
}
if (this.userSiteConfig.EmailCheckReg && this.userSiteConfig.AdminCheckReg)
{
usersInfo.Status = UserStatus.WaitValidateByAdmin | UserStatus.WaitValidateByEmail;
}
usersInfo.EndTime = new DateTime?(DateTime.Now);
usersInfo.Balance = 0M;
if (!Users.Add(usersInfo, contacterInfo))
{
DynamicPage.WriteErrMsg("<li>注册失败!</li>");
return;
}
if (this.userSiteConfig.PresentMoney != 0.0)
{
IEncourageStrategy<decimal> strategy = new UserMoney();
strategy.IncreaseForUsers(usersInfo.UserId.ToString(), (decimal) this.userSiteConfig.PresentMoney, "注册时赠送的金钱", true, "注册时赠送的金钱");
}
if (this.userSiteConfig.PresentValidNum == 0)
{
goto Label_057A;
}
int howMany = 0;
if (this.userSiteConfig.PresentValidNum == -1)
{
howMany = 0x270f;
}
else
{
switch (this.userSiteConfig.PresentValidUnit)
{
case 1:
howMany = this.userSiteConfig.PresentValidNum;
goto Label_0550;
case 2:
howMany = this.userSiteConfig.PresentValidNum * 30;
goto Label_0550;
case 3:
howMany = this.userSiteConfig.PresentValidNum * 0x16d;
goto Label_0550;
}
howMany = this.userSiteConfig.PresentValidNum;
}
Label_0550:
strategy2 = new UserDate();
strategy2.IncreaseForUsers(usersInfo.UserId.ToString(), howMany, "注册时赠送有效期", true, "注册时赠送有效期");
Label_057A:
if (this.userSiteConfig.PresentPoint != 0)
{
IEncourageStrategy<int> strategy3 = new UserPoint();
strategy3.IncreaseForUsers(usersInfo.UserId.ToString(), this.userSiteConfig.PresentPoint, "注册时赠送点券", true, "注册时赠送点券");
}
if (this.userSiteConfig.EmailCheckReg)
{
MailInfo mailInfo = new MailInfo();
mailInfo.IsBodyHtml = true;
mailInfo.FromName = SiteConfig.SiteInfo.SiteName;
List<MailAddress> list = new List<MailAddress>();
list.Add(new MailAddress(usersInfo.Email));
mailInfo.MailToAddressList = list;
mailInfo.MailBody = this.userSiteConfig.EmailOfRegCheck.Replace("{$CheckNum}", usersInfo.CheckNum).Replace("{$CheckUrl}", base.Request.Url.GetLeftPart(UriPartial.Authority) + base.BasePath + "User/RegisterCheck.aspx?UserName=" + HttpUtility.UrlEncode(usersInfo.UserName) + "&CheckNum=" + usersInfo.CheckNum);
mailInfo.Subject = SiteConfig.SiteInfo.SiteName + "网站会员注册验证码";
if (SendMail.Send(mailInfo) == MailState.Ok)
{
DynamicPage.WriteSuccessMsg("<li>注册验证码已成功发送到你的注册邮箱,请到邮箱查收并验证!</li>", "../Default.aspx");
}
else
{
DynamicPage.WriteSuccessMsg("<li>注册成功,但发送验证邮件失败,请检查邮件地址是否正确,或与网站管理员联系!</li>", "../Default.aspx");
}
}
string str = "";
if (this.userSiteConfig.EnableRegCompany)
{
str = "<li><a href='Company/RegCompany.aspx'>继续注册企业?</a></li>";
}
if (usersInfo.Status == UserStatus.None)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -