protected void btnAddUser_Click(object sender, EventArgs e) { string username = txtUsername.Text; string password = txtPassword.Text; int maxIssued = int.Parse(txtMaxBooksIssued.Text); if (username.Trim().Equals("") || password.Trim().Equals("")) { lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "Please fill in empty username and password fields"; return; } int result = adpUsers.Insert(username, password, ddlRole.Text, maxIssued); if (result == 1) { lblMessage.Text = "User added successfully"; lblMessage.ForeColor = System.Drawing.Color.Green; RefreshGrid(); } else { lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "User not added"; } }
/// <summary> /// This routine will insert a new user into the table. /// This routine will call Exists() internally to make sure that there /// are no duplicate entries. /// </summary> /// <param name="id">The unique ID to insert.</param> /// <param name="pass">The password to insert.</param> /// <returns>A boolean value that determines if the registration was successful.</returns> public static bool Register(Guid id, string pass) { if (!Exists(id) && !_utDisposed) { var result = _userTable.Insert(id, pass); return(result == 1); } return(false); }
public bool InsertUser(string username, string password, int phone, string fname, string lname, short type, string airport, string usr, string pass) { if (authenticate(usr, pass, 28) == false) { return(false); } try { UsersTableAdapter u = new UsersTableAdapter(); u.Insert(username, password, phone, fname, lname, type, airport); } catch (Exception e) { return(false); } return(true); }