internal void TrimiteComanda(Cont user) { bool activeCont = false; RestaurantEntities1 context = new RestaurantEntities1(); foreach (var cont in context.DetaliiConts.ToList()) { if (cont.id_cont == user.id_cont) { activeCont = true; } } if (activeCont == true) { context.TrimiteComanda(user.email); var comenzi = context.Comandas.ToList(); context.AdaugareComanda(0, user.email, DateTime.Now); context.SaveChanges(); MessageBox.Show("Comanda trimisa!"); MainViewModel.Instance.ActiveScreen = new PreparateViewModel("Toate categoriile", user); } else { MessageBox.Show("Sunt necesare mai multe detalii!"); MainViewModel.Instance.ActiveScreen = new AdaugaDetaliiContViewMode(user); } }
public void LogIn(string name, string password) { RestaurantEntities1 context = new RestaurantEntities1(); var conturi = context.Conts.ToList(); bool contExistent = false; foreach (var cont in conturi) { if (cont.email == name) { if (cont.parola == password) { var comenzi = context.Comandas.ToList(); bool comandaNoua = true; foreach (var comanda in comenzi) { if (comanda.Cont.email == cont.email && comanda.id_status == 505) { comandaNoua = false; break; } } if (comandaNoua == true) { context.AdaugareComanda(0, cont.email, DateTime.Now); context.SaveChanges(); } MessageBox.Show("Bun venit!"); MainViewModel.Instance.ActiveScreen = new PreparateViewModel("Toate categoriile", cont); } else { MessageBox.Show("Parola gresita!"); } contExistent = true; } } if (contExistent == false) { MessageBox.Show("Cont inexistent!"); } }