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