Registration.aspx.cs
上传用户:cpbs999
上传日期:2022-03-10
资源大小:1805k
文件大小:2k
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using DataAccessLayer;
- public partial class Registration : System.Web.UI.Page
- {
- #region "Page Load"
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- #endregion
- #region "Custom Event Handler checking Registration UserName is already exist or not"
- protected void cvUserName_ServerValidate(object source, ServerValidateEventArgs args)
- {
- DataProcessing _objDataProcessing = new DataProcessing();
- if (!(_objDataProcessing.ValidateUserName(txtUserName.Text.ToLower())))
- {
- args.IsValid = false;
- txtUserName.Text = "";
- }
- }
- #endregion
- #region "Register User"
- protected void btnRegister_Click(object sender, EventArgs e)
- {
- if (Page.IsValid)
- {
- DataProcessing _objDataProcessing = new DataProcessing();
- DataAccessLayer.Registration _objRegistration = new DataAccessLayer.Registration();
- _objRegistration.UserName = txtUserName.Text.ToLower();
- _objRegistration.UserPassword = Security.EncryptUsingTripleDES(txtPassword.Text);
- _objRegistration.Email = txtEmail.Text;
- _objRegistration.IsActive = 1;
- _objRegistration.CreatedWhen = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
- _objDataProcessing.InsertRegistrationInformation(_objRegistration);
- if (!_objDataProcessing.ErrorStatus)
- {
- Session["UserName"] = txtUserName.Text;
- Response.Redirect("~/Homepage.aspx");
- }
- }
- }
- #endregion
- }