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

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

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

                //MessageBox.Show(id.ToString());
                stavkeZahtjevnicePage stavke = new stavkeZahtjevnicePage();
                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());
            }
        }