private void btnAddUser_Click(object sender, RoutedEventArgs e) { Dentist d = cbDentist.SelectedItem as Dentist; if (d == null) { MessageBox.Show("Please select a Dentist first."); return; } if (txtPasswd.Text.Equals(string.Empty)) { MessageBox.Show("Type your password to updated."); return; } if (!txtPasswd.Text.Equals(txtConfirm.Text)) { MessageBox.Show("Password didn't match. Please try again."); return; } SmileUser u = new SmileUser(); u.UserId = d.UserId; u.Password = DB.CalculateMD5Hash(txtConfirm.Text); DB.InsertUser(u); }
private bool validateUser(string username, string password) { //+ Here you would implement code, which will get the validation for the given credentials //+ from a database, a webservice or from somewhere else //! Remember : ONLY for demonstration purposes I have used a local Collection SmileUser validatedUser = null;// this.userList.FirstOrDefault(user => user.UserId.Equals(username) && user.Password.Equals(password)); if (DB.login(username, password, ref validatedUser)) { App.user = validatedUser; return(validatedUser != null); } return(validatedUser != null); }
private string getUserImagePath() { SmileUser currentUser = this.userList.FirstOrDefault(user => user.UserId.Equals(this.UserName)); return(String.Empty); }