private void btnUpdate_Doctor_Click(object sender, RoutedEventArgs e) { if (docSelected == null) { return; } String firstname = txtFirstName.Text; String lastname = txtLastName.Text; String username = txtUsername.Text; String password = txtPassword.Text; String type = "doctor"; int catid = int.Parse(cboCategory.SelectedValue.ToString()); String phone = txtPhone.Text; DateTime dob = (DateTime)txtDob.SelectedDate; int salary = Convert.ToInt32(txtSalary.Text); String gender = "male"; if (((radioFemale.IsChecked ?? false) || (radioMale.IsChecked ?? false)) && !string.IsNullOrEmpty(firstname) && !string.IsNullOrEmpty(lastname) && !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(type) && !string.IsNullOrEmpty(phone) && !string.IsNullOrEmpty(txtDob.Text) && !string.IsNullOrEmpty(txtSalary.Text) && !string.IsNullOrEmpty(cboCategory.Text)) { if (radioFemale.IsChecked ?? false) { gender = "female"; } } else { MessageBox.Show("Please make sure all attributes are compelted.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (username != docSelected.employee.user.username && hms.getUser(username) != null) { MessageBox.Show("Username already exists!", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } docSelected.employee.firstname = firstname; docSelected.employee.lastname = lastname; docSelected.employee.dob = dob; docSelected.employee.salary = salary; docSelected.employee.phone = phone; docSelected.employee.gender = gender; docSelected.employee.user.username = username; docSelected.employee.user.password = password; docSelected.employee.user.type = type; docSelected.catid = catid; hms.updateDoctor(docSelected); MessageBox.Show("Record updated success.", "Success", MessageBoxButton.OK, MessageBoxImage.Information); dataGrid_Doctor.Items.Refresh(); PatientList = hms.getPatientList(); dataGrid_Patient.Items.Refresh(); }