Exemple #1
0
        private void logInButton_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection(@"Data Source=DESKTOP-7MEADEG\SQLEXPRESS;Initial Catalog=GymData;Integrated Security=True");

            connection.Open();
            SqlDataAdapter adapter = new SqlDataAdapter("select count(*) from LogIn where UserName='******' and Password='******'", connection);

            DataTable table = new DataTable();

            adapter.Fill(table);
            if (table.Rows[0][0].ToString() == "1")
            {
                SqlDataAdapter adapter1 = new SqlDataAdapter("select Role from LogIn where UserName='******' and Password='******'", connection);
                DataTable      table1   = new DataTable();
                adapter1.Fill(table1);
                if (table1.Rows[0][0].ToString() == "Admin")
                {
                    this.Hide();
                    GymManegment gym = new GymManegment();
                    gym.Show();
                }
                if (table1.Rows[0][0].ToString() == "User")
                {
                    this.Hide();
                    Members add = new Members();
                    add.Show();
                }
            }
            else
            {
                MessageBox.Show("Please check Your User Name and Password And try again!!");
            }
        }
Exemple #2
0
        private void backButton_Click(object sender, EventArgs e)
        {
            this.Hide();
            GymManegment gym = new GymManegment();

            gym.Show();
        }