Exemplo n.º 1
0
        private void btnAtn_Click(object sender, RoutedEventArgs e)
        {
            string connectionString;

            connectionString = Properties.Settings.Default.UsersDBConnectionString;
            string quary;

            quary = "SELECT rang FROM Users WHERE username = '******' AND password = '******'";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = new SqlCommand(quary, connection);
                connection.Open();
                object ex = command.ExecuteScalar();
                if (ex == null)
                {
                    MessageBox.Show("Incorect Username or Password");
                }
                else
                {
                    string result = ex.ToString();
                    if (result == "1")
                    {
                        Menu = new Menu();
                        Menu.Show();
                        this.Close();
                    }
                    if (result == "2")
                    {
                        _Menu = new _Menu();
                        _Menu.Show();
                        this.Close();
                    }
                }
            }
        }
 private void btnMenu_Click(object sender, RoutedEventArgs e)
 {
     Menu = new _Menu();
     Menu.Show();
     this.Close();
 }