protected void Button1_Click(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["Project"]; User_Attripute user = new User_Attripute { User_Id = int.Parse(cookie["id"].ToString()), Address = txtAddress.Text, Email = txtEmail.Text, Name = txtName.Text, Password = txtPass.Text, State = true }; Users.Update(user, user.User_Id); }
protected void btnConfirm_Click(object sender, EventArgs e) { string req = Request.QueryString["email"]; DataTable data = Users.SelectByEmail(req); User_Attripute user = new User_Attripute { Address = data.Rows[0]["Address"].ToString(), Email = req, Name = data.Rows[0]["Name"].ToString(), Password = txtNewPassword.Text, State = bool.Parse(data.Rows[0]["State"].ToString()), User_Id = int.Parse(data.Rows[0]["User_Id"].ToString()) }; Users.Update(user, user.User_Id); Response.Redirect("LogIn.aspx"); }
public static int Update(User_Attripute user, int id) { string state = $"Update Users set Name = '{user.Name}', Email = '{user.Email}', Password = '******', Address = '{user.Address}' where User_Id = {id}"; return(Connection.ExecuteNonQuery(state)); }
public static int Insert(User_Attripute user) { string state = $"insert into Users (Name, Email, Password, State, Address) values ('{user.Name}', '{user.Email}', '{user.Password}', '{user.State}', '{user.Address}')"; return(Connection.ExecuteNonQuery(state)); }