protected void Button1_Click(object sender, EventArgs e) { if (new main_class().is_user_available_by_username(TextBox23.Text) == false) { tbl_usersTableAdapter md = new tbl_usersTableAdapter(); md.InsertIntoUsers(TextBox23.Text, new main_class().Encode(TextBox19.Text), "", TextBox6.Text, TextBox15.Text, TextBox16.Text, TextBox17.Text, TextBox18.Text, TextBox20.Text, TextBox21.Text, TextBox22.Text); pnl_registration_complete.Visible = true; pnl_registration_form.Visible = false; pnl_registration_forget.Visible = false; main_class mc = new main_class(); string str = mc.get_value_from_setting("email_registration_body"); str = Regex.Replace(str,"000", mc.get_value_from_setting("pub_en_company_name")); str = Regex.Replace(str, "001", TextBox23.Text); str = Regex.Replace(str, "002", TextBox19.Text); str = Regex.Replace(str, "003", TextBox23.Text); str = Regex.Replace(str, "004", TextBox19.Text); str = Regex.Replace(str, "005", mc.get_value_from_setting("home_page_address")); str = Regex.Replace(str, "006", mc.get_value_from_setting("home_page_address")); str = Regex.Replace(str, "007", mc.get_value_from_setting("fa_address_of_company")); str = Regex.Replace(str, "008", mc.get_value_from_setting("en_address_of_company")); mc.send_email(TextBox18.Text, "Registration in " + mc.get_value_from_setting("pub_en_company_name"), str); } else { pnl_registration_complete.Visible = false; pnl_registration_form.Visible = false; pnl_registration_forget.Visible = true; } }
protected void Button1_Click(object sender, EventArgs e) { if (new main_class().is_user_available_by_username(TextBox23.Text) == false) { if (new MainDataModuleTableAdapters.tbl_usersTableAdapter().CheckEmail(TextBox18.Text).ToString() == "0") { tbl_usersTableAdapter md = new tbl_usersTableAdapter(); md.InsertIntoUsers(TextBox23.Text, new main_class().Encode(TextBox19.Text), "", TextBox6.Text, TextBox15.Text, TextBox16.Text, TextBox17.Text, TextBox18.Text, TextBox20.Text, TextBox21.Text, TextBox22.Text, -1); pnl_registration_complete.Visible = true; pnl_registration_form.Visible = false; pnl_registration_forget.Visible = false; } else { pnl_registration_complete.Visible = false; pnl_registration_form.Visible = false; pnl_registration_forget.Visible = true; } } else { pnl_registration_complete.Visible = false; pnl_registration_form.Visible = false; pnl_registration_forget.Visible = true; } }
protected void LinkButton1_Click(object sender, EventArgs e) { tbl_usersTableAdapter tb = new tbl_usersTableAdapter(); if (tb.CheckIfUserNameExistsOrNot(TextBox1.Text, new main_class().Encode(TextBox2.Text)) == 1) { HttpCookie hc = new HttpCookie("username", TextBox1.Text); HttpCookie hp = new HttpCookie("password", new main_class().Encode(TextBox2.Text)); hc.Expires.AddDays(15); hp.Expires.AddDays(15); Response.Cookies.Add(hc); Response.Cookies.Add(hp); Response.Redirect("homepage.aspx"); } else { Label3.Visible = true; } }
public int GetUserNameAndPasswordAndReturnOwnerID(string username, string password) { int ownerid = -1; /*string username = "******"; string pass = "******"; if (Request.Cookies["username"] != null && Request.Cookies["password"] != null) { username = Request.Cookies["username"].Value.ToString(); pass = Request.Cookies["password"].Value.ToString(); }*/ tbl_usersTableAdapter tb = new tbl_usersTableAdapter(); int ownerID = (int)tb.GetOwnerIDfromUsername(username, password); return ownerid; }
private bool AuthenticateMe(string userName, string password, bool rememberUserName) { bool auth = false; password = new main_class().Encode(password); if (new tbl_usersTableAdapter().CheckIfUserNameExistsOrNot(userName, password) == 1) { auth = true; Session["OwnerID"] = new tbl_usersTableAdapter().GetOwnerIDfromUsername(userName, password).ToString(); Session["OwnerWeight"] = new tbl_OwnerTableAdapter().GetOwnerWieght(Convert.ToInt32(Session["OwnerID"].ToString())); Session["userName"] = userName; Session["password"] = password; Response.Cookies.Add(new HttpCookie("password",password)); Response.Cookies.Add(new HttpCookie("userName", userName)); Response.Cookies.Add(new HttpCookie("OwnerID", Session["OwnerID"].ToString())); Response.Cookies.Add(new HttpCookie("OwnerWeight", Session["OwnerWeight"].ToString())); } return auth; }
protected void btn_submit_Click(object sender, EventArgs e) { tbl_usersTableAdapter tb = new tbl_usersTableAdapter(); int ownerID = 0; int userWeight = 99; try { ownerID = (int)tb.GetOwnerIDfromUsername(TextBox1.Text, new main_class().Encode(TextBox2.Text)); userWeight = (int)tb.GetUserGroupWeight(TextBox1.Text); } catch (Exception __e) { Response.Redirect("login.aspx"); } if (ownerID != -1) { Response.Cookies.Add(new HttpCookie("username", TextBox1.Text)); Response.Cookies.Add(new HttpCookie("password", new main_class().Encode(TextBox2.Text))); Response.Cookies.Add(new HttpCookie("owner", new main_class().Encode(ownerID.ToString()))); Response.Cookies.Add(new HttpCookie("userWeight", new main_class().Encode(userWeight.ToString()))); //Session["modulename"] = "مانیتورینگ"; string mdname = "default.aspx"; if (Session["modulename"] != null) { } else { //mdname = Session["modulename"].ToString(); } Response.Redirect("links.aspx?page_id=11"); } else { Label3.Visible = true; } }