예제 #1
0
        private void BackToMenu(object sender, RoutedEventArgs e)
        {
            string       login        = string.Empty;
            StreamReader streamReader = new StreamReader("UserLogin.txt");

            login = streamReader.ReadLine();
            streamReader.Close();
            string mySelectQuery = "SELECT * FROM Users WHERE [UserLogin] = '" + login + "'";

            using (SqlDataAdapter dataAdapter = new SqlDataAdapter(mySelectQuery, connectionString))
            {
                DataTable table = new DataTable();
                dataAdapter.Fill(table);
                if (table.Rows.Count > 0)
                {
                    MainMenuEmployee mainMenuEmployee = new MainMenuEmployee();
                    mainMenuEmployee.Show();
                    this.Close();
                }
                else if (table.Rows.Count == 0)
                {
                    MainMenuGuest mainMenuGuest = new MainMenuGuest();
                    mainMenuGuest.Show();
                    this.Close();
                }
            }
        }
        private void Guest_Click(object sender, RoutedEventArgs e)
        {
            StreamWriter loginStreamWriter = new StreamWriter("UserLogin.txt");

            loginStreamWriter.Write("");
            loginStreamWriter.Close();
            MainMenuGuest mainMenu = new MainMenuGuest();

            this.Close();
            mainMenu.Show();
        }