private void button_Click(object sender, RoutedEventArgs e) { string username = userName.Text; string pw = PWBox.Password; if (mungoSystem.People .Where(ppl => ppl.Password == pw && ppl.UserName == username && ppl.Deleted == 0) .Count() > 0) { People sessionUser = mungoSystem.People .Where(ppl => ppl.Password == pw && ppl.UserName == username && ppl.Deleted == 0) .First(); mungoSystem.People.Load(); Window showWindow = new Window(); this.Hide(); switch (sessionUser.Group) { case 1: showWindow = new BetegWindow(mungoSystem, sessionUser); break; case 2: showWindow = new OrvosAsszisztensWindow(mungoSystem, sessionUser); break; case 3: showWindow = new ApoloMainWindow(mungoSystem, sessionUser); break; case 4: showWindow = new GazdAlkMainWindow(mungoSystem, sessionUser); break; case 5: showWindow = new RecepciosMainWindow(mungoSystem, sessionUser); break; case 6: showWindow = new AdminWindow(mungoSystem); break; } showWindow.ShowDialog(); // App.Current.Shutdown(); } else { MessageBox.Show("Hibás felhasználónév vagy jelszó!"); } }
private void button_Click(object sender, RoutedEventArgs e) { string username = userName.Text; string pw = PWBox.Password; if (mungoSystem.People .Where(ppl => ppl.Password == pw && ppl.UserName == username && ppl.Deleted == 0) .Count() > 0) { People sessionUser = mungoSystem.People .Where(ppl => ppl.Password == pw && ppl.UserName == username && ppl.Deleted == 0) .First(); mungoSystem.People.Load(); Window showWindow=new Window(); this.Hide(); switch (sessionUser.Group) { case 1: showWindow = new BetegWindow(mungoSystem, sessionUser); break; case 2: showWindow = new OrvosAsszisztensWindow(mungoSystem, sessionUser); break; case 3: showWindow = new ApoloMainWindow(mungoSystem, sessionUser); break; case 4: showWindow = new GazdAlkMainWindow(mungoSystem, sessionUser); break; case 5: showWindow = new RecepciosMainWindow(mungoSystem, sessionUser); break; case 6: showWindow = new AdminWindow(mungoSystem); break; } showWindow.ShowDialog(); // App.Current.Shutdown(); } else { MessageBox.Show("Hibás felhasználónév vagy jelszó!"); } }