private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            LandingWindow landwindow = new LandingWindow();

            landwindow.Show();
            this.Hide();
        }
Esempio n. 2
0
        private void button_Click_1(object sender, RoutedEventArgs e)
        {
            LandingWindow landingwindow = new LandingWindow();

            landingwindow.Show();
            this.Close();
        }
        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            LandingWindow landingwindow = new LandingWindow();

            landingwindow.Show();
            this.Hide();


            //Connection string for database connection
            string connectionString = @"Data Source =.; Integrated Security = True; Connect Timeout = 15; Encrypt = False; TrustServerCertificate = True; ApplicationIntent = ReadWrite; MultiSubnetFailover = False; Initial Catalog = CarRental";
            //Creating the Sql Connection
            SqlConnection connection = new SqlConnection(connectionString);

            connection.Open();
            //SQL QUERY STATEMENT AND COMMAND WOULD BE IN HERE
            connection.Close();
        }
Esempio n. 4
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            string password, username;

            password = txtPassword.Password;
            username = txtUsername.Text;

            if (username.Equals(""))
            {
                MessageBox.Show("Enter username");
            }
            else if (password.Equals(""))
            {
                MessageBox.Show("Enter password");
            }
            else
            {
                connection = new SqlConnection(connectionString);
                connection.Open();
                string query = "Select * from Admin where Username = '******' and Password = '******'";
                command = new SqlCommand(query, connection);
                SqlDataReader myReader = command.ExecuteReader();

                int count = 0;
                while (myReader.Read())
                {
                    count += 1;
                }
                if (count == 1)
                {
                    LandingWindow landingwindow = new LandingWindow();
                    landingwindow.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("username and password not correct");
                }
                txtPassword.Clear();
                txtUsername.Clear();
            }
        }