/// <summary> /// enables the textboxes so that /// changes/updates can be applied to a /// user's login information /// </summary> private void enable() { FirstnameTB.ReadOnly = false; FirstnameTB.Focus(); LastnameTB.ReadOnly = false; emailTB.ReadOnly = false; usernameTB.ReadOnly = false; PasswordTB.ReadOnly = false; AccessTypeCB.Enabled = true; }
/// <summary> /// clears the fields/textboxes /// to enter a new user's information /// </summary> private void NewClearTB() { newID = db.Users.Max(m => m.UserID) + 1; UseridTB.Text = newID.ToString(); FirstnameTB.Clear(); LastnameTB.Clear(); emailTB.Clear(); usernameTB.Clear(); PasswordTB.Clear(); usernameTB.ReadOnly = true; PasswordTB.ReadOnly = true; AccessTypeCB.Enabled = true; AccessTypeCB.SelectedIndex = -1; enable(); }
/// <summary> /// checks textboxes for null values /// </summary> /// <returns></returns> private bool CheckTB() { bool result = true; if (String.IsNullOrEmpty(FirstnameTB.Text)) { errorMsg.SetError(FirstnameTB, "Firstname is missing."); result = false; FirstnameTB.Focus(); } else { errorMsg.SetError(FirstnameTB, ""); } if (String.IsNullOrEmpty(LastnameTB.Text)) { errorMsg.SetError(LastnameTB, "Lastname is missing."); result = false; LastnameTB.Focus(); } else { errorMsg.SetError(LastnameTB, ""); } if (String.IsNullOrEmpty(usernameTB.Text)) { errorMsg.SetError(usernameTB, "Username is missing."); result = false; usernameTB.Focus(); } else { errorMsg.SetError(usernameTB, ""); } if (String.IsNullOrEmpty(PasswordTB.Text)) { errorMsg.SetError(PasswordTB, " Password is missing."); result = false; PasswordTB.Focus(); } else { errorMsg.SetError(PasswordTB, ""); } if (String.IsNullOrEmpty(AccessTypeCB.Text)) { errorMsg.SetError(AccessTypeCB, "Access Type is missing."); result = false; AccessTypeCB.Focus(); } else { errorMsg.SetError(AccessTypeCB, ""); } return(result); }