private void Realizuj_Click(object sender, RoutedEventArgs e) { using (AptekaDataDataContext con = new AptekaDataDataContext()) { //try // { Dostawa dost = new Dostawa(); Lek lektmp = new Lek(); dost.Data_zam = DateTime.Today; dost.Data_realizacji = DateTime.Today; con.Dostawas.InsertOnSubmit(dost); con.SubmitChanges(); for (int i = 0; i <= ile - 1; i++) { lektmp = (from l in con.Leks where l.LekID == lista[i].lekitem.LekID select l).FirstOrDefault(); lektmp.Ilosc = lektmp.Ilosc + lista[i].ile; con.SubmitChanges(); Dost_ilosc di = new Dost_ilosc(); di.LekID = lista[i].lekitem.LekID; di.DostawaID = dost.DostawaID; di.Ilosc = lista[i].ile; con.Dost_iloscs.InsertOnSubmit(di); con.SubmitChanges(); } MessageBox.Show("Dostawa została zrealizowana!"); DialogResult = true; /* } catch { MessageBox.Show("Wystapił bląd pod czas łaczenia sie z bazą!"); DialogResult = false; }*/ } }
private void detach_Dost_iloscs(Dost_ilosc entity) { this.SendPropertyChanging(); entity.Dostawa = null; }
private void attach_Dost_iloscs(Dost_ilosc entity) { this.SendPropertyChanging(); entity.Dostawa = this; }
partial void DeleteDost_ilosc(Dost_ilosc instance);
partial void UpdateDost_ilosc(Dost_ilosc instance);
partial void InsertDost_ilosc(Dost_ilosc instance);