private void Button_Click_5(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.ShowDialog();
openFileDialog.Filter = "Image files (*.jpg)|*.jpg|All Files (*.*)|*.*";
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.UriSource = new Uri(openFileDialog.FileName, UriKind.Relative);
bi.DecodePixelHeight = 256;
bi.EndInit();
ImageConverter converter = new ImageConverter();
byte[] bTemp = (byte[])converter.ConvertTo(bi, typeof(byte[]));
Client xx = new Client {Passport = bTemp};
pharma.Client.Add(xx);
pharma.SaveChanges();
dg.ItemsSource = pharma.Client.ToList();
}
private void Button_Click_4(object sender, RoutedEventArgs e)
{
int a = Convert.ToInt32(TB4.Text);
string i = TB1.Text.ToString();
string l = TB2.Text.ToString();
string p = TB3.Text.ToString();
Client r = new Client { IDКлиента = a = Convert.ToInt32(TB4.Text), НомерБилета = i, КонтактныйНомер = l, ФИО = p};
pharma.Client.Add(r);
pharma.SaveChanges();
dg.ItemsSource = pharma.Client.ToList();
}