private void addButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string temp = orgJedBox.SelectedItem.ToString();
                string[] words = temp.Split('(');
                using (pisModelDataContext cont = new pisModelDataContext())
                {
                    var query = from c in cont.nalog_za_skladistenjes
                                where c.broj_narudzbe == Convert.ToInt32(idBox.Text)
                                select c;
                    foreach (var ord in query)
                    {
                        ord.broj_narudzbe = Convert.ToInt32(idBox.Text);
                        ord.id_org_jed = Convert.ToInt32(words[0]);
                        ord.datum = Convert.ToDateTime(datumPicker.Text);
                        ord.Nalog_izdao_la = logIn.userName;
                        
                    }
                    cont.SubmitChanges();
                }

                stavkeNalogaZaSkladistenje stavke = new stavkeNalogaZaSkladistenje();
                stavke.idBoxx.Text = idBox.Text.ToString();
                iznos.nalogZaSkladistenjeID = Convert.ToInt32(idBox.Text);
                stavke.ShowDialog();
                this.Close();

            }
            catch (Exception ex)
            {
                MessageBox.Show("Dogodila se pogreška!!!\n" + ex.Message.ToString());
            }
            
        }
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string temp = orgJedBox.SelectedItem.ToString();
                string[] words = temp.Split('(');
                int id;
                using (pisModelDataContext cont = new pisModelDataContext())
                {
                    nalog_za_skladistenje art = new nalog_za_skladistenje
                    {
                        datum = Convert.ToDateTime(datumPicker.Text),
                        Nalog_izdao_la = logIn.userName,
                        id_org_jed = Convert.ToInt32(words[0])
                    };
                    cont.nalog_za_skladistenjes.InsertOnSubmit(art);
                    cont.SubmitChanges();
                    var entry = (from ee in cont.nalog_za_skladistenjes
                                 select ee).OrderByDescending(ee => ee.broj_narudzbe).FirstOrDefault();
                    id = entry.broj_narudzbe;
                    iznos.nalogZaSkladistenjeID = id;
                }
                updateListBox();

                //MessageBox.Show(id.ToString());
                stavkeNalogaZaSkladistenje stavke = new stavkeNalogaZaSkladistenje();
                stavke.idBoxx.Text = id.ToString();
                //MessageBox.Show(iznos.tempID.ToString());
                stavke.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Dogodila se pogreška!!!\n" + ex.Message.ToString());
            }
        }