private void UploadPatientDicomClick(object sender, System.Windows.RoutedEventArgs e)
        {
            if (cmbPatients.SelectedValue == null) return;

            var patientDataRepository = new PatientDataRepository();
            var appointmentInfo = new AppointmentInfo();

            var manageDicom = new ManagePatientDicom();
            manageDicom.PatientId = int.Parse(cmbPatients.SelectedValue.ToString());
            manageDicom.UniqueIdentifier = patientDataRepository.GetPatientUniqueIdentifier(int.Parse(cmbPatients.SelectedValue.ToString()));
            manageDicom.ShowDialog();
        }
        private void LoadPatients(object sender, System.Windows.RoutedEventArgs e)
        {
            var patientViewModel = new List<PatientViewModel>();
            var patientDataRepository = new PatientDataRepository();
            var patients = patientDataRepository.GetAllPatients();

            foreach (var patient in patients)
            {
                patientViewModel.Add(new PatientViewModel
                {
                    FullName = patient.FirstName + " " + patient.LastName,
                    Id = patient.PatientId
                });
            }

            cmbPatients.ItemsSource = patientViewModel;
            cmbPatients.DisplayMemberPath = "FullName";
            cmbPatients.SelectedValuePath = "Id";
        }
        private void RegisterPatientButtonClick(object sender, RoutedEventArgs e)
        {
            if (noOfErrorsOnScreen > 0)
            {
                errorLabel.Visibility = System.Windows.Visibility.Visible;
                return;
            }

            bool isMale = false;
            try
            {
                if (rdMale.IsChecked != null && bool.Parse(rdMale.IsChecked.ToString()))
                    isMale = true;
                var patientDataRepository = new PatientDataRepository();
                patientDataRepository.SavePatientRecord(new Patient
                {
                    FirstName = txtFirstName.Text.Trim(),
                    LastName = txtLastName.Text.Trim(),
                    MiddleName = txtMiddleName.Text.Trim(),
                    Address = txtAddress.Text.Trim(),
                    Gender = isMale,
                    DOB = dtPicker.SelectedDate.Value,
                    EmailAddress = txtEmailAddress.Text.Trim(),
                    UserName = txtUserName.Text.Trim(),
                    Password = EncryptDecrypt.EncryptData(passWordBox.Password),
                    PhoneNumber = txtPhoneNumber.Text.Trim()
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            this.Hide();
            var mainWindow = new MainWindow();
            mainWindow.ShowDialog();
            this.Close();
        }
        private bool validateUser(string username, string password)
        {
            var patientDataRepository = new PatientDataRepository();
            password = EncryptDecrypt.EncryptData(password);
            var patient = patientDataRepository.GetPatientByUserNamePassword(username, password);
            if (patient != null)
            {
                if (patient.UserName.Equals(username) && patient.Password.Equals(password))
                {
                    EHealthCareDesktopApp.Properties.Settings.Default.PatientID = patient.PatientId;
                    EHealthCareDesktopApp.Properties.Settings.Default.PatientName = patient.FirstName + "  " + patient.LastName;
                    EHealthCareDesktopApp.Properties.Settings.Default.UniqueIdentifier = patient.UniqueIdentifier;
                    EHealthCareDesktopApp.Properties.Settings.Default.Save();
                    return true;
                }
            }

            return false;
        }