private void prv_Check_RegistrBase() { if (File.Exists(g_GV.gs_RegistrBasePath()) == false) { g_SQL.pv_Create_RegistrBase(g_GV.gs_RegistrBasePath()); cl_GlobalVariables.pcl_user_regist lcl_ur = new cl_GlobalVariables.pcl_user_regist(); lcl_ur.Login = "******"; lcl_ur.Date = DateTime.Now.ToShortDateString(); lcl_ur.Attribute = "null"; lcl_ur.Mail = "*****@*****.**"; lcl_ur.Permission = "administrator"; lcl_ur.Name = "Артур"; lcl_ur.Surname = "Хусаинов"; lcl_ur.Password = g_CR.ps_MD5("nUll_admIn#10"); lcl_ur.UID = g_CR.ps_MD5("null_Admin"); g_SQL.pv_Add_RegistrBase(lcl_ur, g_GV.gs_RegistrBasePath()); } }
public void pv_Add_RegistrBase(cl_GlobalVariables.pcl_user_regist lcl_ur, String ls_BasePath) { sql_SQL_Engine = new SqlCeEngine("Data Source='" + ls_BasePath + "';"); sql_SQL_Connection = new SqlCeConnection(sql_SQL_Engine.LocalConnectionString); sql_SQL_Connection.Open(); sql_SQL_Command = sql_SQL_Connection.CreateCommand(); sql_SQL_Command.CommandText = "INSERT INTO Registration(Login, Password, UID, Name, Surname, Date, Mail, Permission, Attribute) VALUES(?,?,?,?,?,?,?,?,?)"; sql_SQL_Command.Parameters.AddWithValue("Login", lcl_ur.Login); sql_SQL_Command.Parameters.AddWithValue("Password", lcl_ur.Password); sql_SQL_Command.Parameters.AddWithValue("UID", lcl_ur.UID); sql_SQL_Command.Parameters.AddWithValue("Name", lcl_ur.Name); sql_SQL_Command.Parameters.AddWithValue("Surname", lcl_ur.Surname); sql_SQL_Command.Parameters.AddWithValue("RegistDate", lcl_ur.Date); sql_SQL_Command.Parameters.AddWithValue("Mail", lcl_ur.Mail); sql_SQL_Command.Parameters.AddWithValue("Permission", lcl_ur.Permission); sql_SQL_Command.Parameters.AddWithValue("Attribute", lcl_ur.Attribute); sql_SQL_Command.ExecuteScalar(); sql_SQL_Connection.Close(); }
protected void butt_regist_Click(object sender, EventArgs e) { if (prb_CheckRegistrData() == true) { cl_GlobalVariables.pcl_user_regist lcl_ur = new cl_GlobalVariables.pcl_user_regist(); lcl_ur.Name = TextBox_name.Text; lcl_ur.Surname = TextBox_surname.Text; lcl_ur.Login = TextBox_login.Text; lcl_ur.Mail = TextBox_mail.Text; lcl_ur.Attribute = "mail_confirm"; lcl_ur.Permission = "user"; lcl_ur.UID = g_CR.ps_UID(); lcl_ur.Password = g_CR.ps_MD5(TextBox_pass.Text); lcl_ur.Date = DateTime.Now.ToShortDateString(); DataTable ldt_Login = g_SQL.pdt_Find_RegistrBase("Login", lcl_ur.Login, g_GV.gs_RegistrBasePath()); DataTable ldt_Mail = g_SQL.pdt_Find_RegistrBase("Mail", lcl_ur.Mail, g_GV.gs_RegistrBasePath()); if (ldt_Login.Rows.Count == 0 & ldt_Mail.Rows.Count == 0) { g_SQL.pv_Add_RegistrBase(lcl_ur, g_GV.gs_RegistrBasePath()); g_Mail.pv_Mail_ConfirmRegistration(lcl_ur.UID, lcl_ur.Mail); Session.Add("information", "mail_confirm"); Response.Redirect("information.aspx"); //cl_GlobalVariables.pcl_UserData lcl_UD = new cl_GlobalVariables.pcl_UserData(); //lcl_UD.Login = lcl_ur.Login; //lcl_UD.UID = lcl_ur.UID; //Session.Add("user_data", (object)lcl_UD); //Response.Redirect("default.aspx"); } else { Label_Registr_Error.Text = "указан существующий логин и/или адрес электронной почты!"; } } else { Label_Registr_Error.Text = "неверно заполнены регистрационые данные!"; } }