private void getInfoLoading()
 {
     Dispatcher.Invoke(() =>
     {
         string[] arrayprod;
         List <ProdactionSet> prodactions;
         List <KlientsSet> klients;
         UkrzaliznutsaDBEntities ukrzaliznutsaDBEntities = new UkrzaliznutsaDBEntities();
         prodactions = ukrzaliznutsaDBEntities.ProdactionSet.ToList();
         klients     = ukrzaliznutsaDBEntities.KlientsSet.ToList();
         listcontragent.ItemsSource = klients.Select(x => x.NameKlient).ToArray();
         arrayprod = prodactions.Select(x => x.ProdactionName).ToArray();
         listprodact.ItemsSource = arrayprod;
     });
 }
        public void setTicket(string user, string number, string pointstart, string pointend, string typevagon, string price, byte[] photoload, byte[] arrayread, string marshrute)
        {
            UkrzaliznutsaDBEntities ukrzaliznutsaDBEntities = new UkrzaliznutsaDBEntities();
            TicketSet ticket = new TicketSet
            {
                User        = user,
                Number      = number,
                PointStart  = pointstart,
                PointEnd    = pointend,
                TypeVagon   = typevagon,
                Price       = price,
                Photo       = photoload,
                Information = arrayread,
                Marshrute   = marshrute
            };

            ukrzaliznutsaDBEntities.TicketSet.Add(ticket);
            ukrzaliznutsaDBEntities.SaveChanges();
        }
 private void LoadOrder()
 {
     Dispatcher.Invoke(() =>
     {
         try
         {
             UkrzaliznutsaDBEntities ukrzaliznutsaDBEntities = new UkrzaliznutsaDBEntities();
             orders                    = ukrzaliznutsaDBEntities.OrderSet.ToList();
             Number.ItemsSource        = orders.Select(x => x.Number);
             PointStart.ItemsSource    = orders.Select(x => x.PointStart);
             PointEnd.ItemsSource      = orders.Select(x => x.PointEnd);
             TypeTrain.ItemsSource     = orders.Select(x => x.TypeVagon);
             orderloadgrid.ItemsSource = orders.Select(x => new { x.Number, x.PointStart, x.ContragentFrom, x.PointEnd, x.ContragentTo, x.TypeVagon, x.PriceOfOrder, x.Marshrute });
         }
         catch (Exception exp)
         {
             MessageBox.Show(exp.ToString(), "Warning", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     });
 }