public static bool addOrderFood(int a1, DateTime a2, int a3) { try { var tmp = from x in cnDB.enKosarSet where x.rendelesID == a1 select x; enKosar kosar = tmp.FirstOrDefault(); var tmp2 = from x in cnDB.enEtelekSet where x.etelekID == a3 select x; enEtelek etel = tmp2.FirstOrDefault(); enAlacarte alac = new enAlacarte() { datum = a2, enRendeles = kosar, enEtelek = etel }; cnDB.enAlacarteSet.Add(alac); cnDB.SaveChanges(); return(true); } catch (Exception) { } return(false); }
public static bool tryUploadFood(string a2, string a3, int a4, byte[] a5) { try { enEtelek etel = new enEtelek() { //etelekID = a1, kategoria = a2, nev = a3, ar = a4, kep = a5 }; cnDB.enEtelekSet.Add(etel); cnDB.SaveChanges(); return(true); } catch (Exception) { } return(false); }
private void dgAlac_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dgAlac.SelectedIndex != -1) { enEtelek item = ((enEtelek)dgAlac.SelectedItem); tartalom tr = USER.kosar[getFoodIndexInBasket(item.etelekID)]; dpDate.SelectedDate = tr.alacarte_date; btSaveFood.Visibility = Visibility.Visible; dpDate.Visibility = Visibility.Visible; btDeleteFood.Visibility = Visibility.Visible; } else { btSaveFood.Visibility = Visibility.Hidden; dpDate.Visibility = Visibility.Hidden; btDeleteFood.Visibility = Visibility.Hidden; dpDate.SelectedDate = null; } }