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 System.Data.SqlClient;//
using System.Configuration;//
namespace Home.Member
{
public class Register : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button btnCommand;
protected System.Web.UI.WebControls.TextBox txtUserID;
protected System.Web.UI.WebControls.TextBox txtUserName;
protected System.Web.UI.WebControls.TextBox txtPassword;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;
protected System.Web.UI.WebControls.TextBox txtPasswordConfirm;
protected System.Web.UI.WebControls.CompareValidator CompareValidator1;
protected System.Web.UI.WebControls.RegularExpressionValidator RegularExpressionValidator1;
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
protected System.Web.UI.WebControls.TextBox txtEmail;
private void Page_Load(object sender, System.EventArgs e)
{
}
#region Web Form µðÀÚÀ̳ʿ¡¼ »ý¼ºÇÑ ÄÚµå
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: ÀÌ È£ÃâÀº ASP.NET Web Form µðÀÚÀ̳ʿ¡ ÇÊ¿äÇÕ´Ï´Ù.
//
InitializeComponent();
base.OnInit(e);
}
///
/// µðÀÚÀÌ³Ê Áö¿ø¿¡ ÇÊ¿äÇÑ ¸Þ¼µåÀÔ´Ï´Ù.
/// ÀÌ ¸Þ¼µåÀÇ ³»¿ëÀ» ÄÚµå ÆíÁý±â·Î ¼öÁ¤ÇÏÁö ¸¶½Ê½Ã¿À.
///
private void InitializeComponent()
{
this.btnCommand.Click += new System.EventHandler(this.btnCommand_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
// ȸ¿ø °¡ÀÔ
private void btnCommand_Click(object sender, System.EventArgs e)
{
SqlConnection objCon = new SqlConnection(
ConfigurationSettings.AppSettings["ConnectionString"]);
objCon.Open();
SqlCommand objCmd = new SqlCommand();
objCmd.Connection = objCon;
objCmd.CommandText =
"Select Count(*) From Users Where UserID = '"
+ this.txtUserID.Text + "'";
objCmd.CommandType = CommandType.Text;
int intCount = (int)objCmd.ExecuteScalar();
if(intCount > 0)
{
string strMsg =
"";
this.RegisterClientScriptBlock("no", strMsg);
}
else
{
objCmd.CommandText = "procInsertUsers";
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.Add(
new SqlParameter("@UserID", this.txtUserID.Text));
objCmd.Parameters.Add(
new SqlParameter("@UserName", this.txtUserName.Text));
objCmd.Parameters.Add(
new SqlParameter("@Password", this.txtPassword.Text));
objCmd.Parameters.Add(
new SqlParameter("@Email", this.txtEmail.Text));
objCmd.ExecuteNonQuery();
objCon.Close();
string strMsg =
"";
this.RegisterClientScriptBlock("ok", strMsg);
// ȸ¿ø °¡ÀÔ°ú µ¿½Ã¿¡ ·Î±×ÀΠó¸®...
Response.Redirect("/Home/Default.aspx");//À̵¿
}
}
}
}