private void Save_Btn_Click(object sender, RoutedEventArgs e) { this.save_btn.IsEnabled = false; String firstname = firstnametxt.Text; String lastname = lastnametxt.Text; String username = usernametxt.Text; String password = passwordbox.Password; String phone = cellno.Text; String gender = "male"; String type = "doctor"; int payment = Convert.ToInt32(paymenttxt.Text); String specializtion = experty.Text; DateTime dob = new DateTime(); if (datepicker.SelectedDate != null) { dob = (DateTime)datepicker.SelectedDate; } if (((radiofemale.IsChecked ?? false) || (radiomale.IsChecked ?? false)) && !string.IsNullOrEmpty(firstname) && !string.IsNullOrEmpty(lastname) && !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(phone) && !string.IsNullOrEmpty(datepicker.Text) && !string.IsNullOrEmpty(paymenttxt.Text) && !string.IsNullOrEmpty(experty.Text)) { if (radiofemale.IsChecked ?? false) { gender = "female"; } } else { MessageBox.Show("Please make sure all attributes are completed.", "Reminder", MessageBoxButton.OK, MessageBoxImage.Warning); this.save_btn.IsEnabled = true; return; } if (hmsfac.getUser(username) != null) { MessageBox.Show("Username already exists!", "Warning!", MessageBoxButton.OK, MessageBoxImage.Warning); return; } User u = new User(); u.user_name = username; u.user_password = password; u.user_type = type; Employee emp = new Employee(); emp.emp_firstname = firstname; emp.emp_lastname = lastname; emp.emp_phone = phone; emp.emp_salary = payment; emp.emp_dob = dob; emp.emp_gender = gender; emp.User = u; Category cat = new Category(); cat.cat_name = specializtion; Doctor doc = new Doctor(); doc.Employee = emp; doc.Category = cat; doctorlist.Add(hmsfac.addDoctor(doc)); firstnametxt.Text = ""; lastnametxt.Text = ""; usernametxt.Text = ""; passwordbox.Password = ""; cellno.Text = ""; radiomale.IsChecked = true; paymenttxt.Text = ""; experty.Text = ""; datepicker.Text = ""; this.save_btn.IsEnabled = true; }