private void BtnSubmit_Click(object sender, RoutedEventArgs e) { var user = db.users.FirstOrDefault(x => x.login == txtUsername.Text && x.password == txtPassword.Password); if (user != null && user.login == "manager") { ProviderWindow prWindow = new ProviderWindow(); prWindow.Show(); this.Close(); } else if (user != null && user.login == "admin") { AdminWindow adWindow = new AdminWindow(); adWindow.Show(); this.Close(); } else if (user != null && user.login == "waiter") { WaiterWindow waWindow = new WaiterWindow(); waWindow.Show(); this.Close(); } else { MessageBox.Show("The user doesn't exist"); } }
/// <summary> /// Exibe a janela dos fornecedores. /// </summary> private void ShowProviderWindow() { if (providerWindow == null) { providerWindow = new ProviderWindow(); providerWindow.Owner = mainWindow; providerWindow.Show(); } else { ShowOrHideWindow(providerWindow); } }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { try { ProjectRestaurantEntities _db = new ProjectRestaurantEntities(); var user = _db.users.FirstOrDefault(x => x.login == txtUsername.Text && x.password == txtPassword.Password); if (user != null && user.login == "admin") { AdminWindow dashboard = new AdminWindow(); dashboard.Show(); this.Close(); } else if (user != null && user.login == "chef") { ChefWindow forChef = new ChefWindow(); forChef.Show(); this.Close(); } else if (user != null && user.login == "accountant") { AccountantWindow forAccountant = new AccountantWindow(); forAccountant.Show(); this.Close(); } else if (user != null && user.login == "manager") { ProviderWindow forProvider = new ProviderWindow(); forProvider.Show(); this.Close(); } else if (user != null && user.login == "waiter") { WaiterWindow forWaiter = new WaiterWindow(); forWaiter.Show(); this.Close(); } else { MessageBox.Show("Користувача з такими даними не існує"); } } catch (SqlException ex) { MessageBox.Show(Convert.ToString(ex)); } }
private void ProviderButton_Click(object sender, RoutedEventArgs e) { ProviderWindow pw = new ProviderWindow(); pw.Show(); }