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); }