private void saveButton_Click(object sender, RoutedEventArgs e) { try { int id; using (pisModelDataContext cont = new pisModelDataContext()) { izdatnica art = new izdatnica { datum = Convert.ToDateTime(datumPicker.Text), vrijeme = vrijemeBox.Text }; cont.izdatnicas.InsertOnSubmit(art); cont.SubmitChanges(); var entry = (from ee in cont.izdatnicas select ee).OrderByDescending(ee => ee.id).FirstOrDefault(); id = entry.id; iznos.tempIzdatnicaID = id; } updateListBox(); //MessageBox.Show(id.ToString()); stavkeIzdatnicePage stavke = new stavkeIzdatnicePage(); 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 Updateizdatnica(izdatnica instance);
partial void Deleteizdatnica(izdatnica instance);
partial void Insertizdatnica(izdatnica instance);