Esempio n. 1
0
        public List <Ressemblance> GetPersons(DateTime XmlTime, string PersonID)
        {
            string strXmlTime = XmlTime.ToString("yyyy'-'MM'-'dd' 'HH:mm:ss'.'fff");
            string query      = @"SELECT DISTINCT
                              [BioDocumentID]
                             ,[FIOLat]
                             ,[DocumentNumber]
                             ,[CountryName]
                             ,[DateOfExpiry]
                             ,[FIORus]
                             ,[DateOfBirth]
                             ,[PersonalNumber]
                            FROM VRevealFull
                            WHERE XMLInsertTime= '" + strXmlTime + "' and PersonID=" + PersonID + "";

            List <Ressemblance> RessemblanceList = new List <Ressemblance>();

            using (SqlConnection connection = new SqlConnection(this.mainDbConnectionString))
            {
                try
                {
                    SqlCommand command = new SqlCommand(query, connection);
                    connection.Open();
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            Ressemblance ressemblance = new Ressemblance()
                            {
                                PersonID        = Convert.ToInt32(reader["BioDocumentID"]),
                                FioLat          = reader["FIOLat"].ToString(),
                                DocumentNumber  = reader["DocumentNumber"].ToString(),
                                NationalityCode = reader["CountryName"].ToString(),
                                DocValidity     = Convert.ToDateTime(reader["DateOfExpiry"]),
                                FioRus          = reader["FIORus"].ToString(),
                                DateOfBirth     = Convert.ToDateTime(reader["DateOfBirth"]),
                                PersonalNumber  = reader["PersonalNumber"].ToString(),
                            };
                            RessemblanceList.Add(ressemblance);
                        }
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    RessemblanceList = null;
                }
                return(RessemblanceList);
            }
        }
Esempio n. 2
0
        private void dgBasePersons_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dgBasePersons.SelectedItem != null)
            {
                Ressemblance ressemblance = dgBasePersons.SelectedItem as Ressemblance;
                try
                {
                    byte[]      array  = this.dbWorker.GetRessemblancePhoto(ressemblance.RessemblancePersonID);
                    BitmapImage bitmap = ImageHelper.GetBitmapImageFromArray(array);
                    currentBasePhoto         = bitmap;
                    this.imgBasePhoto.Source = bitmap;
                    if (bitmap != null)
                    {
                        this.imgBasePhotoBack.Visibility = Visibility.Hidden;
                    }
                    else
                    {
                        this.imgBasePhotoBack.Visibility = Visibility.Visible;
                    }
                }
                catch (Exception error)
                {
                    MessageBox.Show(error.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                }


                spBasePerson.DataContext = dgBasePersons.SelectedItem as Ressemblance;


                OUPersons2 =
                    (from People in OUPersons
                     where People.OUPersonID == ressemblance.RessemblancePersonID
                     select People).ToList();

                this.dgOUPersons.ItemsSource = null;
                this.dgOUPersons.ItemsSource = OUPersons2;
                if (OUPersons != null && OUPersons.Count > 0)
                {
                    this.dgOUPersons.SelectedIndex = 0;
                }
            }
        }