⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reg2.aspx.cs

📁 1、用SQL查询器打开install目录下的dooogo.sql运行之后创建数据库dooogo。 2、然后打开web.config修改 <DbProvider type="Club.Fram
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Club.Framework;
using Club.Framework.Components;
using Club.Framework.Configuration;
namespace Club
{
	/// <summary>
	/// register1 的摘要说明。
	/// </summary>
	public class reg2 : System.Web.UI.Page
	{
		protected Club.Common.WebUI.ContentRegion titleContains;
		protected Club.Common.WebUI.ContentRegion headerContains;
		protected Club.Common.WebUI.ContentRegion Content;
		protected Club.Common.WebUI.HomePage PageManage;
		protected System.Web.UI.WebControls.TextBox txtUsername;
		protected System.Web.UI.WebControls.TextBox txtPassword;
		protected System.Web.UI.WebControls.TextBox txtEmail;
		protected System.Web.UI.WebControls.TextBox txtFamilyName;
		protected System.Web.UI.WebControls.TextBox txtFirstName;
		protected System.Web.UI.WebControls.TextBox txtNiceName;
		protected System.Web.UI.WebControls.RadioButtonList Sex;
		protected System.Web.UI.WebControls.Button btnNext;
		protected System.Web.UI.WebControls.Panel Panel2;
		protected System.Web.UI.WebControls.Panel Panel1;
		protected System.Web.UI.HtmlControls.HtmlForm form1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!Page.IsPostBack)
			{
				if(Session["Reg1"]==null)
				{
					Response.Redirect("~/reg1.aspx");
				}
			}
			Ajax.Utility.RegisterTypeForAjax(typeof(reg2));
			this.RegisterClientScriptBlock("Validator",Globals.Javascript.Validator());
		}
		[Ajax.AjaxMethod()]
		public bool IsExistUserName(string userName)
		{
			return Globals.DbProvider.IsExistUserByUserName(userName);
		}
		[Ajax.AjaxMethod()]
		public bool IsExistEmail(string email)
		{
			return Globals.DbProvider.IsExistUserByEmail(email);
		}
		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void btnNext_Click(object sender, System.EventArgs e)
		{
			c_UserInfo _c_UserInfo = new c_UserInfo();			_c_UserInfo.Username = this.txtUsername.Text;			_c_UserInfo.Password = MySecurity.SEncryptString(this.txtPassword.Text);			_c_UserInfo.Email = this.txtEmail.Text;			_c_UserInfo.FamilyName = this.txtFamilyName.Text;			_c_UserInfo.FirstName = this.txtFirstName.Text;			_c_UserInfo.NiceName = this.txtNiceName.Text;			_c_UserInfo.Sex = 1;			_c_UserInfo.Birthday = DateTime.Parse("1900-1-1");			_c_UserInfo.CountryID = 0;			_c_UserInfo.ProvinceID = 0;			_c_UserInfo.CityID = 0;			_c_UserInfo.RegisterDate =DateTime.Now;			_c_UserInfo.StateID = Config.Settings.RegisterState;			_c_UserInfo.LastIP = null;			_c_UserInfo.ThisIP = Request.UserHostAddress;			_c_UserInfo.LastLoginDate = DateTime.Parse("1900-1-1");			_c_UserInfo.ThisLoginDate = DateTime.Parse("1900-1-1");			_c_UserInfo.DegreeID = 0;			_c_UserInfo.BeginSeviceDate = DateTime.Parse("1900-1-1");			_c_UserInfo.EndSeviceDate = DateTime.Parse("1900-1-1");			_c_UserInfo.Hits = 0;			_c_UserInfo.LoginTimes = 0;			if(Globals.DbProvider.Create_c_UserInfo(_c_UserInfo))			{				if(!sendMail(_c_UserInfo))				{					throw new ShowException("注册成功,但密码发送到邮箱失败,请检查您注册的邮箱是否有效!");				}				this.Panel1.Visible = false;				this.Panel2.Visible = true;			}
			else			{				throw new ShowException("注册失败,请重新注册!");			}		}
		private bool sendMail(c_UserInfo user)
		{
			string subjec="嘟嘟狗网上家园(Dooogo.com)注册成功!";
			string body="感谢您注册嘟嘟狗网上家园\n";
			body+="用户名:"+user.Username+"\n";
			body+="密码:"+MySecurity.SDecryptString(user.Password)+"\n";
			body+="请妥善保管您的用户名和密码。\n";
			body+="如有什么问题:请登陆http://www.dooogo.com咨询。";
			return Globals.SystemMail.Send(user.Email,Globals.SystemMail.UserName,subjec,body);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -