private void saveButton_Click(object sender, RoutedEventArgs e) { try { int id; using (pisModelDataContext cont = new pisModelDataContext()) { otpremnica art = new otpremnica { datum = Convert.ToDateTime(datumPicker.Text), vrijeme = vrijemeBox.Text }; cont.otpremnicas.InsertOnSubmit(art); cont.SubmitChanges(); var entry = (from ee in cont.otpremnicas select ee).OrderByDescending(ee => ee.broj_narudzbe).FirstOrDefault(); id = entry.broj_narudzbe; iznos.tempOtpremnicaID = id; } updateListBox(); //MessageBox.Show(id.ToString()); stavkeOtpremnicePage stavke = new stavkeOtpremnicePage(); 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 Deleteotpremnica(otpremnica instance);
partial void Updateotpremnica(otpremnica instance);
partial void Insertotpremnica(otpremnica instance);