private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string temp = orgJedBox.SelectedItem.ToString();
                string[] words = temp.Split('(');
                int id;
                using (pisModelDataContext cont = new pisModelDataContext())
                {
                    narudzbenica art = new narudzbenica
                    {
                        datum = Convert.ToDateTime(datumPicker.Text),
                        vrijeme = vrijemeBox.Text,
                        id_org_jed = Convert.ToInt32(words[0])
                    };
                    cont.narudzbenicas.InsertOnSubmit(art);
                    cont.SubmitChanges();
                    var entry = (from ee in cont.narudzbenicas
                                 select ee).OrderByDescending(ee => ee.id).FirstOrDefault();
                    id = entry.id;
                    iznos.tempNarudzbenicaID = id;
                }
                updateListBox();

                //MessageBox.Show(id.ToString());
                stavkeNarudzbenice stavke = new stavkeNarudzbenice();
                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());
            }
        }
 partial void Deletenarudzbenica(narudzbenica instance);
 partial void Insertnarudzbenica(narudzbenica instance);
 partial void Updatenarudzbenica(narudzbenica instance);
		private void detach_narudzbenicas(narudzbenica entity)
		{
			this.SendPropertyChanging();
			entity.organizacijska_jedinica = null;
		}