/// <summary>
        /// Accesses the get patient informations.
        /// </summary>
        /// <param name="idPatient">The identifier patient.</param>
        private void AccessGetPatientInformations(int idPatient)
        {
            using (SqlConnection connection = new SqlConnection("Data Source=SQL5025.myASP.NET;Initial Catalog=DB_A0ADFA_HPCareDBContext;User Id=DB_A0ADFA_HPCareDBContext_admin;Password=hpcare2016;"))
            {
                SqlCommand command = new SqlCommand("SELECT Users.Address, Users.Email, Genders.GenderName, MaritalStatus.MaritalStatusName, Users.Name, Users.Telephone, " +
                                                    " Users.User_identification,Patient.IsAlive,Patient.Patient_DOB,AgeGroups.Description FROM Genders INNER JOIN Users ON Genders.GenderId = Users.gender_GenderId " +
                                                    " INNER JOIN MaritalStatus ON Users.MaritalStatus_MaritalStatusId = MaritalStatus.MaritalStatusId INNER JOIN Patient ON Users.User_id = Patient.User_id " +
                                                    " INNER JOIN AgeGroups ON Patient.Patient_Age_Group_AgeGroup_id = AgeGroups.AgeGroup_id and users.User_id = " + idPatient + ";", connection);
                command.CommandType = CommandType.Text;
                command.Connection  = connection;
                connection.Open();

                DbDataReader dbDataReader = command.ExecuteReader();
                PatientInformationViewModel viewModel;

                while (dbDataReader.Read())
                {
                    viewModel = new PatientInformationViewModel
                    {
                        Address             = GetStringSafely(dbDataReader, 0),
                        Email               = GetStringSafely(dbDataReader, 1),
                        gender              = GetStringSafely(dbDataReader, 2),
                        MaritalStatus       = GetStringSafely(dbDataReader, 3),
                        Name                = GetStringSafely(dbDataReader, 4),
                        Telephone           = GetStringSafely(dbDataReader, 5),
                        User_identification = GetStringSafely(dbDataReader, 6),
                        IsAlive             = dbDataReader.GetBoolean(7),
                        Patient_DOB         = GetDateDefault(dbDataReader, 8),
                        Description         = GetStringSafely(dbDataReader, 9)
                    };
                    patientInformationList.Add(viewModel);
                }
            }
        }
Esempio n. 2
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Patients != null)
                {
                    patientInformationViewModel = new PatientInformationViewModel(Agencys, Patients);
                }
                else
                {
                    patientInformationViewModel = new PatientInformationViewModel();
                }

                DataContext = patientInformationViewModel;
            }
            catch (Exception ex)
            {
                ErrorLog.ErrorMessageOutput(ex.ToString());
            }
        }
Esempio n. 3
0
        public static bool CopyToLocalPatient(this LocalPatient localPatient, PatientInformationViewModel patientInformationViewModel)
        {
            bool toreturn = false;

            if (localPatient.Name != patientInformationViewModel.Name ||
                localPatient.Surname != patientInformationViewModel.Surname)
            {
                toreturn = true;
            }
            localPatient.BirthDate    = patientInformationViewModel.BirthDate;
            localPatient.Block        = patientInformationViewModel.Bloc;
            localPatient.Ocupation    = patientInformationViewModel.Ocupation;
            localPatient.Phone        = patientInformationViewModel.Phone;
            localPatient.Street       = patientInformationViewModel.Street;
            localPatient.Name         = patientInformationViewModel.Name;
            localPatient.StreetNumber = patientInformationViewModel.Number;
            localPatient.Surname      = patientInformationViewModel.Surname;
            localPatient.Email        = patientInformationViewModel.Email;
            localPatient.Country      = patientInformationViewModel.Country;
            localPatient.City         = patientInformationViewModel.City;
            localPatient.Job          = patientInformationViewModel.Job;
            localPatient.AllName      = localPatient.Surname + (!string.IsNullOrEmpty(localPatient.Surname) ? " " : "") + localPatient.Name;
            return(true);
        }